Opened 7 years ago

Last modified 18 months ago

#5448 open defect

aac: wrong calculation of duration

Reported by: ami_stuff Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: aac regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

it used to be correct long time ago:

C:\>ffmpeg -i 1.aac
ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 21 2014 18:55:26 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[aac @ 02a7a980] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from '1.aac':
  Duration: 00:00:29.58, bitrate: 73 kb/s
    Stream #0:0: Audio: aac, 88200 Hz, mono, fltp, 73 kb/s
At least one output file must be specified
C:\>ffmpeg -i 1.aac out.wav
ffmpeg version N-79468-ga676c29 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.5.0 (GCC) 20100414 (Fedora MinGW 4.5.0-1.fc14)
  configuration: --prefix=/var/www/users/research/ffmpeg/snapshots/build --arch=
x86 --target-os=mingw32 --cross-prefix=i686-pc-mingw32- --cc='ccache i686-pc-min
gw32-gcc' --enable-pthreads --enable-memalign-hack --enable-runtime-cpudetect --
enable-cross-compile --enable-static --disable-shared --extra-libs='-lws2_32 -lw
inmm -lpthread' --extra-cflags='--static -I/var/www/users/research/ffmpeg/snapsh
ots/build/include' --extra-ldflags='-static -L/var/www/users/research/ffmpeg/sna
pshots/build/lib' --enable-bzlib --enable-zlib --enable-gpl --enable-version3 --
enable-nonfree --enable-libx264 --enable-libspeex --enable-libtheora --enable-li
bvorbis --enable-libfaac --enable-libxvid --enable-libopencore-amrnb --enable-li
bopencore-amrwb --enable-libmp3lame --enable-libfreetype --enable-libvpx --disab
le-decoder=libvpx
  libavutil      55. 22.100 / 55. 22.100
  libavcodec     57. 34.102 / 57. 34.102
  libavformat    57. 34.101 / 57. 34.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 42.100 /  6. 42.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[aac @ 0x2894160] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from '1.aac':
  Duration: 00:04:47.72, bitrate: 7 kb/s
    Stream #0:0: Audio: aac (LC), 88200 Hz, mono, fltp, 7 kb/s
File 'out.wav' already exists. Overwrite ? [y/N] y
[wav @ 0x2897420] Using AVStream.codec to pass codec parameters to muxers is dep
recated, use AVStream.codecpar instead.
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf57.34.101
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 88200 Hz, mono, s16,
1411 kb/s
    Metadata:
      encoder         : Lavc57.34.102 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 0; changing to 88057. This may result in incorrect timestamps in the output
 file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 1024; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 2048; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 3072; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 4096; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 5120; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 6144; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 7168; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 8192; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 9216; changing to 88057. This may result in incorrect timestamps in the out
put file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 10240; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 11264; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 12288; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 13312; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 14336; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 15360; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 16384; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 17408; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 18432; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 19456; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 20480; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 21504; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 22528; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 23552; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 24576; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 25600; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 26624; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 27648; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 28672; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 29696; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 30720; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 31744; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 32768; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 33792; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 34816; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 35840; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 36864; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 37888; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 38912; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 39936; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 40960; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 41984; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 43008; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 44032; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 45056; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 46080; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 47104; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 48128; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 49152; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 50176; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 51200; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 52224; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 53248; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 54272; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 55296; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 56320; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 57344; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 58368; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 59392; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 60416; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 61440; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 62464; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 63488; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 64512; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 65536; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 66560; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 67584; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 68608; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 69632; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 70656; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 71680; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 72704; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 73728; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 74752; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 75776; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 76800; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 77824; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 78848; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 79872; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 80896; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 81920; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 82944; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 83968; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 84992; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 86016; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
[wav @ 0x2897420] Non-monotonous DTS in output stream 0:0; previous: 88057, curr
ent: 87040; changing to 88057. This may result in incorrect timestamps in the ou
tput file.
size=    5188kB time=00:00:29.10 bitrate=1460.2kbits/s speed= 133x
video:0kB audio:5188kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 0.001920%

Attachments (1)

1.aac (266.2 KB ) - added by ami_stuff 7 years ago.

Download all attachments as: .zip

Change History (4)

by ami_stuff, 7 years ago

Attachment: 1.aac added

comment:1 by Carl Eugen Hoyos, 7 years ago

Component: undeterminedavformat
Keywords: aac regression added
Priority: normalminor
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

Regression since 215db293 / b263f8ff

comment:2 by Balling, 19 months ago

Okay, couple of points here: there is some priming and remainder and yet we cannot say how much due to it being bare aac (.adts).

Also it now regressed further and prints

Duration: 00:04:38.71, bitrate: 7 kb/s

The correct actual duration (with priming and remainder) is 30 s 116 ms (that is written in editlist after reencoding Media time: 1024, Track duration: 30116).

Non-monotonous DTS in output stream does not happen.

Reencoding does not help so bug is ours.

May be a problem due to 1/28224000 timebase.

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

comment:3 by Jozef Chutka, 18 months ago

Hi everyone, considering this error exists for 6 years, is there any recent work ongoing? Or should be aac format in ffmpeg considered unstable?

Seems I hit a similar issue reported on https://trac.ffmpeg.org/ticket/9708 . I wonder if there is any workaround?

Note: See TracTickets for help on using tickets.