[FFmpeg-trac] #11374(undetermined:new): Deprecated -fflags shortest option may still be useful
FFmpeg
trac at avcodec.org
Thu Dec 26 05:46:48 EET 2024
#11374: Deprecated -fflags shortest option may still be useful
-------------------------------------+-------------------------------------
Reporter: Wallboy | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: concat | Blocked By:
concatenate demuxer shortest |
timestamp dts |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
'''Summary of the bug:'''
I use ffmpeg and the concat demuxer to concatenate multiple mp4 files
together, but was having issues with `"Application provided invalid, non
monotonically increasing dts to muxer"` errors that would occur when the
next file was opened.
I was able to solve this error in almost all cases by pre-processing the
input files by simply doing a streamcopy and specifying `-fflags
+shortest`. I also tried using `-shortest`, but this would still result in
the timestamp errors.
I noticed the warning message that the `-fflags shortest` option is
deprecated and will be removed at some point in the future. I can see the
commit for deprecation here:
https://github.com/FFmpeg/FFmpeg/commit/85e075587dcca5e07c89b5c2f1081d773ce4d997
which seems to imply it's being removed because it was assumed it was
never used practically anywhere, or what bugs it actually solved.
'''How to reproduce:'''
I have provided three sample test files: `test_no_shortest.mp4`,
`test_shortest.mp4`, and `test_mux_shortest.mp4` which were all created
with the following three ffmpeg commands respectively:
{{{
ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 -f lavfi -i
"sine=f=1000:d=10" -af "volume=0:enable=gt(mod(t\,1)\, 0.1)" -c:v libx264
-crf 23 -pix_fmt yuv420p -t 10 test_no_shortest.mp4
ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 -f lavfi -i
"sine=f=1000:d=10" -af "volume=0:enable=gt(mod(t\,1)\, 0.1)" -c:v libx264
-crf 23 -pix_fmt yuv420p -t 10 -shortest test_shortest.mp4
ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 -f lavfi -i
"sine=f=1000:d=10" -af "volume=0:enable=gt(mod(t\,1)\, 0.1)" -c:v libx264
-crf 23 -pix_fmt yuv420p -t 10 -fflags +shortest test_mux_shortest.mp4
}}}
The following ffmpeg command can then be used to reproduce the problem:
{{{
ffmpeg -stream_loop -1 -i ffconcat.txt -c copy -f null -
}}}
where the contents of the ffconcat.txt are simply:
{{{
ffconcat version 1.0
file test_no_shortest.mp4
file test_no_shortest.mp4
}}}
Notice the `Application provided invalid, non monotonically increasing dts
to muxer` errors.
Now simply update the ffconcat.txt file and change each file line to
`test_shortest.mp4` (which used the `-shortest` option) and run the ffmpeg
command again. The errors are still present.
Finally update ffconcat.txt file and change to `test_mux_shortest.mp4`
(which used the `-fflags +shortest` option) and re-run the ffmpeg command.
The errors are gone!
Now I don't know ''why'' `-fflags +shortest` is fixing the issue in this
case, but I have not figured out any other way to not have these errors
without using this format flag on many of my input files.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11374>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list