[FFmpeg-user] Conversion to MP4 fails with non-monotonic DTS error

Tobias Rapp t.rapp at noa-archive.com
Wed Sep 9 12:50:31 EEST 2020


Hello list,

when I try to convert the audio stream of a WMV input file to MP4/AAC an 
error "non-monotonous DTS in output stream" is raised.

FFmpeg command line:
$ ffmpeg -i INPUT_FILE.wmv -f mp4 -map 0:a -codec:a aac -b:a 128k \
    -t 1.0 -y OUTPUT_FILE.mp4 -loglevel +debug -xerror -nostdin -nostats

Console output see attached log file.

Adding "-fflags +igndts" to input or output context does not seem to 
make any difference. When looking at the first few audio packets with 
ffprobe the DTS values seem to be in increasing order:

[PACKET]
codec_type=audio
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=170
duration_time=0.170000
convergence_duration=N/A
convergence_duration_time=N/A
size=1366
pos=93710
flags=K_
[/PACKET]
[PACKET]
codec_type=audio
stream_index=0
pts=128
pts_time=0.128000
dts=128
dts_time=0.128000
duration=170
duration_time=0.170000
convergence_duration=N/A
convergence_duration_time=N/A
size=1366
pos=114110
flags=K_
[/PACKET]
[PACKET]
codec_type=audio
stream_index=0
pts=298
pts_time=0.298000
dts=298
dts_time=0.298000
duration=170
duration_time=0.170000
convergence_duration=N/A
convergence_duration_time=N/A
size=1366
pos=120910
flags=K_
[/PACKET]
[PACKET]
codec_type=audio
stream_index=0
pts=437
pts_time=0.437000
dts=437
dts_time=0.437000
duration=170
duration_time=0.170000
convergence_duration=N/A
convergence_duration_time=N/A
size=1366
pos=134510
flags=K_
[/PACKET]

Is there any CLI option to work-around the DTS issue?

Regards,
Tobias
-------------- next part --------------
ffmpeg version N-99048-g3c7cad6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
  configuration: --disable-network --enable-libsoxr --enable-libtwolame --enable-libmp3lame --enable-libvorbis --enable-libfreetype --enable-static --disable-shared --progs-suffix=-dbg --enable-debug --disable-optimizations --enable-extra-warnings --assert-level=2 --prefix=/usr/local
  libavutil      56. 58.100 / 56. 58.100
  libavcodec     58.105.100 / 58.105.100
  libavformat    58. 54.100 / 58. 54.100
  libavdevice    58. 11.101 / 58. 11.101
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'temp/preview-test01.wmv'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a'.
Reading option '-codec:a' ... matched as option 'codec' (codec name) with argument 'aac'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '128k'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '1.0'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'temp/preview-test01.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '+debug'.
Reading option '-xerror' ... matched as option 'xerror' (exit on error) with argument '1'.
Reading option '-nostdin' ... matched as option 'stdin' (enable or disable interaction on standard input) with argument 0.
Reading option '-nostats' ... matched as option 'stats' (print progress report during encoding) with argument 0.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument +debug.
Applying option xerror (exit on error) with argument 1.
Applying option nostdin (enable or disable interaction on standard input) with argument 0.
Applying option nostats (print progress report during encoding) with argument 0.
Successfully parsed a group of options.
Parsing a group of options: input url temp/preview-test01.wmv.
Successfully parsed a group of options.
Opening an input file: temp/preview-test01.wmv.
[NULL @ 0x480c4c0] Opening 'temp/preview-test01.wmv' for reading
[file @ 0x480cdc0] Setting default whitelist 'file,crypto,data'
[asf @ 0x480c4c0] Format asf probed with size=2048 and score=100
[asf @ 0x480c4c0] gpos mismatch our pos=24, end=26
[asf @ 0x480c4c0] gpos mismatch our pos=24, end=3850
[asf @ 0x480c4c0] Payload extension 50 2
[asf @ 0x480c4c0] gpos mismatch our pos=24, end=38
[asf @ 0x480c4c0] gpos mismatch our pos=24, end=244
[asf @ 0x480c4c0] gpos mismatch our pos=24, end=38
[asf @ 0x480c4c0] Before avformat_find_stream_info() pos: 5310 bytes read:32768 seeks:0 nb_streams:2
[asf @ 0x480c4c0] parser not found for codec wmav2, packets or times may be invalid.
[wmv3 @ 0x480ee40] Header: 4C790A01
[wmv3 @ 0x480ee40] Profile 1:
frmrtq_postproc=6, bitrtq_postproc=7
LoopFilter=1, MultiRes=0, FastUVMC=0, Extended MV=0
Rangered=0, VSTransform=1, Overlap=1, SyncMarker=0
DQuant=0, Quantizer mode=0, Max B-frames=0
[wmv3 @ 0x480ee40] Extra data: 8 bits left, value: 0
[wmv3 @ 0x480ee40] Format yuv420p chosen by get_format().
    Last message repeated 1 times
