Dev:Ref/GoogleSummerOfCode/2005/FFMpeg Integration

提供: wiki
移動先: 案内検索

FFMpeg Integration

Input

Video

Video input encompasses both the sequencer and video textures. Fortunately, Blender uses the same code for both: ImBuf. So far I have added hooks into blender/imbuf/intern/anim.c(inside "#ifdef WITH_FFMPEG"'s of course) that initializes libavformat/libavcodec for that file. I used the Quicktime code as a model for this: namely, I defined another struct that is used within the anim struct defined in IMB_anim.h. ffmpeg initializes all input formats on first access (input or output).

Seeking should work on most well behaving files. It works best on files, that allow naturally frame exact seeking (like DV, or AVI-RAW).

Audio

Audio input is support within a seperate track format called "Audio (HD)" in hddaudio.c . To find out more about "Audio (HD)"-support, take a look BlenderDev/SequencerHddaudio "Audio (HD)" isn't limited to ffmpeg, Quicktime and AVI should be added later.

FFMpeg-Support should be added to the bSound-System some day to support more file formats here. (Could be easily done using the hddaudio-interface...)

Otherwise it works flawlessly on all files, including VBR-MP3-files!

Output

Since there are so many different combinations of format containers and codecs(many of which are invalid), some may not work, but will give an error message to the user.

Missing here: automatic scan of available codecs and display this to the user.

Otherwise it should work as expected. It is the only output system in blender, that can multiplex video with audio directly!

Pipeline

Here's a diagram of the pipeline video takes through Blender when using FFMpeg.

Ffmpeg pipeline.png

Compilation

A recent version of ffmpeg is bundled with the Blender-Source tree now. Compilation is enabled by default on Linux only.

Add "WITH_FFMPEG=true" to "user-def.mk" if you want to try on other platforms. Unix-like systems should work flawlessly as well as Mingw on Windows. (Everything that has GCC should be fine.)

Usage

Assuming you compiled everything correctly, you should see a new output format in the dropdown box: FFMpeg(naturally). Select this and you should see another panel appear, with audio and video options. Here you can select the output format and codec(if the selected format allows different codecs), as well as the following options.

Keep in mind, that the output sample rate has to be set on the audio-output render dialog!

Most of the detail options in the video dialog are ment for experts only. They are needed in such detail to generate standard conforming VCDs, SVCDs and DVDs.

On startup those fields are set to the DVD-presets.

I suggest, that you first try to play with the available presets, that will set the fields to sensible values for you automagically.

Video Bitrate

Bitrate of the output video stream in kbits/s.

Audio Bitrate

Bitrate of the output audio stream in kbits/s.

RC min rate

Minimal video bitrate in kbits/s.

RC max rate

Maximum video bitrate in kbits/s.

RC buffer size

Rate control buffer size in kbits.

Mux rate

Stream multiplex rate in bits/s. (Yes, bits/s, since some clown specified a very particular multiplex rate for VCDs and DVDs.)

Mux packet size

Stream multiplex packet size. Again most likely only interesting for MPEG-encoding on disc medias like VCDs and DVDs: the sector size.

GOP Size

Keyframe interval. These are standardized on most formats. (MPEG-PAL is 15 and MPEG-NTSC is 18 for example). Other formats leave it to the user.



-- IanGowen - 24 Aug 2005

-- Peter - 29 Jun 2006