[gst-devel] Does ffmux_mov support muxing both audio and video?

Ronald S. Bultje rbultje at ronald.bitfreak.net
Thu Nov 9 15:52:45 CET 2006

You need to do one problem at a time.

First do the mpeg-4 in .mp4 issue, so video alone. My fix will help
there. For video-only files., Quicktime should play them back, at least
with versions I tested. Current CVS may have new bugs that I'm not aware
of. If you want to test audio, use a common codec like AAC.

Then do AMR. It is likely that Quicktime only reads AMR in .3gp files,
if at all, similar to how WMP reads MSMPEG4 only in .asf or MP3 only
in .avi. That cannot be fixed. Use a .3gp muxer instead (can be added to
ffmpeg, just add it to gstffmpegcodecmap.c somewhere at the bottom,
search for mp4 or mov, along with a codec mapping to understand which
inputs are supported by this muxer), and use h263 instead of MPEG-4
video (I don't think .3gp allows MPEG-4 video). If you want, again, do
one thing at a time: firt audio-only, then audio+video.

As for the duration, you already know the problem there.


On Thu, 2006-11-09 at 14:16 +0900, Deeptendu Bikash wrote:
> Hi Ronald,
> I added the following line to gstffmpegenc.c on your advice:
> ffmpegenc->context->flags |= CODEC_FLAG_GLOBAL_HEADER;
> Have I done what you meant?
> I also changed the caps of mp4 to accept audio/AMR. After I encode
> with ffenc_mpeg4 and amrnbenc, and mux is, the output file behaviour
> is as follows:
> Muxer: ffmux_mp4. When I play using gst-launch playbin, I get the
> audio but not the video. When I play in VLC player, I get the video
> but not the audio (thats maybe because VLC player does not support
> AMR?). When I play using quicktime, I get Error -2010: The input file
> contains some invalid data. When I open using mp4UI, it is able to
> detect it as a valid mp4 file with an audio and a video track, of
> which it recognizes the video track to be of MPEG-4 Video but cannot
> recognize the auido format (maybe it does not know about AMR).
> Muxer: ffmux_mov. With gst-launch playbin and VLC player, the output
> is the same as above. When I play using quicktime, a screen of the
> same size as the video opens up, but there is no video; I do get to
> hear the audio, however. And of course, mp4UI cannot open the mov file
> because it is not exactly a mp4 file. 
> Any idea of what's happening? I'm totally confused.
> And yes, players that are able to open the above files show the
> duration of the audio as 2 mins 54 secs and video as 3 secs, which is
> correct.
> On 11/8/06, Ronald S. Bultje <rbultje at ronald.bitfreak.net> wrote: 
>         On Wed, 2006-11-08 at 06:23 -0800, Deeptendu Bikash wrote:
>         > I found out that my pipeline was actually muxing both audio
>         and video, 
>         > despite gstreamer giving that error. Also gstreamer playbin
>         itself was not
>         > capable of playing the movie. VLC player could play it,
>         though it got the
>         > duration wrong. Quicktime could not play it. So I guess it
>         again boils down 
>         > to the bug/s in ffmpeg regarding handling audio duration
>         which we discussed
>         > in another mail thread. So let me start looking into it.
>         You need to set the global header flag in the AVCodecContext
>         of
>         ffenc_mpeg4 for Quicktime to play it back. Without it, ffmpeg
>         doesn't
>         write the esds atom, which makes the MPEG-4 stream embeddable
>         in .avi,
>         for example (e.g. divx). However, Quicktime doesn't eat MPEG-4
>         without
>         global headers (esds atoms).
>         You can autodetect this by seeing whether the caps of the
>         output video
>         (in ffenc_mpeg4) is video/x-divx or video/mpeg,mpegversion=4.
>         With that
>         flag set, Quicktime will be able to play back the resulting
>         stream also 
>         (I confirmed this with the 0.8 version, it shouldn't differ
>         nowadays in
>         0.10).
>         Ronald

More information about the gstreamer-devel mailing list