I have a client that wants the render in .mp4 format. Using the Blender VSE, I rendered the image sequence into a movie using H.264, which I understand is MPEG-4, but Blender outputs the .avi extension instead. Why is this the case and is there any harm in renaming the extension to .mp4? When I rename the extension to .mp4 it seems to work just fine, but maybe there is some harm in doing this that I don't understand.
H.264 is a codec and MP4 is a file format. An H.264 stream can be contained in several different file formats, e.g. AVI, MP4 or MKV, and most file formats can handle several codecs.
Video file formats, such as AVI, MP4 or MKV, can handle multiple streams, and most commonly contain one video stream, one or more audio stream(s) and possibly one or more subtitle stream(s).
Simply renaming an AVI file to MP4 won't make it an MP4 file, though most players will detact the actual format and ignore the filename extension. To convert an AVI to MP4, you'll need to re-multiplex it. Multiplexing is the process of combining the different streams into one file and write the proper metadata. This can be done without re-encoding the streams.
I just had a quick look, and I can't find an option to save as MP4, and unless someone has a solution for that, it looks like you'll need an external program for this. If you need/want a GUI application, Avidemux will do nicely for simple re-multiplexing and even some filtering and re-encoding. If you're OK with commandline programs, I recommend FFmpeg.
SixthOfFour's answer correctly explains the codec/container difference. But I am able to natively export as MP4 (with Blender 2.73 on 64-bit Linux) with the following settings:
- Output panel, file format dropdown: H.264
- Encoding panel, format drop-down: MPEG-4
/tmp/0001-0250.mp4 with the H.264 codec.
I believe blender can't export video using the MP4 container. If you export using the H.264 codec option under the Encoding panel, it gets wrapped with the AVI container.
The simplest solution I've found is to export using the Quicktime container and the H.264 codec. Then convert it to the MP4 container using ffmpeg.
ffmpeg -i INPUT.mov -vcodec copy -acodec copy OUTPUT.mp4
On OS X, you can check a video's container, regardless of its file extension in its "Get Info" dialog in Finder. Note the "Kind" and "Codecs" fields.
As of Blender 2.77 you can save directly as a correctly muxed .mp4 file, in the Render Panel, by selecting Output as "H.264" and just below at Encoding, Format: MPEG-4 and Codec: H.264. This generates the correct container and encoding AFAIK. You will not see the Codec part until you select MPEG-4, it is not there for other Format settings. This is a pretty awful UI setup, redundant and opaque, why they don't just have a single setting for Container and a second for Codec, like virtually all video editors and utilities, is beyond me. Or at least rename "Format" to "Container" and keep the "Codec" there for all settings even if it is greyed out if not applicable.