[FFmpeg-user] Remux to a "brand mp42" MP4 file

Vangelis forthnet northmedia1 at the.forthnet.gr
Thu Feb 14 16:34:22 CET 2013

Hello people :-) , this is my first post on the list,
please be patient/lenient, apologies if my following
query has been previously answered somewhere inside
the vastness of the mail archives...

I have an FLV file downloaded by RTMPdump 2.4;
video is AVC Main at L3.0, audio is HE-AAC / LC
(aka HE-AACv1 or aacp or AAC+SBR).

I want to use FFmpeg to remux losslessly into the
MP4 container, preferably with a one-step-process, but
I want the ftyp atom of the mp4 file to be
mp42. "mp42" means a "compatible brand"
"MP4 v2 [ISO 14496-14]".
 I am on WindowsVista SP2 x86 & using the
static win32 build of FFmpeg 1.1.1 from the Zeranoe repository
at http://ffmpeg.zeranoe.com/builds/win32/static/

When I run the remuxing command:

ffmpeg -i "foo.flv" -c copy -f mp4 "foo.mp4"

the resulting file always has (mediainfo report):
Format profile                   : Base Media
Codec ID                         : isom
i.e. ftype code 'isom' (means a "compatible brand"
"MP4 Base Media v1 [IS0 14496-12:2003]").
Is there something I could add to the command so that the
generated mp4 file reports:
Format profile                   : Base Media / Version 2
Codec ID                         : mp42

Before posting here, I have searched for about 30min
on the web, found nothing conclusive...

Right now, the only way to accomplish this is to demux the
raw streams from the FLV (either via FLVExtractCL.exe or
via FFmpeg.exe,
ffmpeg -i foo.flv -f h264 -an -c:v copy -bsf:v h264_mp4toannexb Video.h264
ffmpeg -i foo.flv -f adts -vn -c:a copy Audio.aac

and then remux them to mp4 with MP4Box:

MP4Box -brand mp42 -delay 1=1 -add "Video.264:name=AVC Video
Stream:lang=en:fps=25.000" -add "Audio.aac:name=HE-AAC Audio
Stream:lang=en:sbr:mpeg4" -itags

And while I am at it, is there a way for ffmpeg to flag the aac audio stream
as being HE-AAC?
When I play back with Quicktime the mp4 FFmpeg creates, Quicktime reports
that the audio stream is AAC LC,
not  HE-AAC (which is the correct type).
However, MP4Box does have the switch --sbr, so the mp4 file IT creates is
correctly recognised by
Quicktime as having a HE-AAC audio stream and the sampling rate is correctly
displayed @ 48.0kHz,
not at half that value (24.0 kHz), which is the case with the ffmpeg created

Many thanks in advance! 

More information about the ffmpeg-user mailing list