[FFmpeg-user] Compressing a video duplicates some frames

Misha Penkov misha.penkov at gmail.com
Wed Oct 10 12:32:42 CEST 2012


Hi,

I'm using ffmpeg to compress a raw YUV video to H.264.  It seems to
compress and play back without problems.  However, I find that the
compression result has two more frames than the original (the original
had 30 frames, and the compressed video has 32).  The two frames
appear to have been inserted at the beginning of the video.  As a
consequence, the two videos are now out of sync.  How can I prevent
this from happening?  I need the two videos to stay in sync after
compression.

A log file of my command-line input is attached.  I can provide the
original YUV video and the AVi if required.

Kind regards,
Michael
-------------- next part --------------
ffmpeg -s 848x480 -i parkrun-848x480-30frames.yuv -vcodec libx264 -y parkrun-848x480-30frames.avi

ffmpeg version N-44735-g6bcbe76 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 25 2012 17:16:20 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-pic --enable-shared
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 58.100 / 54. 58.100
  libavformat    54. 28.101 / 54. 28.101
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0xdd5340] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'parkrun-848x480-30frames.yuv':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 848x480, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0xddcc40] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0xddcc40] profile High, level 3.0
Output #0, avi, to 'parkrun-848x480-30frames.avi':
  Metadata:
    ISFT            : Lavf54.28.101
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 848x480, q=-1--1, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx264)
Press [q] to stop, [?] for help
frame=   30 fps=0.0 q=-1.0 Lsize=     638kB time=00:00:01.12 bitrate=4668.7kbits/s    
video:632kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.992593%
[libx264 @ 0xddcc40] frame I:2     Avg QP:24.36  size: 47284
[libx264 @ 0xddcc40] frame P:14    Avg QP:27.38  size: 32565
[libx264 @ 0xddcc40] frame B:14    Avg QP:31.72  size:  6909
[libx264 @ 0xddcc40] consecutive B-frames:  6.7% 93.3%  0.0%  0.0%
[libx264 @ 0xddcc40] mb I  I16..4:  3.5% 78.6% 17.9%
[libx264 @ 0xddcc40] mb P  I16..4:  0.0%  1.1%  1.3%  P16..4: 35.6% 31.2% 25.3%  0.0%  0.0%    skip: 5.4%
[libx264 @ 0xddcc40] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 40.0%  6.1%  2.3%  direct: 9.3%  skip:42.3%  L0:23.3% L1:46.9% BI:29.7%
[libx264 @ 0xddcc40] 8x8 transform intra:73.8% inter:43.4%
[libx264 @ 0xddcc40] coded y,uvDC,uvAC intra: 59.2% 51.0% 28.5% inter: 42.3% 8.6% 0.6%
[libx264 @ 0xddcc40] i16 v,h,dc,p: 36% 44% 12%  8%
[libx264 @ 0xddcc40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 50%  9% 17%  3%  4%  4%  5%  4%  6%
[libx264 @ 0xddcc40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 13% 14%  7% 10% 11%  9%  9% 11%
[libx264 @ 0xddcc40] i8c dc,h,v,p: 71% 17% 10%  2%
[libx264 @ 0xddcc40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0xddcc40] ref P L0: 66.6% 19.2% 11.0%  3.3%
[libx264 @ 0xddcc40] ref B L0: 92.1%  7.9%
[libx264 @ 0xddcc40] kb/s:4314.63

ffmpeg -s 848x480 -i parkrun-848x480-30frames.yuv -s cif frames/%04d-original.jpeg 

ffmpeg version N-44735-g6bcbe76 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 25 2012 17:16:20 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-pic --enable-shared
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 58.100 / 54. 58.100
  libavformat    54. 28.101 / 54. 28.101
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0x1877340] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'parkrun-848x480-30frames.yuv':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 848x480, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to 'frames/%04d-original.jpeg':
  Metadata:
    encoder         : Lavf54.28.101
    Stream #0:0: Video: mjpeg, yuvj420p, 352x288, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> mjpeg)
Press [q] to stop, [?] for help
frame=   30 fps=0.0 q=0.0 Lsize=       0kB time=00:00:01.20 bitrate=   0.0kbits/s    
video:915kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000000%

ffmpeg -i parkrun-848x480-30frames.avi -s cif frames/%04d-compressed.jpeg

ffmpeg version N-44735-g6bcbe76 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 25 2012 17:16:20 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-pic --enable-shared
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 58.100 / 54. 58.100
  libavformat    54. 28.101 / 54. 28.101
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'parkrun-848x480-30frames.avi':
  Metadata:
    encoder         : Lavf54.28.101
  Duration: 00:00:01.20, start: 0.000000, bitrate: 4357 kb/s
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p, 848x480, 25 fps, 25 tbr, 25 tbn, 50 tbc
Output #0, image2, to 'frames/%04d-compressed.jpeg':
  Metadata:
    encoder         : Lavf54.28.101
    Stream #0:0: Video: mjpeg, yuvj420p, 352x288, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
frame=   32 fps=0.0 q=0.0 Lsize=       0kB time=00:00:01.28 bitrate=   0.0kbits/s dup=2 drop=0    
video:913kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000000%


More information about the ffmpeg-user mailing list