Opened 6 months ago

Last modified 5 months ago

#7273 new defect

Exported AAC does not work properly

Reported by: DriverX Owned by:
Priority: important Component: undetermined
Version: unspecified Keywords: aac regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

How to reproduce:

% ffmpeg -i in.flac -acodec aac -b:a 384k out.aac
ffmpeg version 4.0.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.1.1 (GCC) 20180531

If I open 'out.aac' from the beginning (0 seconds), everythings works fine and I can jump at any position with no problem.
But if the player try to start to reproduce it from the middle of the file (2 or 3 minutes) the player hangs and it do not reproduce the file.
I have tested this behavior with smplayer (with mpv) and also with kodi.
If the AAC file is embedded in an mkv with multiple audio tracks I can't switch from an audio track to another one, unless I move back to the start of the file.

Also, the exported file has a wrong channel layout,
if the original file was:
Channel positions: Front: L C R, Side: L R, LFE
the exported one is:
Channel positions: Front: L C R, Side: C, Back: L R
I don't know if this 2 problems are related but it's the only difference that i noticed.

With ffmpeg 3.4.2 everythings works fine, instead with ffmpeg 4.0.1 I have this issue.

Change History (4)

comment:1 follow-up: Changed 6 months ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords aac regression added

This has currently very little similarities with a valid ticket.

Do you want to report a regression since fbf295e2?

comment:2 in reply to: ↑ 1 Changed 6 months ago by DriverX

Replying to cehoyos:

I'm sorry if this is not good.
I just wanted to report a bug and I described it.


Do you want to report a regression since fbf295e2?

I want to report a regression from 3.4.2, I don't know where I can find this 'fbf295e2' code.
I checked the git ID of the commit related to 3.4.2 but it is not 'fbf295e2'.


Please tell me what I can do to improve this ticket
Thank you

comment:3 Changed 6 months ago by cehoyos

If you cannot compile fbf295e2 yourself, please test current FFmpeg git head (nothing else is supported here), provide the command line you tested together with the complete, uncut console output and explain if I can reproduce with ffplay/ffmpeg or only with other players.

comment:4 Changed 5 months ago by DriverX

I compiled and tested this with the current git head.

The output when I convert a file into AAC:

ffmpeg -v debug -i in.flac -acodec aac -b:a 384k out.aac                                                                                                                       :(
ffmpeg version N-91398-gd08d4a8c73 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.1.1 (GCC) 20180531
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 20.104 / 58. 20.104
  libavformat    58. 17.101 / 58. 17.101
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 25.100 /  7. 25.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'in.flac'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '384k'.
Reading option 'out.aac' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url in.flac.
Successfully parsed a group of options.
Opening an input file: in.flac.
[NULL @ 0x55950e7cfb40] Opening 'in.flac' for reading
[file @ 0x55950e7d0640] Setting default whitelist 'file,crypto'
[flac @ 0x55950e7cfb40] Format flac probed with size=2048 and score=100
[flac @ 0x55950e7cfb40] Before avformat_find_stream_info() pos: 86 bytes read:32768 seeks:0 nb_streams:1
[flac @ 0x55950e7cfb40] All info found
[flac @ 0x55950e7cfb40] After avformat_find_stream_info() pos: 54272 bytes read:65536 seeks:0 frames:1
Input #0, flac, from 'in.flac':
  Duration: 00:57:47.26, start: 0.000000, bitrate: 1626 kb/s
    Stream #0:0, 1, 1/48000: Audio: flac, 48000 Hz, 5.1(side), s16
Successfully opened the file.
Parsing a group of options: output url out.aac.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Applying option b:a (video bitrate (please use -b:v)) with argument 384k.
Successfully parsed a group of options.
Opening an output file: out.aac.
[file @ 0x55950e7fb340] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 4 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 4 times
[graph_0_in_0_0 @ 0x55950e8877c0] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 0x55950e8877c0] Setting 'sample_rate' to value '48000'
[graph_0_in_0_0 @ 0x55950e8877c0] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 0x55950e8877c0] Setting 'channel_layout' to value '0x60f'
[graph_0_in_0_0 @ 0x55950e8877c0] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x60f
[format_out_0_0 @ 0x55950e887dc0] Setting 'sample_fmts' to value 'fltp'
[format_out_0_0 @ 0x55950e887dc0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_0 @ 0x55950e887dc0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 0x55950e880800] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x55950e88ab40] [SWR @ 0x55950e88b040] Using s16p internally between filters
[auto_resampler_0 @ 0x55950e88ab40] ch:6 chl:5.1(side) fmt:s16 r:48000Hz -> ch:6 chl:5.1(side) fmt:fltp r:48000Hz
[aac @ 0x55950e7d7b00] Using a PCE to encode channel layout
Output #0, adts, to 'out.aac':
  Metadata:
    encoder         : Lavf58.17.101
    Stream #0:0, 0, 1/48000: Audio: aac (LC), 48000 Hz, 5.1(side), fltp (16 bit), delay 1024, 384 kb/s
    Metadata:
      encoder         : Lavc58.20.104 aac
