[Libav-user] Remuxing from AAC to MP4, bitstream filtering and corrupted AAC Config

Stefano Sabatini stefasab at gmail.com
Wed Jul 3 19:10:35 CEST 2013


In data Wednesday 2013-07-03 09:52:45 +0200, Stefano Sabatini ha scritto:
> Hi all,
> 
> posting here in case someone can provide ideas.
> 
> With the attached code I'm able to stream-copy and remux an AAC file
> to an MP4.
> 
> $ remuxing in.AAC out.mp4
> 
> $ mp4info version 2.0.0
> out.mp4:
> FindBytesProperty: no such property moov.trak[0].mdia.minf.stbl.stsd.*[0].*.esds.decConfigDescr.decSpecificInfo[0].info (src/mp4file.cpp,865)
> Track	Type	Info
> 1	audio	MPEG-4 Unknown Profile(0), 38.150 secs, 149 kbps, 44100 Hz
>  Encoded with: Lavf55.10.101
> 
> $ MP4Box -info out.mp4 
> * Movie Info *
> 	Timescale 1000 - Duration 00:00:38.151
> 	1 track(s)
> 	Fragmented File: no
> 	File Brand isom - version 512
> 	Created: UNKNOWN DATE
> File has no MPEG4 IOD/OD
> 
> iTunes Info:
> 	Encoder Software: Lavf55.10.101
> 
> Track # 1 Info - TrackID 1 - TimeScale 44100 - Media Duration 00:00:38.150
> Track has 1 edit lists: track duration is 00:00:38.151
> Media Info: Language "Undetermined" - Type "soun:mp4a" - 1643 samples
> MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
> Corrupted AAC Config
> Self-synchronized
> Alternate Group ID 1
> 
> ...
> 
> If I convert the file with the command:
> $ ffmpeg -i in.aac -c copy -bsf:a aac_adtstoasc -y out2.mp4
> 
> $ mp4info out2.mp4 
> mp4info version 2.0.0
> out2.mp4:
> Track	Type	Info
> 1	audio	MPEG-4 AAC LC, 38.150 secs, 149 kbps, 44100 Hz
>  Encoded with: Lavf55.10.101
> 
> $ MP4Box -info out2.mp4
> * Movie Info *
> 	Timescale 1000 - Duration 00:00:38.151
> 	1 track(s)
> 	Fragmented File: no
> 	File Brand isom - version 512
> 	Created: UNKNOWN DATE
> File has no MPEG4 IOD/OD
> 
> iTunes Info:
> 	Encoder Software: Lavf55.10.101
> 
> Track # 1 Info - TrackID 1 - TimeScale 44100 - Media Duration 00:00:38.150
> Track has 1 edit lists: track duration is 00:00:38.151
> Media Info: Language "Undetermined" - Type "soun:mp4a" - 1643 samples
> MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
> MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 44100
> Self-synchronized
> Alternate Group ID 1
> 
> ...
> 
> So the problem seems related to the missing profile information.
> 
> Help with the issue is very welcome. I plan to send the example for
> inclusion once I spot the problem.

And the problem is:

[...]
>                 ret = av_bitstream_filter_filter(absf_ctx, in_audio_stream->codec, NULL,
>                                                  &new_inpkt.data, &new_inpkt.size,
>                                                  inpkt.data, inpkt.size,
>                                                  inpkt.flags & AV_PKT_FLAG_KEY);

I need to change in_audio_stream to out_audio_stream, since the
bitstream filter changes the *output stream* extradata, that is
written in the packet.

Changing this single line fixes the issue.


More information about the Libav-user mailing list