[FFmpeg-user] encode results with incorrect duration & start values
deanlewis at fastmail.com
Wed Sep 16 17:33:29 CEST 2015
FFmpeg version 2.7.2 (09.08.2015)
OS X 10.10.5 (14F27)
Mac Pro (Late 2013)
We have 6 videos from FCP, exported as ProRes files, that need to be concatenated.
Step one was to first encode each of the videos into H.264:
[code]/Users/robodean/Desktop/ffmpeg/ffmpeg -i ch01b_t-m-pack.mov -map 0:0 -map 0:1 -c:a aac -cutoff 15000 -ab 320k -strict -2 -async 1 -c:v libx264 -crf 20 -r 23.98 -s 960x540 -aspect 16:9 -pix_fmt yuv420p -profile:v high -partitions partb8x8+partp4x4+partp8x8+parti8x8 -b-pyramid 1 -weightb 1 -8x8dct 1 -fast-pskip 1 -coder ac -trellis 1 -me_method hex -flags +loop -sws_flags fast_bilinear -direct-pred 1 -sc_threshold 40 -qmin 3 -qmax 51 -qdiff 4 -threads 12 -sn -y ch01b_t-m-pack.mp4
But when we concatenated the files using ffmpeg and compared it to a reference concatenation exported from FCP, we found that there were numerous "offsets" in the in points of the videos in the final output.
Curious, I decided to try re-encoding all the ProRes files using Apple Compressor.
And this time, when I used ffmpeg to concatenate these new videos from Compressor, the resulting concatenation was perfect.
In other words, when concatenating a series of video encoded with ffmpeg the result has offsets and an incorrect overall duration. But when performing the same concatenation with videos encoded by Apple Compressor the results were perfect.
The dilemma is that we find the visual results of ffmpeg h.264 encoding vastly superior and have no desire to use Apple Compressor.
I decided then to see how the encoded files were different; clearly the error is being caused by the videos as they are being fed into the concatenation and not the concatenation itself.
So I probed the resulting H.264 videos from Compressor and ffmpeg and discovered this:
From the original ProRes video:
[code] Duration: 00:00:41.00, start: 0.000000, bitrate: 130238 kb/s
Stream #0:0(und), 1, 1/24000: Video: prores (ap4h / 0x68347061), yuva444p10le(bt709), 1280x720, 127850 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
From the Apple Compressor encoded video:
[code] timecode : 00:00:00:00
Duration: 00:00:41.00, start: 0.000000, bitrate: 1100 kb/s
Stream #0:0(eng), 1, 1/24000: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 960x540, 967 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
From the ffmpeg encoded video
[code]Duration: 00:00:41.02, start: 0.021333, bitrate: 953 kb/s
Stream #0:0(und), 2, 1/11988: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 627 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 47.95 tbc (default)
From this it would appear that each of the videos encoded by ffmpeg had the wrong duration and start values, which resulted in the offsets in the final concatenated video. All the videos encoded by Apple Compressor resulted in same duration and start times as the original ProRes files and therefore concatenated correctly.
Looking for any help on how to correctly encode with ffmpeg so that the resulting files match perfectly to the originals in terms of duration, start and framerate.
More information about the ffmpeg-user