[asf @ 0x480c4c0] parser not found for codec wmav2, packets or times may be invalid.
[asf @ 0x480c4c0] All info found
[asf @ 0x480c4c0] Setting avg frame rate based on r frame rate
[asf @ 0x480c4c0] After avformat_find_stream_info() pos: 119530 bytes read:131072 seeks:0 frames:43
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from 'temp/preview-test01.wmv':
  Metadata:
    WMFSDKNeeded    : 0.0.0.0000
    DeviceConformanceTemplate: MP at ML
    WMFSDKVersion   : 12.0.7601.17514
    IsVBR           : 0
  Duration: 01:01:49.31, start: 0.000000, bitrate: 547 kb/s
    Stream #0:0(eng), 2, 1/1000: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp, 64 kb/s
    Stream #0:1(eng), 41, 1/1000: Video: wmv3 (Main), 1 reference frame (WMV3 / 0x33564D57), yuv420p(left), 384x288, 0/1, 480 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
Successfully opened the file.
Parsing a group of options: output url temp/preview-test01.mp4.
Applying option f (force format) with argument mp4.
Applying option map (set input stream mapping) with argument 0:a.
Applying option codec:a (codec name) with argument aac.
Applying option b:a (video bitrate (please use -b:v)) with argument 128k.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 1.0.
Successfully parsed a group of options.
Opening an output file: temp/preview-test01.mp4.
[file @ 0x4812200] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (wmav2 (native) -> aac (native))
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    Last message repeated 29 times
detected 4 logical cores
[graph_0_in_0_0 @ 0x480c300] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 0x480c300] Setting 'sample_rate' to value '48000'
[graph_0_in_0_0 @ 0x480c300] Setting 'sample_fmt' to value 'fltp'
[graph_0_in_0_0 @ 0x480c300] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_0 @ 0x480c300] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[format_out_0_0 @ 0x485df80] Setting 'sample_fmts' to value 'fltp'
[format_out_0_0 @ 0x485df80] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 0x483e7c0] query_formats: 5 queried, 12 merged, 0 already done, 0 delayed
Output #0, mp4, to 'temp/preview-test01.mp4':
  Metadata:
    WMFSDKNeeded    : 0.0.0.0000
    DeviceConformanceTemplate: MP at ML
    WMFSDKVersion   : 12.0.7601.17514
    IsVBR           : 0
    encoder         : Lavf58.54.100
    Stream #0:0(eng), 0, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s
    Metadata:
      encoder         : Lavc58.105.100 aac
[aac @ 0x4811480] Queue input is backward in time
[mp4 @ 0x480ffc0] Non-monotonous DTS in output stream 0:0; previous: 7168, current: 6144; aborting.
[AVIOContext @ 0x4812040] Statistics: 0 seeks, 2 writeouts
[aac @ 0x4811480] Qavg: 34174.484
[aac @ 0x4811480] 2 frames left in the queue on closing
[AVIOContext @ 0x48150c0] Statistics: 131072 bytes read, 0 seeks
Conversion failed!


More information about the ffmpeg-user mailing list