[FFmpeg-user] Trouble Concatenating Video: "Application provided invalid, non monotonically increasing dts"
ianm at brick.net
ianm at brick.net
Thu Apr 5 17:36:26 CEST 2012
I would like to join video clips. I'm using the latest
Zeranoe 64-bit build on Windows 7. I was able to hammer
something out for successive .MTS clips (H.264 video, AC-3
audio, in an MPEG-TS container) generated by an AVCHD
camera, like so:
1) Transcode all clips to an identifical, approved format
and identical codecs, with the same display size and
whatnot: MPEG-1
2) Binary concatenation of all of the files into one file,
concatenated.mpg
3) Reel out the streams in concatenated.mpg into a new
container
Having read the FAQ
(http://ffmpeg.org/faq.html#How-can-I-join-video-files_003f),
I picked MPEG-1 for transcoding (Thanks, Carl, for letting
me know that the container MPEG-1 System Format is the
same as the container format MPEG-2 Program Stream, I was
very confused) using the following command:
1) ffmpeg -i clip1.mts -y -fmpeg -codec:v mpeg1video -b:v
4000k -minrate 4000k -maxrate 4000k -bufsize 1835k -r 20
-s hd720 -aspect 16:9 -pix_fmt yuv420p -filter:v yadif
-codec:a mp2 -b:a 256k -ar 32000 -ac 2 clip1.mpg
These look great. Upon joining the resulting MPEG-1 files
with:
2) copy /y /b clip1.mpg+clip2.mpg+clip3.mpg
concatenated.mpg
the file appears to play in Windows Media Player but the
duration is too short (about twenty-seven minutes), only
half as long as it needs to be (fifty-five minutes).
Windows Explorer says the same, as does RealProducer 14.
FFProbe gives a duration of only nine minutes and change,
with an unrealistically high bandwidth. I decided to
"smooth out" the files with:
3) ffmpeg -i concatenated.mpg -f mpeg -codec:v copy
-codec:a copy -y fixed.mpg
The resulting fixed.mpg gives the correct duration in
Windows Media Player, ffprobe, RealProducer 14, and
whatnot. The video processes as expected. Good so far!
WHERE IT ALL GOES WRONG: If I try this process on wildly
disparate clips from different sources, in different
formats, etc. (such as wanting to add in a default
copyright notice), upon the final step "ffmpeg -i
concatenated.mpg -f mpeg -codec:v copy -codec:a copy -y
fixed.mpg" I get ...
ffmpeg version N-39267-g4082198 Copyright (c) 2000-2012
the FFmpeg developers
built on Mar 25 2012 20:30:15 with gcc 4.6.2
configuration: --disable-static --enable-shared
--enable-gpl --enable-version3 --disable-w32threads
--enable-runtime-cpudetect --enable-avisynth
--enable-bzlib --enable-frei0r --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libfreetype
--enable-libgsm --enable-libmp3lame --enable-libopenjpeg
--enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libxavs --enable-libxvid
--enable-zlib
libavutil 51. 44.100 / 51. 44.100
libavcodec 54. 12.100 / 54. 12.100
libavformat 54. 3.100 / 54. 3.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 65.102 / 2. 65.102
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 10.100 / 0. 10.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 000000000050F3D0] max_analyze_duration 5000000
reached at 5004000
Input #0, mpeg, from
'L:\data\pipeline\intermediate\concatenated.mpg':
Duration: 00:00:10.02, start: 0.985278, bitrate: 8688
kb/s
Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 4000 kb/s, 23.98 fps, 23.98
tbr, 90k tbn, 23.98 tbc
Stream #0:1[0x1c0]: Audio: mp2, 32000 Hz, 2 channels,
s16, 256 kb/s
Output #0, mpeg, to
'L:\data\pipeline\intermediate\fixed.mpg':
Metadata:
encoder : Lavf54.3.100
Stream #0:0: Video: mpeg1video, yuv420p, 1280x720
[SAR 1:1 DAR 16:9], q=2-31, 4000 kb/s, 23.98 fps, 90k tbn,
23.98 tbc
Stream #0:1: Audio: mp2, 32000 Hz, 2 channels, 256
kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpeg @ 00000000006AAA90] Application provided invalid,
non monotonically increasing dts to muxer in stream 1:
900720 >= 900720
av_interleaved_write_frame(): Invalid argument
How do I get around this? I thought the three-step
process was the way to go, but evidently there are
timestamp issues.
Thanks!
More information about the ffmpeg-user
mailing list