Opened 8 months ago

Closed 8 months 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 8 months ago.
MP4 with AAC audio example

Change History (7)

Changed 8 months ago by Grabien

MP4 with AAC audio example

comment:1 Changed 8 months ago by cehoyos

  • Resolution set to worksforme
  • Status changed from new to closed

Output file plays fine here.

comment:2 Changed 8 months ago by Grabien

  • Resolution worksforme deleted
  • Status changed from closed to reopened

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 Changed 8 months ago by heleppkes

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 Changed 8 months ago by Grabien

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 Changed 8 months ago by heleppkes

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

comment:6 Changed 8 months ago by Grabien

  • Resolution set to worksforme
  • Status changed from reopened to closed

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.