# Subject: concat loses 2 frames or freezes up video # The trimmed input files *_t* were created this way: # The next 4 plus 2 lines are the commands executed by an old (but stable and proven) script to trim movie files mplayer -vc nul -vo nul -ao pcm 20141107_4horses-scatter-cows_mini1355.mov mv audiodump.wav 20141107_4horses-scatter-cows_mini1355_t.wav ffmpeg-0.5 -ss 2 -t 13 -i 20141107_4horses-scatter-cows_mini1355_t.wav -acodec copy 20141107_4horses-scatter-cows_mini1355_t2-13.wav ffmpeg-0.5 -ss 2 -t 13 -i 20141107_4horses-scatter-cows_mini1355.mov -vcodec copy -i 20141107_4horses-scatter-cows_mini1355_t2-13.wav -acodec copy -map 0:0 -map 1:0 20141107_4horses-scatter-cows_mini1355_t2-13.mov ffmpeg-0.5 -ss 15 -t 9 -i 20141107_4horses-scatter-cows_mini1355_t.wav -acodec copy 20141107_4horses-scatter-cows_mini1355_t15-9.wav ffmpeg-0.5 -ss 15 -t 9 -i 20141107_4horses-scatter-cows_mini1355.mov -vcodec copy -i 20141107_4horses-scatter-cows_mini1355_t15-9.wav -acodec copy -map 0:0 -map 1:0 20141107_4horses-scatter-cows_mini1355_t15-9.mov # I'm using the above file(s) instead of actual loop-recording 3-minute "3:01 minus 1 sec" files to keep it simple and presentable. # Description: I had the cows all rounded up, but these 4 loose horses came running down the hill and scattered the herd. # The above trim equivilant one-step with newer ffmpeg ffmpeg-2.4 -i 20141107_4horses-scatter-cows_mini1355.mov -ss 13 -t 3 -c copy 20141107_4horses-scatter-cows_mini1355_c13-3.mov # The resulting trims or clips seem correct in the number of frames and seconds in length. No actual frames missing. # but the audio from ffmpeg-0.5 resulted in length of 13.056 seconds, whereas ffmpeg-2.4 does better with length of 13.000 seconds, in the 13 second example. # Test #1, concat of two trimmed files results in loss of 2 frames at end of first file # Contents of file: concat-list1.txt The following 2 lines. file '20141107_4horses-scatter-cows_mini1355_t2-13.mov' file '20141107_4horses-scatter-cows_mini1355_t15-9.mov' #_EOF ffmpeg -f concat -i concat-list1.txt -c copy 20141107_test1-loses2frames.mov # test 2, concat of one trimmed file and original file results in video freezing up, appears to be a video or audio mis-match # concat-list2.txt file '20141107_4horses-scatter-cows_mini1355_t2-13.mov' file '20141107_4horses-scatter-cows_mini1355.mov' #_EOF ffmpeg -f concat -i concat-list2.txt -c copy 20141107_test2-freezes.mov # test 3, concat of clipped and original results in many errors, wrong time length, and video freezing up interspersed with stopped audio # concat-list3.txt file '20141107_4horses-scatter-cows_mini1355_c13-3.mov' file '20141107_4horses-scatter-cows_mini1355.mov' #_EOF ffmpeg -f concat -i concat-list3.txt -c copy 20141107_test3-fails.mov The input files above, can be found at: http://seahorseCorral.org/videos/tests/20141107_4horses-scatter-cows_mini1355.mov http://seahorseCorral.org/videos/tests/20141107_4horses-scatter-cows_mini1355_t2-13.mov http://seahorseCorral.org/videos/tests/20141107_4horses-scatter-cows_mini1355_t15-9.mov http://seahorseCorral.org/videos/tests/20141107_4horses-scatter-cows_mini1355_c13-3.mov # In depth analysis: # #1. 20141107_test1-loses2frames.mov # notice clock advances 1 second at frame# 30 (of 1-30), and time position advances one frame afterward (frame# 1 or 31,61,91...) # at time 0:14, the joint, now the clock in lower left is advancing one frame afterward. # count only 28 frames from 0:13.0 to 0:13.999 # trying varying time lengths and start positions sometimes results in only 1 frame lost. # #2. 20141107_test2-freezes.mov # plays okay until 0:12.97 when video does not advance to 0:13.00 , audio continues # if press right arrow to advance in time, video starts updating again at 4:21 but at slow frame rate # so I conclude the problem is possibly in reading the time length of the clips when the concat operation is performed. # reaches end at or around 21:11 . If it were being encoded to 1 frame per second, the length should be 27 minutes. Something else then... # #3. 20141107_test3-fails.mov # output has many warnings during ffmpeg command. totals 1620 frames in 54 seconds. correct. # extracting the audio track afterward, is also correct, 54.000 seconds. # playback is okay until 0:02.99 when video continues at an accelerated rate without any audio, and time position stays stuck at 0:02 # after 13 clock seconds, audio starts playback for a couple seconds, then stutters badly with several seconds between audio "bursts" or segments. # on a brighter note, it looks like the clips made with ffmpeg-2.4 and then concat-ed together, are looking good and correct. So tests 1 and 2 look like "compatibility issues" with older files or format packaging, and the #3 is a still current bug. # I tried #1 again with .avi as the output extension. 30 frames. No lost frames. So the problem can localized to .mov I think. # Trying #2 again with avi plus mov for inputs and avi as output... same result, so looks like the .mov file is the common problem. # re-wrapping the original mov into avi and repeating test #2, did not help. So the wrapper is less the issue, and the h264 stream is the problem, I think. # Tests have now been repeated with newest ffmpeg by git pull and re-compile fresh on 2014-12-07 15:00 PST # Output from ffmpeg with -v 9 -loglevel 99 is long, therefore is provided in separate files at: http://seahorseCorral.org/videos/tests/ffmpeg-concat-test1.log.gz http://seahorseCorral.org/videos/tests/ffmpeg-concat-test2.log.gz http://seahorseCorral.org/videos/tests/ffmpeg-concat-test3.log.gz # One interesting warning is only in #3 [mov @ 0x95522c0] timecode: tbc=19200/1 invalid, fallback on 30/1