Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6437 closed defect (fixed)

AAC(ADTS) "manipulation" complain on files having ID3Tag

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

Description

Summary of the bug:
While using "-bsf:a aac_adtstoasc" filter on ADTS files having ID3Tag, the following message is displayed in red:
Error parsing ADTS frame header''
Error applying bitstream filters to an output packet for stream #0:0.
But the output file is working fine.

How to reproduce:
% ffmpeg -y -i Always_v4.aac -c:a copy -bsf:a aac_adtstoasc aac_bsf.m4a

ffmpeg version N-85719-g85452f9ab7 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-avisynth --enable-fontconfig --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-opengl --disable-outdev=sdl2 --enable-w32threads --disable-dxva2 --disable-debug --pkg-config-flags=--static --extra-ldflags=-static --extra-cflags='-mtune=generic -mfpmath=sse -msse' --cpu=i686 --optflags='-O2 -finline-functions'
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 87.100 /  6. 87.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument 'Always_v4.aac'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-bsf:a' ... matched as option 'bsf' (A comma-separated list of bitstream filters) with argument 'aac_adtstoasc'.
Reading option 'aac.m4a' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url Always_v4.aac.
Successfully parsed a group of options.
Opening an input file: Always_v4.aac.
[file @ 07881a80] Setting default whitelist 'file,crypto'
[aac @ 078810e0] Format aac probed with size=2048 and score=51
id3v2 ver:4 flags:00 len:1025
[aac @ 078810e0] Discarding ID3 tags because more suitable tags were found.
[aac @ 078810e0] Before avformat_find_stream_info() pos: 1035 bytes read:32896 seeks:2 nb_streams:1
[aac @ 078810e0] All info found
[aac @ 078810e0] Estimating duration from bitrate, this may be inaccurate
[aac @ 078810e0] After avformat_find_stream_info() pos: 21515 bytes read:65664 seeks:2 frames:50
Input #0, aac, from 'Always_v4.aac':
  Metadata:
    title           : Always
    artist          : Bon Jovi
    genre           : Blues
  Duration: 00:06:18.41, bitrate: 143 kb/s
    Stream #0:0, 50, 1/28224000: Audio: aac (LC), 44100 Hz, stereo, fltp, 142 kb/s
Successfully opened the file.
Parsing a group of options: output url aac.m4a.
Applying option c:a (codec name) with argument copy.
Applying option bsf:a (A comma-separated list of bitstream filters) with argument aac_adtstoasc.
Successfully parsed a group of options.
Opening an output file: aac.m4a.
[file @ 0788a440] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, ipod, to 'aac.m4a':
  Metadata:
    title           : Always
    artist          : Bon Jovi
    genre           : Blues
    encoder         : Lavf57.72.101
    Stream #0:0, 0, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 142 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
size=    5492kB time=297.31 bitrate= 151.3kbits/s speed= 595x    
[AVBSFContext @ 0788a0a0] Error parsing ADTS frame header!
Error applying bitstream filters to an output packet for stream #0:0.
No more output streams to write to, finishing.
size=    6561kB time=353.73 bitrate= 151.9kbits/s speed= 579x    
video:0kB audio:6500kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.929404%
Input file #0 (Always_v4.aac):
  Input stream #0:0 (audio): 15236 packets read (6763188 bytes); 
  Total: 15236 packets (6763188 bytes) demuxed
Output file #0 (aac.m4a):
  Output stream #0:0 (audio): 15235 packets muxed (6656415 bytes); 
  Total: 15235 packets (6656415 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0788a180] Statistics: 30 seeks, 15259 writeouts
[AVIOContext @ 07889c40] Statistics: 6796084 bytes read, 2 seeks

Attachments (2)

Always_v4_cut.aac (2.4 MB ) - added by Samuel 8 years ago.
ADTS(AAC)_BSF_ID3Tag
id3v2_id3v1.aac (17.8 KB ) - added by James 8 years ago.
Raw ADTS with ID3v2 and ID3v1

Change History (10)

by Samuel, 8 years ago

Attachment: Always_v4_cut.aac added

ADTS(AAC)_BSF_ID3Tag

comment:1 by Samuel, 8 years ago

Keywords: AAC ADTS added

All references to -bsf:a aac_adtstoasc filter should be withdrawed.
Sorry, i don't know how to do that, if that even possible for me ?

Because, i just see that using that command line give me the same warning message:
% ffmpeg -y -i Always_v4.aac -map_metadata -1 -c:a copy aac.m4a

Last edited 8 years ago by Samuel (previous) (diff)

comment:2 by Samuel, 8 years ago

Keywords: aac_adtstoasc removed
Summary: -bsf:a aac_adtstoasc filter seem to complain on files having ID3TagAAC(ADTS) "manipulation" complain on files having ID3Tag

comment:3 by James, 8 years ago

You're using an old ffmpeg build. Can you try again with the latest git revision? I'm not able to reproduce what you described above.

comment:4 by Samuel, 8 years ago

