FFmpeg: enable multi-threaded encoding of multiple frames, for a ~20% speedup.

This enables ffmpeg to encode each frame in its own thread. However in most
cases Blender does not pass frames to ffmpeg fast enough to actually use the
more than two threads. In some tests the speed was measured to be about 20%.
If other parts of the video sequencer get optimized, this should improve.

Differential Revision: https://developer.blender.org/D4031
This commit is contained in:
Mal Duffin 2018-12-11 20:38:01 +01:00 committed by Brecht Van Lommel
parent 48a3f97b23
commit 4bf2530952
1 changed files with 6 additions and 0 deletions

View File

@ -543,6 +543,9 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
/* Set up the codec context */
c = st->codec;
c->thread_count = 0;
c->thread_type = FF_THREAD_FRAME;
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_VIDEO;
@ -703,6 +706,9 @@ static AVStream *alloc_audio_stream(FFMpegContext *context, RenderData *rd, int
st->id = 1;
c = st->codec;
c->thread_count = 0;
c->thread_type = FF_THREAD_FRAME;
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_AUDIO;