[FFmpeg-trac] #7461(undetermined:new): Application provided invalid, non monotonically increasing dts to muxer

FFmpeg trac at avcodec.org
Mon Oct 1 00:30:37 EEST 2018

#7461: Application provided invalid, non monotonically increasing dts to muxer
             Reporter:  Anuskuss     |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0

Comment (by Anuskuss):

 I somewhat figured out where the problem is but still can't fix it. I
 extracted the packet information with `ffprobe -show_packets` and compared
 the faulty file with the no-arguments reencoded file.

        BAD           GOOD
   pts=105756480  pts=105756480
   dts=105756480  dts=105756480
   duration=2880  duration=2880
   size=1536      size=1536
   pos=56403456   pos=56403456

   pts=105759360  pts=105759360
   dts=105759360  dts=105759360
   duration=2880  duration=2880
 * size=768       size=1536
 * pos=56404992   pos=56404992

   pts=105762240  pts=105762240
   dts=105762240  dts=105762240
   duration=2880  duration=2880
 * size=768       size=1536
 * pos=56405760   pos=56406528

   pts=105765120  pts=105765120
   dts=105765120  dts=105765120
   duration=2880  duration=2880
 * size=768       size=1536
 * pos=56406528   pos=56408064

   pts=105768000  pts=105768000
   dts=105768000  dts=105768000
   duration=2880  duration=2880
 * size=768       size=1536
 * pos=56407296   pos=56409600

   pts=105770880  pts=105770880
   dts=105770880  dts=105770880
   duration=2880  duration=2880
 * size=768       size=1536
 * pos=56408064   pos=56411136

   pts=105773760  pts=105773760
   dts=105773760  dts=105773760
   duration=2880  duration=2880
 * size=768       size=1536
 * pos=56408832   pos=56412672

   pts=105776640  pts=105776640
   dts=105776640  dts=105776640
   duration=2880  duration=2880
   size=1536      size=1536
 * pos=56409600   pos=56414208

 As you can see, all of the sudden the size changes from 1536 to 768 for
 only six samples. Now when I do `-af "atrim=end_pts=105759360"`, the audio
 length goes down to 36:43.328 (2203.328) instead of my previously tested
 19:35.072 (1175.072).

 If I however divide the ''pts'' (105759360) by the ''duration'' (2880) and
 multiply with the ''duration_time'' (0.032) I get 19:35.104 (1175.104).
 This has to be a AC3 property because I have no idea why it cuts at
 36:43.328 when the error is clearly at 19:35.104.

 Unfortunately the problem still persists since the DTS is still messed up.
 This is what I tried so far:
 ffmpeg -i input.ac3 -ab 384k -af
 "atrim=start_pts=105759360:end_pts=105776640" bad.ac3
 # has to be done separately because there's no bitrate filter

 ffmpeg -i input.ac3 -i bad.ac3 -ab 384k -filter_complex
  [P1][B][P2]concat=n=3:v=0:a=1[C]; # works
  [C]atempo=0.95904[F]"             # fails
 -map "[F]" output.ac3

 Is there a way to fix the DTS without reencoding twice?

 ffmpeg -i input.ac3 -loglevel verbose -ab 384k -af "atempo=0.95904"

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

More information about the FFmpeg-trac mailing list