Recherche avancée

Médias (91)

Autres articles (110)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (13945)

  • cannot resolve variable PIX_FMT_RGB24, ffmpeg source code install with the newest version [duplicate]

    10 août 2016, par NacyL

    This question already has an answer here :

    i installed the ffmpeg from source code according https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu, and write a test file to save ppm file from a video, but the code cannot reslove PIX_FMT_RGB24, i write the code as below :

    int main() {
       // Initalizing these to NULL prevents segfaults!
       AVFormatContext   *pFormatCtx = NULL;
       int               i, videoStream;
       AVCodecContext    *pCodecCtxOrig = NULL;
       AVCodecContext    *pCodecCtx = NULL;
       AVCodec           *pCodec = NULL;
       AVFrame           *pFrame = NULL;
       AVFrame           *pFrameRGB = NULL;
       AVPacket          packet;
       int               frameFinished;
       int               numBytes;
       uint8_t           *buffer = NULL;
       struct SwsContext *sws_ctx = NULL;

       const char* url = "/home/liulijuan/bin/test.mp4";

       // [1] Register all formats and codecs
       av_register_all();

       // [2] Open video file
       if(avformat_open_input(&pFormatCtx, url, NULL, NULL)!=0)
           return -1; // Couldn't open file

       // [3] Retrieve stream information
       if(avformat_find_stream_info(pFormatCtx, NULL)<0)
           return -1; // Couldn't find stream information

       // Dump information about file onto standard error
       av_dump_format(pFormatCtx, 0, url, 0);

       // Find the first video stream
       videoStream=-1;
       for(i=0; inb_streams; i++)
           if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
               videoStream=i;
               break;
           }
       if(videoStream==-1)
           return -1; // Didn't find a video stream

       // Get a pointer to the codec context for the video stream
       pCodecCtxOrig=pFormatCtx->streams[videoStream]->codec;
       // Find the decoder for the video stream
       pCodec=avcodec_find_decoder(pCodecCtxOrig->codec_id);
       if(pCodec==NULL) {
           fprintf(stderr, "Unsupported codec!\n");
           return -1; // Codec not found
       }
       // Copy context
       pCodecCtx = avcodec_alloc_context3(pCodec);
       if(avcodec_copy_context(pCodecCtx, pCodecCtxOrig) != 0) {
           fprintf(stderr, "Couldn't copy codec context");
           return -1; // Error copying codec context
       }

       // Open codec
       if(avcodec_open2(pCodecCtx, pCodec, NULL)<0)
           return -1; // Could not open codec

       // Allocate video frame
       pFrame=av_frame_alloc();

       // Allocate an AVFrame structure
       pFrameRGB=av_frame_alloc();
       if(pFrameRGB==NULL)
           return -1;

       // Determine required buffer size and allocate buffer
       numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
                                   pCodecCtx->height);
       buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));

       // Assign appropriate parts of buffer to image planes in pFrameRGB
       // Note that pFrameRGB is an AVFrame, but AVFrame is a superset
       // of AVPicture
       avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
                      pCodecCtx->width, pCodecCtx->height);

       // initialize SWS context for software scaling
       sws_ctx = sws_getContext(pCodecCtx->width,
                                pCodecCtx->height,
                                pCodecCtx->pix_fmt,
                                pCodecCtx->width,
                                pCodecCtx->height,
                                PIX_FMT_RGB24,
                                SWS_BILINEAR,
                                NULL,
                                NULL,
                                NULL
       );

       // [4] Read frames and save first five frames to disk
       i=0;
       while(av_read_frame(pFormatCtx, &packet)>=0) {
           // Is this a packet from the video stream?
           if(packet.stream_index==videoStream) {
               // Decode video frame
               avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);

               // Did we get a video frame?
               if(frameFinished) {
                   // Convert the image from its native format to RGB
                   sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data,
                             pFrame->linesize, 0, pCodecCtx->height,
                             pFrameRGB->data, pFrameRGB->linesize);

                   // Save the frame to disk
                   if(++i<=5)
                       SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height,
                                 i);
               }
           }

           // Free the packet that was allocated by av_read_frame
           av_free_packet(&packet);
       }

       // Free the RGB image
       av_free(buffer);
       av_frame_free(&pFrameRGB);

       // Free the YUV frame
       av_frame_free(&pFrame);

       // Close the codecs
       avcodec_close(pCodecCtx);
       avcodec_close(pCodecCtxOrig);

       // Close the video file
       avformat_close_input(&pFormatCtx);

       return 0;
    }

    so i replace PIX_FMT_RGB24 with AV_PIX_FMT_RGB24, but i cannot open the saved ppm file, the save code as below :

    void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {
       FILE *pFile;
       char szFilename[32];
       int  y;

       printf("start save frame ...\n");
       // Open file
       sprintf(szFilename, "/home/liulijuan/frame%d.ppm", iFrame);
       pFile=fopen(szFilename, "wb");
       if(pFile==NULL)
           return;

       printf("start write header ...\n");
       // Write header
       fprintf(pFile, "/P6\n%d %d\n255\n", width, height);

       // Write pixel data
       for(y=0; ydata[0]+y*pFrame->linesize[0], 1, width*3, pFile);

       // Close file
       fclose(pFile);
       printf("close file ...\n");
    }

    so, what’s wrong with this code ?

  • FFMPEG - Can't create a video from series of images with RGB24 pixel format

    21 juillet 2016, par DevNull

    Goal


    I’m writing a small proof-of-concept application to take some raw image data I acquire from a digital camera (a series of RGB24 images), and combine them together into a simple, no-audio, video file.


    Work So Far

    The initialization code is as follows :


    AVCodec* pCodec = NULL;
    AVCodecContext* pCodecContext = NULL;
    AVFrame* pFrame = NULL;

    /* Register all available codecs. */
    avcodec_register_all();

    /* Determine if desired video encoder is installed. */
    pCodec = avcodec_find_encoder(CODEC_ID_MJPEG);
    if (!pCodec) {
       printf("Codec not installed!\n");
    }

    pCodecContext = avcodec_alloc_context3(pCodec);
    pFrame = avcodec_alloc_frame();

    Very cut-and-dry. However, when I try to register the codec, it fails with my custom error message, and one dropped in a nice color-coded format directly from the FFMPEG libraries :


    [mjpeg @ 0x650d00] Specified pixel format rgb24 is invalid or not supported
    Codec not available.

    I can confirm that that pixel format is valid easily enough :


    Pixel formats:
    I.... = Supported Input  format for conversion
    .O... = Supported Output format for conversion
    ..H.. = Hardware accelerated format
    ...P. = Paletted format
    ....B = Bitstream format

    2>&1 ffmpeg -pix_fmts | grep -i -e rgb24 -e flags
    FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL
    IO... rgb24                  3            24

    I can also confirm that the video codec I’m trying to use is valid for encoding.


    Codecs:
    D..... = Decoding supported
    .E.... = Encoding supported
    ..V... = Video codec
    ..A... = Audio codec
    ..S... = Subtitle codec
    ...I.. = Intra frame-only codec
    ....L. = Lossy compression
    .....S = Lossless compression

    2>&1 ffmpeg -codecs | grep -i mjpeg              
    DEVIL. mjpeg                Motion JPEG

    Question


    Why is this pixel format not supported ? It seems like such a common one when working with other utilities like MATLAB, OpenCV, FreeImage, etc. Is there any set of options or functions in FFMPEG/AVcodec that can resolve this issue ? I’d like to avoid having to to manually convert my image to a different color-space if possible, so I’m not burning up CPU cycles by first converting the RGB24 image to a new format, THEN encoding a video frame with it.

    Thank you.

  • h264 : fix decoding multiple fields per packet with slice threads

    12 juin 2016, par Anton Khirnov
    h264 : fix decoding multiple fields per packet with slice threads
    

    Since we only know whether a NAL unit corresponds to a new field after
    parsing the slice header, this requires reorganizing the calls to slice
    parsing, per-slice/field/frame init and actual decoding.

    In the previous code, the function for slice header decoding also
    immediately started a new field/frame as necessary, so any slices
    already queued for decoding would no longer be decodable.

    After this patch, we first parse the slice header, and if we determine
    that a new field needs to be started we decode all the queued slices.

    • [DBH] libavcodec/h264_slice.c
    • [DBH] libavcodec/h264dec.c
    • [DBH] libavcodec/h264dec.h