[NULL @ 0x55950e7d1480] dropping low score -39 frame header from offset 7452 to 15662
[NULL @ 0x55950e7d1480] dropping low score -39 frame header from offset 18664 to 21583
[NULL @ 0x55950e7d1480] dropping low score -39 frame header from offset 2045 to 17809
[NULL @ 0x55950e7d1480] dropping low score -59 frame header from offset 12830 to 18432
[NULL @ 0x55950e7d1480] dropping low score -45 frame header from offset 3096 to 16319
[flac @ 0x55950e7cfb40] first_dts 0 not matching first dts 166391808 (pts 166391808, duration 4096) in the queue
[out_0_0 @ 0x55950e888900] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
size=  163837kB time=00:57:47.26 bitrate= 387.1kbits/s speed=36.3x    
video:0kB audio:162726kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.682780%
Input file #0 (in.flac):
  Input stream #0:0 (audio): 40632 packets read (705031862 bytes); 40632 frames decoded (166428672 samples); 
  Total: 40632 packets (705031862 bytes) demuxed
Output file #0 (out.aac):
  Output stream #0:0 (audio): 162528 frames encoded (166428672 samples); 162529 packets muxed (166631336 bytes); 
  Total: 162529 packets (166631336 bytes) muxed
40632 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x55950e7fb4c0] Statistics: 0 seeks, 640 writeouts
[aac @ 0x55950e7d7b00] Qavg: 232.956
[AVIOContext @ 0x55950e7d8a80] Statistics: 705031948 bytes read, 0 seeks

If I reproduce the file with ffplay, from the beginning it works fine.

Instead if I reproduce the file by specifing -ss in ffplay I get this error and no sound is played:

ffplay -ss 0:2:0.000 out.aac                                                                                                                                                   :(
ffplay version N-91398-gd08d4a8c73 Copyright (c) 2003-2018 the FFmpeg developers
  built with gcc 8.1.1 (GCC) 20180531
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 20.104 / 58. 20.104
  libavformat    58. 17.101 / 58. 17.101
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 25.100 /  7. 25.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[aac @ 0x7f4a0c000b80] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'out.aac':
  Duration: 01:19:13.09, bitrate: 282 kb/s
    Stream #0:0: Audio: aac (LC), 48000 Hz, 6 channels, fltp, 388 kb/s
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated
    Last message repeated 684 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2096 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 1803 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2153 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2125 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2178 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2159 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2091 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2108 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2159 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2167 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2173 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2196 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2189 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2157 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2153 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2152 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2181 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2103 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2105 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2182 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2191 times
[aac @ 0x7f4a0c2528c0] channel element 0.1 is not allocated f=0/0   
    Last message repeated 2233 times

If I convert a 2.0 track instead of a 5.1 there are no issues.

Note: See TracTickets for help on using tickets.