[FFmpeg-user] concat loses 2 frames or freezes up video
S Andreason
sandreas41 at gmail.com
Mon Dec 8 01:20:16 CET 2014
Moritz Barsnick wrote:
> On Sun, Dec 07, 2014 at 14:15:37 -0800, S Andreason wrote:
>
>> Test instructions, sample file names and locations, plus debug output,
>> are uploaded to:
>> http://seahorseCorral.org/videos/tests/ffmpeg-concat-test-instructions.txt
>>
>> Waiting for questions? Thank you.
>>
>
> Please include all your text here, so it hasn't disappeared when
> someone else searches for this problems months from now.
>
> Anyway:
> - I wouldn't touch ffmpeg-0.5 with a 10 foot pole, or trust it as a
> doorstop. Please do your trimming with recent ffmpeg.
> - Please include the full command lines (which you did) and the
> complete, uncut console output. This helps to rule out outdated or
> misconfigured ffmpeg versions, and to see any warnings or errors you
> may have overlooked.
> - Finally, I'm not sure whether or how thew trimming with "-ss 15 -t 9"
> and reassembling works with "-c copy", because of I/P/B frames. That
> said, it shouldn't lead to un-concat-able files.
>
> Thanks,
> Moritz
>
>
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.
All my text. Yes sir. Please trim your replies when replying to emails
containing 1Mb of text.
I could not in good conscious send all 3 files in full debug output by
email. ;-)
From the top, my text file in short says:
The trimmed input files *_t* were created with a stable and proven
script during the years the newest then ffmpeg did not work well for me.
They may have no future relevance, but since almost all my videos in
archive are trimmed, they do provide a test case for whatever bug I'm
reporting in tests #1 and 2.
I'm using this file instead of actual loop-recording 3-minute "3:01
minus 1 sec" files to keep it simple and presentable. Description for
this video: I had the cows all rounded up, but these 4 loose horses came
running down the hill and scattered the herd.
Trimming henceforth will be done with newer ffmpeg like this:
ffmpeg -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. The only difference I could detect from the older
method was the length of the audio stream by a fraction of a second.
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'
> 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'
> 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'
> ffmpeg -f concat -i concat-list3.txt -c copy 20141107_test3-fails.mov
The input files used for these tests, 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. IMHO, 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 today with no change.
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
Debug output for #3 is 913Kb in length before compressing.
Console output for #3 is 262Kb in length, so I'll still have to clip the
repeating lines unless you're serious about All my text.
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, concat, from 'concat-list3.txt':
Duration: N/A, start: 0.000000, bitrate: 7965 kb/s
Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1280x720, 7453 kb/s, 30 fps, 30 tbr, 19200 tbn, 38400 tbc
Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, mono,
s16, 512 kb/s
Output #0, mov, to '20141107_test3-fails.mov':
Metadata:
encoder : Lavf56.15.102
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p, 1280x720,
q=2-31, 7453 kb/s, 30 fps, 19200 tbn, 19200 tbc
Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 32000 Hz, mono,
512 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[concat @ 0x9547a00] DTS 1800 < 56960 out of order
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
56960, current: 1800; changing to 56961. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
56961, current: 1820; changing to 56962. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
56962, current: 1840; changing to 56963. This may result in incorrect
timestamps in the output file.
...clipping 1010 lines...
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
57973, current: 22060; changing to 57974. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
57974, current: 22080; changing to 57975. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
57975, current: 22100; changing to 57976. This may result in incorrect
timestamps in the output file.
frame= 1106 fps=0.0 q=-1.0 size= 37568kB time=00:00:36.00
bitrate=8548.8kbits/s
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
57976, current: 22120; changing to 57977. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
57977, current: 22140; changing to 57978. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
57978, current: 22160; changing to 57979. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
57979, current: 22180; changing to 57980. This may result in incorrect
timestamps in the output file.
...clipping 507 lines...
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
58487, current: 32340; changing to 58488. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
58488, current: 32360; changing to 58489. This may result in incorrect
timestamps in the output file.
[mov @ 0x95522c0] Non-monotonous DTS in output stream 0:0; previous:
58489, current: 32380; changing to 58490. This may result in incorrect
timestamps in the output file.
frame= 1620 fps=0.0 q=-1.0 Lsize= 52637kB time=00:00:54.00
bitrate=7985.2kbits/s
video:49252kB audio:3375kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.018508%
I found One interesting warning, only in the debug version for #3
[mov @ 0x95522c0] timecode: tbc=19200/1 invalid, fallback on 30/1
Stewart
More information about the ffmpeg-user
mailing list