[FFmpeg-user] last frame missing from mpeg2 and mpeg1 encodes

Chris Vincze chris-v at moving-picture.com
Fri Feb 22 12:50:48 CET 2013


Hi there,

I'm missing the last frame on all my mpeg-1 and mpeg-2 encodes. I'm using a 1000 frame test quicktime as a source with frame numbers as the only image so it's really easy to see the missing frame. The console output looks like it is reaching frame 1000, but the output is too short. (reading the resulting file back in with ffprobe shows a shorter than expected duration). Is there something wrong with my command line?

I've tried the 1000 frame source as uncompressed 8 bit, and ProRes to both MPEG-1 and MPEG-2. Below is the output from the MPEG 2 encode.

Many thanks for your help

Chris


ffmpeg -i '1000_frames_Uncomp8bit.mov' -r 25.0 -vf 'scale=720:576' -c:v mpeg2video -pix_fmt yuv420p -b:v 6M -c:a mp2 -b:a 192k -r:a 48000 -y 'MPEG-2_test.mpg'


ffmpeg version 1.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 18 2013 20:45:30 with gcc 4.0.1 (GCC) (Apple Inc. build 5493)
  configuration: --prefix=/software/ffmpeg/1.1/macos.leopard.i386 --enable-shared --enable-pic --enable-gpl --enable-version3 --enable-nonfree --disable-doc --enable-postproc --enable-avfilter --enable-pthreads --enable-runtime-cpudetect --enable-libx264 --enable-libxvid --enable-libvorbis --enable-libspeex --enable-libtheora --enable-libopenjpeg --extra-ldflags=-L/software/x264/2013.01.08/macos.leopard.i386/lib --extra-ldflags=-L/software/xvidcore/1.3.2/macos.leopard.i386/lib --extra-ldflags=-L/software/xiph.org/2011.09.11/macos.leopard.i386/lib --extra-ldflags=-L/software/openjpeg/1.5.1/macos.leopard.i386/lib --extra-ldflags=-L/software/ffmpeg/1.1/macos.leopard.i386/lib --extra-ldflags='-Wl,-rpath,/software/xiph.org/2011.09.11/macos.leopard.i386/lib' --extra-cflags=-I/software/x264/2013.01.08/macos.leopard.i386/include --extra-cflags=-I/software/xvidcore/1.3.2/macos.leopard.i386/include --extra-cflags=-I/software/xiph.org/2011.09.11/macos.leopard.i386/include --extra-cflags=-I/software/openjpeg/1.5.1/macos  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1000_frames_Uncomp8bit.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2013-02-22 11:05:51
    timecode        : 00:00:00:00
  Duration: 00:00:40.00, start: 0.000000, bitrate: 58983 kb/s
    Stream #0:0(eng): Video: rawvideo (2vuy / 0x79757632), uyvy422, 512x288, 58982 kb/s, SAR 1000:1000 DAR 16:9, 25 fps, 25 tbr, 2500 tbn, 2500 tbc
    Metadata:
      creation_time   : 2013-02-22 11:05:51
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2013-02-22 11:06:06
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
[mpeg @ 0x1834c20] VBV buffer size not set, muxing may fail
Output #0, mpeg, to '.MPEG-2_test.mpg':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    timecode        : 00:00:00:00
    encoder         : Lavf54.59.106
    Stream #0:0(eng): Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 6000 kb/s, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 2013-02-22 11:05:51
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
Press [q] to stop, [?] for help
frame=   75 fps=0.0 q=2.0 size=     268kB time=00:00:02.92 bitrate= 751.9kbits/s
frame=  152 fps=151 q=2.0 size=     556kB time=00:00:06.00 bitrate= 759.1kbits/s
frame=  230 fps=152 q=1.6 size=     866kB time=00:00:09.12 bitrate= 777.9kbits/s
frame=  307 fps=152 q=2.0 size=    1170kB time=00:00:12.20 bitrate= 785.6kbits/s
frame=  384 fps=153 q=2.0 size=    1474kB time=00:00:15.28 bitrate= 790.2kbits/s
frame=  462 fps=153 q=2.0 size=    1788kB time=00:00:18.40 bitrate= 796.0kbits/s
frame=  539 fps=153 q=2.0 size=    2082kB time=00:00:21.48 bitrate= 794.0kbits/s
frame=  616 fps=153 q=2.0 size=    2390kB time=00:00:24.56 bitrate= 797.2kbits/s
frame=  693 fps=153 q=2.0 size=    2698kB time=00:00:27.64 bitrate= 799.6kbits/s
frame=  771 fps=153 q=2.0 size=    3004kB time=00:00:30.76 bitrate= 800.0kbits/s
frame=  849 fps=153 q=2.0 size=    3312kB time=00:00:33.88 bitrate= 800.8kbits/s
frame=  926 fps=153 q=1.6 size=    3634kB time=00:00:36.96 bitrate= 805.5kbits/s
frame= 1000 fps=153 q=2.0 Lsize=    3940kB time=00:00:39.96 bitrate= 807.7kbits/s
video:3905kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.894722%

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

 ffprobe MPEG-2_test.mpg

ffprobe version 1.1 Copyright (c) 2007-2013 the FFmpeg developers
  built on Feb 18 2013 20:45:30 with gcc 4.0.1 (GCC) (Apple Inc. build 5493)
  configuration: --prefix=/software/ffmpeg/1.1/macos.leopard.i386 --enable-shared --enable-pic --enable-gpl --enable-version3 --enable-nonfree --disable-doc --enable-postproc --enable-avfilter --enable-pthreads --enable-runtime-cpudetect --enable-libx264 --enable-libxvid --enable-libvorbis --enable-libspeex --enable-libtheora --enable-libopenjpeg --extra-ldflags=-L/software/x264/2013.01.08/macos.leopard.i386/lib --extra-ldflags=-L/software/xvidcore/1.3.2/macos.leopard.i386/lib --extra-ldflags=-L/software/xiph.org/2011.09.11/macos.leopard.i386/lib --extra-ldflags=-L/software/openjpeg/1.5.1/macos.leopard.i386/lib --extra-ldflags=-L/software/ffmpeg/1.1/macos.leopard.i386/lib --extra-ldflags='-Wl,-rpath,/software/xiph.org/2011.09.11/macos.leopard.i386/lib' --extra-cflags=-I/software/x264/2013.01.08/macos.leopard.i386/include --extra-cflags=-I/software/xvidcore/1.3.2/macos.leopard.i386/include --extra-cflags=-I/software/xiph.org/2011.09.11/macos.leopard.i386/include --extra-cflags=-I/software/openjpeg/1.5.1/macos  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpeg @ 0x180b020] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from 'MPEG-2_test.mpg':
  Duration: 00:00:39.96, start: 0.540000, bitrate: 807 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc




--

Chris Vincze
Head of Data Lab & Stereo Content, Advertising
MPC

T +44 (0)20 7494 7888
E: chris-v at moving-picture.com<mailto:chris-v at moving-picture.com>
W: www.moving-picture.com<http://www.moving-picture.com>


Data Rate Calculator: http://www.moving-picture.com/calculator













More information about the ffmpeg-user mailing list