Recherche avancée

Médias (0)

Mot : - Tags -/xmp

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (14628)

  • RoQ on Dreamcast

    18 mars 2011, par Multimedia Mike — Sega Dreamcast

    I have been working on that challenge to play back video on the Sega Dreamcast. To review, I asserted that the RoQ format would be a good fit for the Sega Dreamcast hardware. The goal was to play 640x480 video at 30 frames/second. Short version : I have determined that it is possible to decode such video in real time. However, I ran into certain data rate caveats.

    First off : Have you ever wondered if the Dreamcast can read an 80mm optical disc ? It can ! I discovered this when I only had 60 MB of RoQ samples to burn on a disc and a spindle full of these 210MB-capacity 80mm CD-Rs that I never have occasion to use.



    New RoQ Library
    There are open source RoQ decoders out there but I decided to write a new one. A few reasons : 1) RoQ is so simple that I didn’t think it would take too long ; 2) it would be nice to have a RoQ library that is license-compatible (BSD-like) with the rest of the KallistiOS distribution ; 3) the idroq.tar.gz distribution, while license-compatible, has enough issues that I didn’t want to correct it.

    Thankfully, I was correct about the task not being too difficult : I put together a new RoQ decoder in short order. I’m a bit embarrassed to admit that the part I had the most trouble with was properly converting YUV -> RGB.

    About the approach I took : While the original idroq.tar.gz decoder maintains YUV 4:2:0 codebooks (which led to chroma bugs during motion compensation) and FFmpeg’s decoder maintains YUV 4:4:4 codebooks, this decoder is built to convert the YUV 4:2:0 vectors into RGB565 vectors during the vector unpacking phase. Thus, the entire frame is rendered in RGB565 — no lengthy YUV -> RGB conversion after decoding — and all pixels are shuffled around as 16-bit units (minor speedup vs. shuffling everything as bytes).

    I also entertained the idea of maintaining YUYV codebooks (since the DC supports that colorspace as a texture format). But I scrapped that idea when I remembered it would lead to the same chroma bleeding problem seen in the original idroq.tar.gz decoder.

    Onto The Dreamcast
    I developed the library on a Linux computer, allowing it to output a series of PNM files for visual verification and debugging. Dropping it into a basic DC/KOS-compatible program was trivial and the first order of business was profiling.

    At first, I profiled the entire decode operation : open file, then read and decode each chunk while tossing away the results. I was roundly disappointed to see that, e.g., an 8.5-second RoQ sample needed a little more than 20 seconds to complete. Not real time. I performed a series of optimizations on the decoding library that netted notable performance gains when profiling on Linux. When I brought these same optimizations over to the DC, decoding time didn’t improve at all. This was my first suspicion that perhaps my assumptions regarding the DC’s optical drive’s data rate were not correct.

    Dreamcast Data Rate Profiling
    Let’s start with some definitions : In terms of data rate, an ’X’, i.e., 1X is the minimum data rate needed to read CD quality audio from a disc. At that speed, a drive should be able to stream 75 sectors each second. When reading mode 1/form 1 CD-ROM data, each sector has 2048 bytes (2 kbytes), so a single-speed data rate should achieve 150 kbytes/sec.

    The Dreamcast is supposed to possess a 12X optical drive. This would imply a maximum data rate of 150 kbytes/sec * 12 = 1800 kbytes/sec.

    Rigging up a trivial experiment using the RoQ samples burned on a few different CD-R discs, the best data rate I can see is about 500-525 kbytes/sec, or around 3.5X.

    Where’s the discrepancy ? My first theory has to do with the fact that not all optical media is created equal. This is why optical drives often advertise a slew of numbers which refer to the best theoretical speed for reading a CD vs. writing a CD-R vs. writing a CD-RW, etc. Perhaps the DC drive can’t read CD-Rs very quickly. To test this theory, I tried streaming a large file from a conventionally mastered CD-ROM. This worked well for the closest CD-ROM I had on hand : I was able to stream data at a rate that works out to about 6.5X.

    I smell a science project for another evening : Profiling read speeds from a mastered CD-ROM, burned CD-R, and also a mastered GD-ROM, on each of the 3 Dreamcast consoles I possess (I’ve heard that there’s variance between optical drives depending on manufacturing run).

    The Good News
    I added a little finer-grained code to profile just the video decoding functions. The good news is that the decoder meets my real time goals : That 8.5-second RoQ sample encoded at 640x480x30fps makes its way through the video decoding functions on the DC in a little less than 5 seconds. If the optical drive can supply the data fast enough, the video decoder can take care of the rest.

    The RoQ encoder included with FFmpeg does not honor any bitrate parameters. Instead, I encoded the same file at 320x240. It reportedly decoded in real time and can be streamed in real time as well.

    I say "reportedly" because I’m simply working from textual output at this point ; the next phase is to hook the decoder up to the display hardware.

  • Corrupt AVFrame returned by libavcodec

    2 janvier 2015, par informer2000

    As part of a bigger project, I’m trying to decode a number of HD (1920x1080) video streams simultaneously. Each video stream is stored in raw yuv420p format within an AVI container. I have a Decoder class from which I create a number of objects within different threads (one object per thread). The two main methods in Decoder are decode() and getNextFrame(), which I provide the implementation for below.

    When I separate the decoding logic and use it to decode a single stream, everything works fine. However, when I use the multi-threaded code, I get a segmentation fault and the program crashes within the processing code in the decoding loop. After some investigation, I realized that the data array of the AVFrame filled in getNextFrame() contains addresses which are out of range (according to gdb).

    I’m really lost here ! I’m not doing anything that would change the contents of the AVFrame in my code. The only place where I attempt to access the AVFrame is when I call sws_scale() to convert the color format and that’s where the segmentation fault occurs in the second case because of the corrupt AVFrame. Any suggestion as to why this is happening is greatly appreciated. Thanks in advance.

    The decode() method :

    void decode() {

       QString filename("video.avi");

       AVFormatContext* container = 0;

       if (avformat_open_input(&container, filename.toStdString().c_str(), NULL, NULL) < 0) {
           fprintf(stderr, "Could not open %s\n", filename.toStdString().c_str());
           exit(1);
       }

       if (avformat_find_stream_info(container, NULL) < 0) {
           fprintf(stderr, "Could not find file info..\n");
       }

       // find a video stream
       int stream_id = -1;
       for (unsigned int i = 0; i < container->nb_streams; i++) {
           if (container->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
               stream_id = i;
               break;
           }
       }

       if (stream_id == -1) {
           fprintf(stderr, "Could not find a video stream..\n");
       }

       av_dump_format(container, stream_id, filename.toStdString().c_str(), false);

       // find the appropriate codec and open it
       AVCodecContext* codec_context = container->streams[stream_id]->codec;   // Get a pointer to the codec context for the video stream

       AVCodec* codec = avcodec_find_decoder(codec_context->codec_id);  // Find the decoder for the video stream

       if (codec == NULL) {
           fprintf(stderr, "Could not find a suitable codec..\n");
           return -1; // Codec not found
       }


       // Inform the codec that we can handle truncated bitstreams -- i.e.,
       // bitstreams where frame boundaries can fall in the middle of packets
       if (codec->capabilities & CODEC_CAP_TRUNCATED)
           codec_context->flags |= CODEC_FLAG_TRUNCATED;

       fprintf(stderr, "Codec: %s\n", codec->name);

       // open the codec
       int ret = avcodec_open2(codec_context, codec, NULL);
       if (ret < 0) {
           fprintf(stderr, "Could not open the needed codec.. Error: %d\n", ret);
           return -1;
       }


       // allocate video frame
       AVFrame *frame = avcodec_alloc_frame();  // deprecated, should use av_frame_alloc() instead

       if (!frame) {
           fprintf(stderr, "Could not allocate video frame..\n");
           return -1;
       }

       int frameNumber = 0;

       // as long as there are remaining frames in the stream
       while  (getNextFrame(container, codec_context, stream_id, frame)) {

           // Processing logic here...
           // AVFrame data array contains three addresses which are out of range

       }

       // freeing resources
       av_free(frame);

       avcodec_close(codec_context);

       avformat_close_input(&container);
    }

    The getNextFrame() method :

    bool getNextFrame(AVFormatContext *pFormatCtx,
                     AVCodecContext *pCodecCtx,
                     int videoStream,
                     AVFrame *pFrame) {

       uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];

       char buf[1024];

       int len;

       int got_picture;
       AVPacket avpkt;

       av_init_packet(&avpkt);

       memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);

       // read data from bit stream and store it in the AVPacket object
       while(av_read_frame(pFormatCtx, &avpkt) >= 0) {

           // check the stream index of the read packet to make sure it is a video stream
           if(avpkt.stream_index == videoStream) {

               // decode the packet and store the decoded content in the AVFrame object and set the flag if we have a complete decoded picture
               avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, &avpkt);

               // if we have completed decoding an entire picture (frame), return true
               if(got_picture) {

                   av_free_packet(&avpkt);

                   return true;
               }
           }

           // free the AVPacket object that was allocated by av_read_frame
           av_free_packet(&avpkt);
       }

       return false;

    }

    The lock management callback function :

    static int lock_call_back(void ** mutex, enum AVLockOp op) {
       switch (op) {
           case AV_LOCK_CREATE:
               *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
               pthread_mutex_init((pthread_mutex_t *)(*mutex), NULL);
               break;
           case AV_LOCK_OBTAIN:
               pthread_mutex_lock((pthread_mutex_t *)(*mutex));
               break;
           case AV_LOCK_RELEASE:
               pthread_mutex_unlock((pthread_mutex_t *)(*mutex));
               break;
           case AV_LOCK_DESTROY:
               pthread_mutex_destroy((pthread_mutex_t *)(*mutex));
               free(*mutex);
               break;
       }

       return 0;
    }
  • To all Matomo plugin developers : Matomo 5 is coming, make your plugin compatible now

    5 mai 2023, par Matomo Core Team — Development

    We’re planning to release the first beta of Matomo 5 in a few weeks. For making it easy for Matomo users to be able to upgrade to this beta, it would be great to have as many plugins on the Marketplace as possible already updated and compatible with Matomo 5. Then many users would be able to upgrade to the first beta without any issues.

    Presumably, as you put your plugin on our Marketplace, you want people to use it. Making your plugin compatible with Matomo 5 helps ensure that people will be able to find and keep using your plugin. If your plugin is not compatible with Matomo 5, your plugin will be automatically deactivated in Matomo 5 instances. We’ll be happy to help you achieve compatibility should there be any issue.

    How do I upgrade my Matomo instance to Matomo 5 ?

    If you have installed your Matomo development environment through git, you can simply checkout the Matomo 5 branch “5.x-dev” and install its dependencies by executing these commands :

    • git checkout 5.x-dev
    • composer install

    Alternatively, you can also download the latest version directly from GitHub as a zip file and run composer install afterwards.

    How do I upgrade my plugin to Matomo 5 ?

    While there are some breaking changes in Matomo 5, most of our Platform APIs remain unchanged, and almost all changes are for rarely used APIs. Quite often, making your plugin compatible with Matomo 5 will just be a matter of adjusting the “plugin.json” file (as mentioned in the migration guide).

    You can find all developer documentation on our developer zone which has already been updated for Matomo 5.

    How do I know my plugin changes were released successfully ?

    If you have configured an email address within your “plugin.json” file, then you will receive a confirmation or an error email within a few minutes. Alternatively, you can also check out your plugin page on the Marketplace directly. If the plugin release was successful, you will see additional links below the download button showing which versions your plugin is compatible with.

    what it looks like when your plugin is compatible with multiple Matomo versions

    How can switch between Matomo 4 and Matomo 5 or downgrade to Matomo 4 ?

    To downgrade from Matomo 5 to Matomo 4 in your Matomo development environment :

    • check out the “4.x-dev” branch 
    • run “composer install” as usual

    When will the final Matomo 5 release be available ?

    We estimate the final stable Matomo 5.0.0 release will be released in approx. 2-3 months.

    What is new in Matomo 5 ?

    We don’t have a summary of the changes available just yet but you can see all closed issues within this release here.

    Any questions or need help ?

    If you have any questions, or experience any problems during the migration, don’t hesitate to get in touch with us. We’ll be happy to help get your plugin compatible and the update published. If you find any undocumented breaking change or find any step during the migration process not clear, please let us know as well.

    Thank you for contributing a plugin to the Marketplace and making Matomo better. We really appreciate your work !