[FFmpeg-cvslog] Force automatic thread_count to 1 for cbr mjpeg frame threading.

Carl Eugen Hoyos git at videolan.org
Thu Jan 30 01:29:51 CET 2014


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Thu Jan 30 00:22:25 2014 +0100| [cfc36666f681c41096ee8293f1f47cee1fe58284] | committer: Carl Eugen Hoyos

Force automatic thread_count to 1 for cbr mjpeg frame threading.

Constant bit rate mjpeg encoding fails for threads > 1 and frame threading.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfc36666f681c41096ee8293f1f47cee1fe58284
---

 libavcodec/frame_thread_encoder.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 687f23a..a9c1423 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -125,6 +125,14 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){
        || !(avctx->codec->capabilities & CODEC_CAP_INTRA_ONLY))
         return 0;
 
+    if(   !avctx->thread_count
+       && avctx->codec_id == AV_CODEC_ID_MJPEG
+       && !(avctx->flags & CODEC_FLAG_QSCALE)) {
+        av_log(avctx, AV_LOG_DEBUG,
+               "Forcing thread count to 1 for MJPEG encoding, use -thread_type slice "
+               "or a constant quantizer if you want to use multiple cpu cores\n");
+        avctx->thread_count = 1;
+    }
     if(!avctx->thread_count) {
         avctx->thread_count = av_cpu_count();
         avctx->thread_count = FFMIN(avctx->thread_count, MAX_THREADS);



More information about the ffmpeg-cvslog mailing list