ffmpeg started on 2017-06-02 at 19:44:14
Report written to "ffmpeg-20170602-194414.log"
Command line:
ffmpeg -v 9 -loglevel 99 -report -i Always_v4.aac -map_metadata -1 -c:a copy aac.m4a
ffmpeg version N-85719-g85452f9ab7 Copyright (c) 2000-2017 the FFmpeg developers

built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-avisynth --enable-fontconfig --enable-gnutls --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-opengl --disable-outdev=sdl2 --enable-w32threads --disable-dxva2 --disable-debug --pkg-config-flags=--static --extra-ldflags=-static --extra-cflags='-mtune=generic -mfpmath=sse -msse' --cpu=i686 --optflags='-O2 -finline-functions'
libavutil 55. 61.100 / 55. 61.100
libavcodec 57. 93.100 / 57. 93.100
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 87.100 / 6. 87.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100

Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument 'Always_v4.aac'.
Reading option '-map_metadata' ... matched as option 'map_metadata' (set metadata information of outfile from infile) with argument '-1'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'aac.m4a' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url Always_v4.aac.
Successfully parsed a group of options.
Opening an input file: Always_v4.aac.
[file @ 07881a80] Setting default whitelist 'file,crypto'
[aac @ 078810e0] Format aac probed with size=2048 and score=51
id3v2 ver:4 flags:00 len:1025
[aac @ 078810e0] Discarding ID3 tags because more suitable tags were found.
[aac @ 078810e0] Before avformat_find_stream_info() pos: 1035 bytes read:32896 seeks:2 nb_streams:1
[aac @ 078810e0] All info found
[aac @ 078810e0] Estimating duration from bitrate, this may be inaccurate
[aac @ 078810e0] After avformat_find_stream_info() pos: 21515 bytes read:65664 seeks:2 frames:50
Input #0, aac, from 'Always_v4.aac':

Metadata:

title : Always
artist : Bon Jovi
genre : Blues

Duration: 00:06:18.41, bitrate: 143 kb/s

Stream #0:0, 50, 1/28224000: Audio: aac (LC), 44100 Hz, stereo, fltp, 142 kb/s

Successfully opened the file.
Parsing a group of options: output url aac.m4a.
Applying option map_metadata (set metadata information of outfile from infile) with argument -1.
Applying option c:a (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: aac.m4a.
[file @ 0788a440] Setting default whitelist 'file,crypto'
Successfully opened the file.
Output #0, ipod, to 'aac.m4a':

Metadata:

encoder : Lavf57.72.101
Stream #0:0, 0, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 142 kb/s

Stream mapping:

Stream #0:0 -> #0:0 (copy)

Press [q] to stop, ? for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Automatically inserted bitstream filter 'aac_adtstoasc'; args=
size= 5460kB time=295.54 bitrate= 151.3kbits/s speed= 591x
[AVBSFContext @ 0788a080] Error parsing ADTS frame header!
[AVBSFContext @ 0788a080] Failed to send packet to filter aac_adtstoasc for stream 0
av_interleaved_write_frame(): Invalid data found when processing input
No more output streams to write to, finishing.
size= 6561kB time=353.73 bitrate= 151.9kbits/s speed= 577x
video:0kB audio:6605kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (Always_v4.aac):

Input stream #0:0 (audio): 15236 packets read (6763188 bytes);
Total: 15236 packets (6763188 bytes) demuxed

Output file #0 (aac.m4a):

Output stream #0:0 (audio): 15236 packets muxed (6763188 bytes);
Total: 15236 packets (6763188 bytes) muxed

0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0788a160] Statistics: 30 seeks, 15259 writeouts
[AVIOContext @ 07889c40] Statistics: 6796084 bytes read, 2 seeks
Conversion failed!

Perhaps because i needed to trunk the file to post it here, and it don't give anymore the same result ?
Here the original file (6.5MB)
https://we.tl/S2xnVHyBmL

I'll try with the latest FFmpeg one later. That's said i'll be happy if that not present in the lastest version ;)
Thank you for having taking the time to try :)

comment:5 by Samuel, 8 years ago

You was right, cutting the file with DD did alterate the file: the ID3Tag v1 is not indicated anymore, only v2.
And so, this issue do not appear with the attached truncated sample.

Sorry for not having make sure that this issue was reproductible with the cutted sample, but the link of the full file is only valid for a week so i thought that it was better :(

Last edited 8 years ago by Samuel (previous) (diff)

by James, 8 years ago

Attachment: id3v2_id3v1.aac added

Raw ADTS with ID3v2 and ID3v1

comment:6 by James, 8 years ago

Component: avfilteravformat
Keywords: aac id3 added; ID3Tag AAC ADTS removed
Reproduced by developer: set
Status: newopen

The demuxer sends the id3v1 tag at the end of the file as a data packet to the bitstream filter or decoder.

A proper read_packet() function may be needed instead of using the generic raw one.

comment:7 by James, 8 years ago

Resolution: fixed
Status: openclosed

Fixed in 3d4026325381c1066d771bcb83e024c92ea7e189.

Thanks for reporting this!

comment:8 by Samuel, 8 years ago

Thank you to you for having fixed it :+1:

Note: See TracTickets for help on using tickets.