Opened 14 months ago

Last modified 14 months ago

#10272 new defect

FFMpeg repots error for non-monotonic dts but prints a true assertion.

Reported by: ethanpet113 Owned by:
Priority: normal Component: ffmpeg
Version: 5.1.2 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
I am trying to scan files for anomalies by looking at the output of ffmpeg. Normally I set the verbosity to errors only, but for the benefit of the reader I have included the normal output.

Here is an example of an "error" I am getting:
[null @ 0x7fe0d1708880] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 7776000 >= 7776000

FFMpeg in certain cases will report that dts is non monotonic.
When it does this it will also assert that x>=x.

Since it is indeed true that x>=x it should not be printing this. It should be searching for y>=x but must be looking for y>x.
That or the error message is incorrect and should read x>x. I don't know if this value needs to be strictly monotonic or not, and it seems neither did whoever wrote this step.

$ffmpeg -i file.mov -codec copy -f null -

ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1.2_6 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mov':
  Metadata:
    creation_time   : 2005-04-30T15:05:08.000000Z
  Duration: 00:04:03.01, start: 0.000000, bitrate: 259 kb/s
  Stream #0:0[0x1](eng): Audio: qdm2 (QDM2 / 0x324D4451), 32000 Hz, mono, s16, 32 kb/s (default)
    Metadata:
      creation_time   : 2005-04-30T15:05:08.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : QDes
  Stream #0:1[0x2](eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p(pc), 320x240, 225 kb/s, 29.22 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2005-04-30T15:05:08.000000Z
      handler_name    : Apple Video Media Handler
      vendor_id       : SMI 
      encoder         : Sorenson Video 3
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0(eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p(pc), 320x240, q=2-31, 225 kb/s, 29.22 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2005-04-30T15:05:08.000000Z
      handler_name    : Apple Video Media Handler
      vendor_id       : SMI 
      encoder         : Sorenson Video 3
  Stream #0:1(eng): Audio: qdm2 (QDM2 / 0x324D4451), 32000 Hz, mono, s16, 32 kb/s (default)
    Metadata:
      creation_time   : 2005-04-30T15:05:08.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : QDes
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[null @ 0x7fe0d1708880] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 7776000 >= 7776000
    Last message repeated 7 times
frame= 7102 fps=0.0 q=-1.0 Lsize=N/A time=00:04:03.00 bitrate=N/A speed=1.46e+04x    
video:6700kB audio:954kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

In general playback seems fine as this just occurs at the end of stream for some streams written by weird encoders.

Change History (3)

comment:1 by Balling, 14 months ago

don't know if this value needs to be strictly monotonic

From calculus yes, it must increase at every step. Two same DTS are not allowed. That does not make sense, DTS means decoding timestamp, you cannot decode two frames at the same time, even if it is a superframe you will first decode and access memory of one of the frames, even using SIMD or whatever or Nvidia GPU...

Last edited 14 months ago by Balling (previous) (diff)

comment:2 by ethanpet113, 14 months ago

I would understand if it printed x==x to indicate that that is true and should not be or if it printed prev=x; cur=x-1.

What I think is happening is it is printing x0 >= x1 with the understanding that I as the end user should understand one of those is the frame that came later, and it was out of order, otherwise it wouldn't be reporting an error, and that's a bit confusing but managable. Then I think in the case where x=y it's just more confusing, because it appears that an incorrect comparison has occurred even though it is running correctly.

comment:3 by Balling, 14 months ago

one of those is the frame that came later,

The hex offset in not accounted for when decoding. Only DTS is. This is important.

because it appears that an incorrect comparison has occurred even though it is running correctly.

It is not running correctly. The files that have two same DTS are fully invalid.

Note: See TracTickets for help on using tickets.