[FFmpeg-user] Create an AAC stream matching the Core Media Audio packet format / priming etc?

Sasi Inguva isasi at google.com
Wed Jun 28 03:12:41 EEST 2017

I have been helping Mark test Marton's patch. I looked at the test file Mark
was using to test the sync. There are multiple reasons for audio being

i) That file doesn't contain a non-zero edit list or 'sgpd' atom, as 
suggests to put. For this kind of file the spec says that, use the
historical solution of assuming the delay as 2112 samples. And this is what
the QuickTime player and iMovie on my MAC seem to be doing. However in
Ffmpeg we don't assume the delay as 2112 samples. If there is no edit list,
we assume it as zero.
Hence, when we transcode the video using ffmpeg, we are adding 2112 samples
of silence in the transcoded file ( as actual audio data). 
ii) On top of that ffmpeg AAC encoder itself introduces 1024 samples of
silence, and ffmpeg then uses edit list to denote that as the encoder delay. 
However the spec says that along with the edit list, we should also set the
"sgpd" atom, ( which is what Marton's patch does).

So to fix this, I hacked ffmpeg MOV demuxer to assume 2112 delay for AAC,
and combined it with Marton's patch.  I hoped that the file transcoded from
ffmpeg built from these two patches, will correctly match the original test
file when decoded with Apple tools (iMovie) . 

However it was not to be. It seems like even Apple tools don't respect the
new way of setting the encoder delay. When I decode the file using iMovie, I
observe that 2112 samples from the beginning are gone, indicating that Apple
is still assuming 2112 samples of delay for AAC.

I am attaching the original test file, and the file I generated.

View this message in context: http://www.ffmpeg-archive.org/Create-an-AAC-stream-matching-the-Core-Media-Audio-packet-format-priming-etc-tp4679789p4680414.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.

More information about the ffmpeg-user mailing list