PDA

View Full Version : ffmpeg ADTS muxing problem


roozhou
9th May 2009, 10:55
I would like to use ffmpeg to mux video + audio to any container format i need but I found it having problem reading adts .aac files.

I use the following command line
ffmpeg -i xxx.aac -acodec copy xxx.mp4

The resulting mp4 is unplayable(except in mplayer). Mediainfo shows the mp4 has 128 channels and 7350Hz samplerate while my source is stereo @48kHz. I also tried mka and it gave me the same result (128 channels @7350Hz).

Then I tried first muxing aac to mp4 using mp4box and later muxing video + mp4 with ffmpeg. This time ffmpeg worked fine.

It seems ffmpeg has problem reading adts file. Is there any way to fix this?

Shapierian
11th May 2009, 21:45
Use this patch for now:

http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-May/069399.html

roozhou
12th May 2009, 04:23
Thanks for your patch. But this does not solve everything.
I spent last weekend investigating this issue, and found that there were 3 problems in ffmpeg:

1) ADTS header not removed
2) Incorrect pts for each frame, caused by accumulated error
3) Missing extra data (AAC audio config object?)

IMO 1 Should be fixed by removing ADTS header in muxers and 2 3 should be fixed by setting correct time base and adding extra data in ADTS reader.

Adding a bsf is not a good way because people have no idea when to use it. I knew ffmpeg-devels would recommend writing an bsf so I did not ask help from ffmpeg-devel mailing list(I guess it will take them years to fix it).

I have already fixed mp4/mkv muxers, and is trying to fix rm muxer. I will post my patch when I get home.