[FFmpeg-user] concat loses 2 frames or freezes up video

S Andreason sandreas41 at gmail.com
Mon Dec 8 19:24:44 CET 2014


 > Never-the-less, trying to concat certain files that appear whole and 
intact with all I/P/B frames, does cause a couple problems, with several 
files, about 10% of the ones I tested.

 > The input files used for these tests, can be found at:
 >  
http://seahorseCorral.org/videos/tests/20141107_4horses-scatter-cows_mini1355.mov 


After some needed sleep I thought of some new tests.

Loading #1 in avidemux looks correct. An I frame every 15 frames. Ah, 
the 2 frames Are there after all, but they are skipped over in mplayer 
because the timing is not 30 fps or something about the joint location.
In avidemux, I frame# 375 is at 12.537 , 390 is at 13.039 but should be 
13.000. Each I frame drifts in time by 0.001 or 0.002 seconds. Using the 
inquiry function of ffmpeg reveals the problem.

 > ffmpeg -i 20141107_test1-loses2frames.mov
ffmpeg version N-68279-g72c9844 Copyright (c) 2000-2014 the FFmpeg 
developers
  built on Dec  7 2014 14:41:06 with gcc 4.9.1 (GCC)
  configuration: --enable-gpl --enable-libx264 --disable-doc 
--disable-htmlpages --disable-podpages --disable-ffserver 
--disable-network --enable-libvpx
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 14.100 / 56. 14.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20141107_test1-loses2frames.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf56.15.102
  Duration: 00:00:22.08, start: 0.000000, bitrate: 7661 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 
1280x720, 7149 kb/s, 29.91 fps, 30 tbr, 15360 tbn, 30720 tbc (default)
    Metadata:
      handler_name    : DataHandler
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, 
mono, s16, 512 kb/s (default)
    Metadata:
      handler_name    : DataHandler

It thinks the frame rate should be 29.91 fps. So why does it correct 
itself only at the joint?

Looking back in the output from when this file was created, it DOES say 
it knew the output file should be 30.0 fps.

Loading #2 in avidemux shows one I frame every 10 seconds. If I ignore 
the warped time stamp, All I-frames look correct. Note the length says 
it is  21:21.13 and fps is 1.5
 > ffmpeg -i 20141107_test2-freezes.mov
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20141107_test2-freezes.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf56.15.102
  Duration: 00:21:21.13, start: 0.000000, bitrate: 393 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 
1280x720, 367 kb/s, 1.50 fps, 30 tbr, 15360 tbn, 30720 tbc (default)
    Metadata:
      handler_name    : DataHandler
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, 
mono, s16, 512 kb/s (default)
    Metadata:
      handler_name    : DataHandler

Trying ffplay for playback, has same problem as mplayer, so can't blame 
mplayer.

Loading #3 in avidemux shows each I-frame to be every 0.0282 seconds
 > ffmpeg -i 20141107_test3-fails.mov
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20141107_test3-fails.mov':
    encoder         : Lavf56.15.102
  Duration: 00:00:54.00, start: 0.000000, bitrate: 7985 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 
1280x720, 132398 kb/s, 531.60 fps, 30 tbr, 19200 tbn,
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, 
mono, s16, 512 kb/s (default)

531 fps? but this time the duration correctly says 54 seconds. Is there 
a memory leak? The fps and length are appearing more like random than a 
pattern.

So how do I force it to write the output at 30 fps? If I add -r 30 , the 
new console output now does show a change for tbc to 30
 > ffmpeg -f concat -i concat-list3.txt -r 30 -c copy 
20141107_test3-rate30.mov
Output #0, mov, to '20141107_test3-rate30.mov':
  Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 1280x720, 
q=2-31, 7453 kb/s, 30 fps, 15360 tbn, 30 tbc
    Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, mono, 
512 kb/s

but playing the resulting file still has the problem, and using identify 
also shows no effective change.
 > ffmpeg -i 20141107_test3-rate30.mov
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20141107_test3-rate30.mov':
    encoder         : Lavf56.15.102
  Duration: 00:00:54.00, start: 0.000000, bitrate: 7985 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 
1280x720, 131538 kb/s, 528.15 fps, 30 tbr, 15360 tbn,
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, 
mono, s16, 512 kb/s (default)

Now that I've narrowed down the problem further, this looks very similar 
to another problem I started having last month when I started switching 
my scripts over to the new ffmpeg, trying to take advantage of the 
libx264 I now have installed..
I'll have to find the exact file and command line... but in brief 
memory, I was resizing videos, and it would alter the fps from 30 to 60 
fps, so that playback showed each frame twice when I pressed the frame 
advance key. Adding -r 30 solved that problem.

Stewart


More information about the ffmpeg-user mailing list