Opened 5 years ago

Closed 5 years ago

#7568 closed defect (worksforme)

Incorrect AAC file output

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

Description

Summary of the bug:

I have MP4 file with AAC audio stream:

Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1133 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 104 kb/s (default)

Audio stream is correct, but when I try to extract it from file by FFMPEG it produces incorrect audio file with these parameters:

Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 4 kb/s

How to reproduce:

% ffmpeg -i MP4WithAACAudio.mp4 output.aac
ffmpeg version 4.1
built on 2018-10-17

Attachments (1)

MP4WithAACAudio.mp4 (2.1 MB ) - added by Grabien 5 years ago.
MP4 with AAC audio example

Change History (7)

by Grabien, 5 years ago

Attachment: MP4WithAACAudio.mp4 added

MP4 with AAC audio example

comment:1 by Carl Eugen Hoyos, 5 years ago

Resolution: worksforme
Status: newclosed

Output file plays fine here.

comment:2 by Grabien, 5 years ago

Resolution: worksforme
Status: closedreopened

Yes, output file can be played, but it is incorrect:

  • bitrate of output file is 4 kb/s, bitrate of original file is 45 kb/s;
  • duration of output file is 2:58.960, bitrate of original file is 0:15.050;
  • timing in output file is not corresponds to timing of original file.

Even when I try to specify codec and bitrate:

ffmpeg -i MP4WithAACAudio.mp4 -c:a aac -b:a 64k output.aac

FFMPEG always creates file with 4 kb/s bitrate:

Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 4 kb/s

comment:3 by Hendrik, 5 years ago

If you want accurate duration and bitrate information, then store it in mp4/m4a, not raw .aac - or encode as CBR.

Raw aac files don't have any way to store duration or bitrate, and if you encode it as Variable-Bitrate (VBR), there is no good way to accurately determine this information, and all it can do is guess.

comment:4 by Grabien, 5 years ago

In this last example:

ffmpeg -i MP4WithAACAudio.mp4 -c:a aac -b:a 64k output.aac

I specify constant bitrate and don't use -vbr flag. I assume that FFMPEG should create CBR file in this case with 64 kb/s bitrate. But bitrate of output file is 4 kb/s.

comment:5 by Hendrik, 5 years ago

More importantly, put it into a container like mp4, don't use raw aac if you require those values to be exact.

comment:6 by Grabien, 5 years ago

Resolution: worksforme
Status: reopenedclosed

Yes, audio parameters are ok, when I use MP4 as container for AAC stream, thanks a lot for your advices.

Note: See TracTickets for help on using tickets.