[FFmpeg-trac] #9211(undetermined:new): MPEG2 decoder timebase resets cause FFmpeg to lock up during concat or the output video to stutter

FFmpeg trac at avcodec.org
Mon May 3 02:24:22 EEST 2021


#9211: MPEG2 decoder timebase resets cause FFmpeg to lock up during concat or the
output video to stutter
-------------------------------------+-------------------------------------
             Reporter:  nab622       |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Description changed by nab622:

Old description:

> I believe this is the same thing that is reported here:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2018-March/226706.html
>
> In many MPEG2 (DVD) videos, the timebase resets during playback. FFmpeg
> gets confused by this, and behaves unpredictably. Most notably, during a
> "-i concat:VTS_01_1.VOB|VTS_01_2.VOB|VTS_01_3.VOB" operation, some videos
> will cause FFmpeg to get stuck in an infinite loop, generating thousands
> of "NON-MONOTONOUS DTS" and "Buffer underflow" messages per second.
>
> If I instead chunk the video up so the timebase resets are separate
> inputs (Using dvd2concat), FFmpeg will work, but the output video will
> stutter at every join between the inputs, sometimes for several seconds,
> which is unacceptable.
>
> I have tried -fflags +genpts, but it did not fix the problem.
>
> Is there any way arbitrary timebase resets can be properly handled? It
> seems to be part of the MPEG2 standard, and the link at the top of this
> issue has code attached that claims to handle it. Even if it can just be
> added as an optional switch, that would mean the world to anyone
> processing DVD videos.

New description:

 I believe this is the same thing that is reported here:
 https://ffmpeg.org/pipermail/ffmpeg-devel/2018-March/226706.html

 In many MPEG2 (DVD) videos, the timebase resets during playback. FFmpeg
 gets confused by this, and behaves unpredictably. Most notably, during a
 "-i concat:VTS_01_1.VOB|VTS_01_2.VOB|VTS_01_3.VOB" operation, some videos
 will cause FFmpeg to get stuck in an infinite loop, generating thousands
 of "NON-MONOTONOUS DTS" and "Buffer underflow" messages per second.

 If I instead chunk the video up so the timebase resets are separate inputs
 (Using dvd2concat), FFmpeg will work, but the output video will stutter at
 every join between the inputs, sometimes for several seconds, which is
 unacceptable.

 I have tried -fflags +genpts, but it did not fix the problem.

 Is there any way arbitrary timebase resets can be properly handled? It
 seems to be part of the MPEG2 standard, and the link at the top of this
 issue has code attached that claims to handle it. Even if it can just be
 added as an optional switch, that would mean the world to anyone
 processing DVD videos.


 EDIT:
 I cannot publicly provide the source video, since I am testing this on
 commercial DVDs. However, I can provide the FFmpeg commands, the concat
 scripts, and a screen recorded video showing the problem. If you do need a
 video to test with, please message me privately or email me.

 Screen recorded video showing the problem, start to finish:
 https://www.youtube.com/watch?v=H8qFeB-NtHY

 FFmpeg logs, commands, and concat files:
 https://box.dogi.us/s/nazdxGZqkqPQiw8

 FFmpeg command for pass 1 in the video (Introduced stuttering at every
 chapter break):
 ffmpeg -y -ignore_unknown -protocol_whitelist subfile,file,concat -f
 concat -safe 0 -v 9 -loglevel 99 -i '/home/public/Desktop/Nextgen/Title
 1.concat' -map 0 -c copy -f dvd
 '/home/public/Desktop/Nextgen/Test_oldConcat.vob'

 FFmpeg command for pass 2 in the video (FFmpeg stuck in infinite loop,
 operation never completed):
 ffmpeg -y -ignore_unknown -protocol_whitelist subfile,file,concat -f
 concat -safe 0 -v 9 -loglevel 99 -i '/home/public/Desktop/Nextgen/Title
 1.concat_new' -map 0 -c copy -f dvd
 '/home/public/Desktop/Nextgen/Test_newConcat.vob'

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9211#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list