I have an .avi file containing the following streams:

Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 608x256 [PAR 1:1 DAR 19:8], 23.98 tbn, 23.98 tbc

Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16p, 128 kb/s

I want to play this movie on an Iphone supposed to support mpeg4 video streams as stated in a previous question here. For now, I don't care about the audio stream (mp3 doesn't seem to be supported by the Iphone)

As a consequence I am looking for a way to just convert the "container" format of my file from .avi to .mp4 required by the Iphone. Is it doable, and if yes how should I do that ?

5 Answers 5


Probably should add the way to do that with avconv as well:

avconv -i input.avi -c:v copy -c:a copy output.mp4

If you are compiling libav from source to do that, you need to make sure that you have enabled mp4 muxer. You can do that with

./configure [your other options] --enable-muxer=mp4

It normally is enabled by default anyhow, but i'm providing it here in case you are using --disable-everything or --disable-muxers somewhere in the regular options.


Using ffmpeg, it is easy to only change the container format, and only stream copy (re-mux) the all its streams without reencoding:

ffmpeg -i input.avi -map 0 -codec copy output.mov

If you specify the .mov extension, you can omit -f mov, because ffmpeg guesses it from the extension. If you really want to remove some streams, check the -map option and read about the default stream selection.


You can always use mencoder

Read more here: Encoding video for iPhone with mencoder

  • at least could you make the effort to explain why you downvote my answer? this is something which have been explained in details already in the linked article ...
    – Gipsz Jakab
    Nov 11, 2014 at 4:26
  • Op did not insisted on "avoid resampling/re-encoding" Want to change format, so the iPhone will play it. Well, not every container format / stream encodings can work. If you want to get something working, you must match the required format and encodings ... May 31, 2021 at 9:10

This is what I use:

ffmpeg -y -i %INFILE% -vcodec mpeg4 -r 65535/2733 -vb 600k -acodec libvo_aacenc -ac 1 -ab 94000 -ar 16000 -s 480x320 %OUTFILE%.new.mp4

It's taken from a DOS batch script so you may need to update the variables a little.

The screen resolution is optimised for my phone so my may need to change that as well. Or you can just leave it out.

The -vb is the video bitrate. I don't need superfast video so I often scale it down to this value. Again, you can leave this out if you wish.

  • -1 - the OP implied he wanted to avoid resampling/re-encoding.
    – ostergaard
    Nov 15, 2014 at 12:05
ffmpeg -i input.avi -c:v libx264 -profile:v baseline -level 3.0 -c:a copy output.mp4

This re-encodes your video with h.264, but it should work on all iphones.

  • -1 - the OP implied he wanted to avoid resampling/re-encoding.
    – ostergaard
    Nov 15, 2014 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.