ffmpeg in blender for in- and output

Introduction

On Linux the supported codecs on input (and output)-side are rather limited. You can read and write only the most basic raw formats that are around.

There are sadly not that many libraries which you can add to Blender that help here.

The problem with most codec-libraries boils down to the problem that they do not support sensible seeking.

ffmpeg (and it's underlying libraries libavformat and libavcodec) maybe not the best around but they basically work and can be build on several platforms. The short coming of ffmpeg is, that the authors tend to change the interface at will. The blender code tries to address most versions.

Implementation

Input: anim.c and hdaudio.c

Input was added to the imbuf-library in the file anim.c. The really hard part is getting seeking to work correctly on mpeg-files. Otherwise the user shouldn't notice any difference from opening other video files.

Output: writeffmpeg.c

The ffmpeg output adds, when selected two additional panels for Video and Audio-Output-control.

There are presets for most sensible output formats like SVCD, DVD, etc. and adjust the other values taking into account if you are generating PAL or NTSC videos.

The FFMPEG-Output is the only one in Blender that can automatically multiplex the audio-timeline into the output-stream. Just click on "Multiplex audio", choose your codec and bitrate and enjoy.

The audio-output is also controlled using the usual output-render options! If you want to change the output sample rate you have to do it there!

The code does not handle wrong combinations very well. For example the libavcodec is unable to produce 32khz DV-audio output. It simply dumps core...

Make it compile

At present, ffmpeg-support is only enabled on Linux and Windows (using the free mingw-compiler) per default. The latest version works with several versions of ffmpeg - especially the Debian-Sarge version and latest CVS should build without a flaw. To build ffmpeg from source just do a
./configure && make && make installlib
If you have installed libavformat-dev or libavcodec-dev before (using the Debian package system for example) please remove them before trying to compile Blender. If it doesn't work out for you, please use
export NAN_NO_FFMPEG = true
in your user-def.mk.