Opened 6 years ago

Last modified 6 years ago

#7552 new defect

issues with high bitrate AAC in AVI

Reported by: shekh Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: aac AVI
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When encoding AAC to AVI (and then decoding) some timestamps are skipped. Turns out every packet which size is more than 1536 is increasing pts by 2 instead of 1.
I saw somewhere that WaveFormat.nBlockAlign should be bigger than any possible packet, but in fact it is fixed at 1536.
If I tweak nBlockAlign in the binary the AVI is then decoded continuously.

Summary of the bug:
How to reproduce:

ffmpeg.exe -i src1.avi -vcodec copy -acodec aac -b:a 512k 512.avi

ffmpeg version N-92462-g529debc987 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 23.101 / 56. 23.101
  libavcodec     58. 39.100 / 58. 39.100
  libavformat    58. 22.100 / 58. 22.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 44.100 /  7. 44.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'src1.avi':
  Duration: 00:00:05.01, start: 0.000000, bitrate: 3383 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p10le, 124x70, 1837 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
File '512.avi' already exists. Overwrite ? [y/N] Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, avi, to '512.avi':
  Metadata:
    ISFT            : Lavf58.22.100
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p10le, 124x70, q=2-31, 1837 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 512 kb/s
    Metadata:
      encoder         : Lavc58.39.100 aac
frame=   84 fps=0.0 q=-1.0 size=     778kB time=00:00:03.94 bitrate=1614.6kbits/s speed=7.89x    
frame=  120 fps=0.0 q=-1.0 Lsize=    1405kB time=00:00:05.01 bitrate=2295.7kbits/s speed=7.77x    
video:1113kB audio:273kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.330118%
[aac @ 00000000004cb840] Qavg: 60470.855
ffprobe.exe 512.avi -select_streams a:0 -show_packets >512-packets.txt

ffprobe version N-92462-g529debc987 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 23.101 / 56. 23.101
  libavcodec     58. 39.100 / 58. 39.100
  libavformat    58. 22.100 / 58. 22.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 44.100 /  7. 44.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, avi, from '512.avi':
  Metadata:
    encoder         : Lavf58.22.100
  Duration: 00:00:05.05, start: 0.000000, bitrate: 2280 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p10le, 124x70, 1822 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 512 kb/s

Fragment from the produced ffprobe log:

[PACKET]
codec_type=audio
stream_index=1
pts=13
pts_time=0.277333
dts=13
dts_time=0.277333
duration=1
duration_time=0.021333
convergence_duration=N/A
convergence_duration_time=N/A
size=1551
pos=91692
flags=K_
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=15
pts_time=0.320000
dts=15
dts_time=0.320000
duration=1
duration_time=0.021333
convergence_duration=N/A
convergence_duration_time=N/A
size=1535
pos=93252
flags=K_
[/PACKET]
[PACKET]
codec_type=audio
stream_index=1
pts=16
pts_time=0.341333
dts=16
dts_time=0.341333
duration=1
duration_time=0.021333
convergence_duration=N/A
convergence_duration_time=N/A
size=1065
pos=104282
flags=K_
[/PACKET]

Attachments (2)

src1.avi (2.0 MB ) - added by shekh 6 years ago.
512-packets.txt (54.5 KB ) - added by shekh 6 years ago.

Change History (4)

by shekh, 6 years ago

Attachment: src1.avi added

by shekh, 6 years ago

Attachment: 512-packets.txt added

comment:1 by Carl Eugen Hoyos, 6 years ago

Keywords: aac added

How can I reproduce an issue with the output file?

comment:2 by shekh, 6 years ago

How can I reproduce an issue with the output file?

The issue is visible in ffprobe log
pts=13,15,16
where normally it should be 13,14,15

At larger scale it affects seeking so the audio is progressively delayed.

Note: See TracTickets for help on using tickets.