Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#9708 closed defect (duplicate)

.aac files produced by ffmpeg miss duration

Reported by: Jozef Chutka Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: aac duration
Cc: Jozef Chutka Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Jozef Chutka)

When doing some audio manipulation with ffmpeg, the .aac output miss duration information. I wonder if this is a container design issue or ffmpeg implementation bug.

ffmpeg -filter_complex amovie=source.wav,adelay=4000 -c:a aac -y out.aac
ffmpeg -i out.aac

[aac @ 0000027a343998c0] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'output/out.aac':
  Duration: 00:02:31.21, bitrate: 1 kb/s

.m4a extension (which I see being used on https://trac.ffmpeg.org/wiki/Encode/AAC) seems ok

ffmpeg -filter_complex amovie=source.wav,adelay=4000 -c:a aac -y out.m4a
ffmpeg -i out.aac

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output/out.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: M4A isomiso2
    encoder         : Lavf59.17.101
  Duration: 00:00:06.62, start: 0.000000, bitrate: 33 kb/s

A combination of m4a format for aac encoder doesnt seem appropriate:

ffmpeg -filter_complex amovie=source.wav,adelay=4000 -c:a aac -f m4a -y out.aac
[NULL @ 00000237e631db40] Requested output format 'm4a' is not a suitable output format

mp4 format in .aac seems ok:

ffmpeg -filter_complex amovie=source.wav,adelay=4000 -c:a aac -f mp4 -y out.aac
ffmpeg -i out.aac

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output/out.aac':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf59.17.101
  Duration: 00:00:06.62, start: 0.000000, bitrate: 33 kb/s

But I am not sure its ok to have mp4 inside .aac file.

Marking it as a defect b/c I believe that .aac with its default container should provide duration information.

Using ffmpeg version 2022-02-07-git-04cc7a5548-full_build-www.gyan.dev

Attachments (1)

source.wav (81.9 KB ) - added by Jozef Chutka 2 years ago.

Download all attachments as: .zip

Change History (5)

by Jozef Chutka, 2 years ago

Attachment: source.wav added

comment:1 by Jozef Chutka, 2 years ago

Description: modified (diff)

comment:2 by Balling, 2 years ago

There is such a bug already. #5448 There is no way to know the actual duration and what part of it is garbage in the start and the end.

comment:3 by Jozef Chutka, 2 years ago

Hi @Balling, thanks for loooking into it.

Is there any workaround to resolve the duration?

I just tried ffmpeg -i out.aac -c copy -y fix.aac which produces the same output, same invalid duration...

comment:4 by Balling, 2 years ago

Resolution: duplicate
Status: newclosed

Duration is correct, as written by the encoder. We are just reading it wrong ON MONO files, and you are writing mono here, Mediainfo is correctly reading them. I am closing this as duplicate of #5448.

But I am not sure its ok to have mp4 inside .aac file.

The file you got must be renamed to mp4 as it is mp4. Also aac is just .adts, not aac. There is not such thing as ".aac".

-f m4a is invalid. The way you do it is add out.m4a that will automocatically add -brand and all the needed stuff in the header.

Last edited 2 years ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.