Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • Converting from MXF to MPEG format with FFmpeg [migrated]

    2 mars 2013, par user2060812

    We're trying to convert .mxf video to .mpeg on ffmpeg-0.9.2 and looks like 0.9.2 version doesn't support .mxf conversion to .mpeg.

    We don't want to switch on latest 0.11 version of ffmpeg as the video result is too poor for latest version. Maybe we're not using the right command to convert .mxf format.

    Below is the error on conversion command:

    [root@localhost ~]# ffmpeg -i test.mxf  -ac 2 output.mpg                                                                                     ffmpeg version 0.9.2-syslint, Copyright (c) 2000-2012 the FFmpeg developers
      built on Mar  1 2013 22:34:33 with gcc 4.6.3
      configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint
      libavutil    51. 32. 0 / 51. 54.100
      libavcodec   53. 42. 4 / 53. 42. 4
      libavformat  53. 24. 2 / 53. 24. 2
      libavdevice  53.  4. 0 / 53.  4. 0
      libavfilter   2. 53. 0 /  2. 77.100
      libswscale    2.  1. 0 /  2.  1.100
      libpostproc  51.  2. 0 / 51.  2. 0
    Input #0, mxf, from `test.mxf`:
      Duration: 00:00:07.04, start: 0.000000, bitrate: 62580 kb/s
        Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 720x608 [SAR 608:405 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
        Stream #0:1: Audio: pcm_s16le, 48000 Hz, 8 channels, s16, 6144 kb/s
    File `output.mpg` already exists. Overwrite ? [y/N] y
    Incompatible pixel format `yuv422p` for codec `mpeg1video`, auto-selecting format `yuv420p`
    [buffer @ 0x8476e0] w:720 h:608 pixfmt:yuv422p tb:1/1000000 sar:608/405 sws_param:
    [buffersink @ 0x847b80] auto-inserting filter `auto-inserted scaler 0` between the filter `src` and the filter `out`
    [scale @ 0x848220] w:720 h:608 fmt:yuv422p sar:608/405 -> w:720 h:608 fmt:yuv420p sar:608/405 flags:0x4
    [mpeg @ 0x84a7a0] VBV buffer size not set, muxing may fail
    Output #0, mpeg, to `output.mpg`:
      Metadata:
        encoder         : Lavf53.24.2
        Stream #0:0: Video: mpeg1video, yuv420p, 720x608 [SAR 608:405 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
        Stream #0:1: Audio: mp2, 48000 Hz, 2 channels, s16, 128 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (mpeg2video -> mpeg1video)
      Stream #0:1 -> #0:1 (pcm_s16le -> mp2)
    Press [q] to stop, [?] for help
    [buffer @ 0x8476e0] Changing frame properties on the fly is not supported.
    Failed to inject frame into filter network
    
  • Support for .mxf format on ffmpeg-0.9.2

    2 mars 2013, par user2060812

    We're trying to convert .mxf video to .mpeg on ffmpeg-0.9.2 and looks like 0.9.2 version doesn't support .mxf conversion to .mpeg. We don't want to switch on latest 0.11 version of ffmpeg as the video result is too poor for latest version. Maybe we're not using the right command to convert .mxf format. Below is the error on conversion command :-

    ffmpeg -i test.mxf -ac 2 output.mpg

    [buffer @ 0x8476e0] Changing frame properties on the fly is not supported. Failed to inject frame into filter network

    Can someone assist me regarding it ?

  • Optimized images with FFmpeg ? [closed]

    2 mars 2013, par user1788377

    Google PageSpeed recommends the images on my web page could be optimized. The lossless compression would save an average of 11%, however my images are created with the following FFmpeg command:

    ffmpeg -i '$video_path' -vcodec mjpeg -vframes 1 -an -f rawvideo -ss 00:00:20 -s 145*108 $thumb_image
    

    Is there a way I can optimize these images?

  • How to mention real image instead of dummy image in ffmpeg api-example.c

    2 mars 2013, par Mohan

    I am using video_encode_example function from api-example.c of FFmpeg, which basically creates 25 dummy images and encodes into a one second video. How ever i am unable to mention real images instead of dummy ones. If any one know how to do this for xcode objective C, pl submit a reply. Below is the function

    /*
     * Video encoding example
     */
    static void video_encode_example(const char *filename)
    {
        AVCodec *codec;
        AVCodecContext *c= NULL;
        int i, out_size, size, x, y, outbuf_size;
        FILE *f;
        AVFrame *picture;
        uint8_t *outbuf, *picture_buf;
    
        printf("Video encoding\n");
    
        /* find the mpeg1 video encoder */
        codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
        if (!codec) {
            fprintf(stderr, "codec not found\n");
            exit(1);
        }
    
        c= avcodec_alloc_context();
        picture= avcodec_alloc_frame();
    
        /* put sample parameters */
        c->bit_rate = 400000;
        /* resolution must be a multiple of two */
        c->width = 352;
        c->height = 288;
        /* frames per second */
        c->time_base= (AVRational){1,25};
        c->gop_size = 10; /* emit one intra frame every ten frames */
        c->max_b_frames=1;
        c->pix_fmt = PIX_FMT_YUV420P;
    
        /* open it */
        if (avcodec_open(c, codec) < 0) {
            fprintf(stderr, "could not open codec\n");
            exit(1);
        }
    
        f = fopen(filename, "wb");
        if (!f) {
            fprintf(stderr, "could not open %s\n", filename);
            exit(1);
        }
    
        /* alloc image and output buffer */
        outbuf_size = 100000;
        outbuf = malloc(outbuf_size);
        size = c->width * c->height;
        picture_buf = malloc((size * 3) / 2); /* size for YUV 420 */
    
        picture->data[0] = picture_buf;
        picture->data[1] = picture->data[0] + size;
        picture->data[2] = picture->data[1] + size / 4;
        picture->linesize[0] = c->width;
        picture->linesize[1] = c->width / 2;
        picture->linesize[2] = c->width / 2;
    
        /* encode 1 second of video */
        for(i=0;i<25;i++) {
            fflush(stdout);
            /* prepare a dummy image */
            /* Y */
            for(y=0;yheight;y++) {
                for(x=0;xwidth;x++) {
                    picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
                }
            }
    
            /* Cb and Cr */
            for(y=0;yheight/2;y++) {
                for(x=0;xwidth/2;x++) {
                    picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
                    picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
                }
            }
    
            /* encode the image */
            out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
            printf("encoding frame %3d (size=%5d)\n", i, out_size);
            fwrite(outbuf, 1, out_size, f);
        }
    
        /* get the delayed frames */
        for(; out_size; i++) {
            fflush(stdout);
    
            out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
            printf("write frame %3d (size=%5d)\n", i, out_size);
            fwrite(outbuf, 1, out_size, f);
        }
    
        /* add sequence end code to have a real mpeg file */
        outbuf[0] = 0x00;
        outbuf[1] = 0x00;
        outbuf[2] = 0x01;
        outbuf[3] = 0xb7;
        fwrite(outbuf, 1, 4, f);
        fclose(f);
        free(picture_buf);
        free(outbuf);
    
        avcodec_close(c);
        av_free(c);
        av_free(picture);
        printf("\n");
    }
    
  • Divide videos to sub videos by FFMPEG

    1er mars 2013, par seereen

    I have DVDs each one has 5 avi video ,,,, I am trying to divid these 5 avi to sub videos (at least 12 small avi videos) depending on the marker on some frames ...

    the problem is ... some time the new video contain frames from 2 original avi (for example : the sub video number 7 will have the last frames from original video 2 and the first frames from video 3)
    In this case my code crashed ! and Program received signal: EXC_BAD_ACCESS. error !! the problem happen in this function

    void write_video_frame(AVFormatContext *oc, AVStream *st, AVFrame *frame)
    in if (oc->oformat->flags & AVFMT_RAWPICTURE)  
    

    any idea why I got this problem .... I am using FFMPEG 0.11 and openCV 2.4.3 in OSx 10.6.8