[Bf-blender-cvs] [4bf2530952c] blender2.8: FFmpeg: enable multi-threaded encoding of multiple frames, for a ~20% speedup.

Mal Duffin noreply at git.blender.org
Tue Dec 11 20:47:23 CET 2018


Commit: 4bf2530952c0c772f42595fa79a2c0a9a7559314
Author: Mal Duffin
Date:   Tue Dec 11 20:38:01 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB4bf2530952c0c772f42595fa79a2c0a9a7559314

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

===================================================================

M	source/blender/blenkernel/intern/writeffmpeg.c

===================================================================

diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 06f11301acb..27c26a93bf5 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -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;



More information about the Bf-blender-cvs mailing list