[FFmpeg-devel] [PATCH]Warn if cbr and threads > 1 is used for jpeg encoding

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Dec 17 12:09:28 CET 2013


Hi!

JPEG CBR encoding will fail badly (concerning the bitrate) for threads > 1, 
attached patch prints a warning.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index fb9f451..ccc0b56 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -267,6 +267,9 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
             av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
             return -1;
         }
+        if (avctx->thread_count != 1 && !(avctx->flags & CODEC_FLAG_QSCALE))
+            av_log(avctx, AV_LOG_WARNING, "JPEG CBR encoding works badly with more than one thread, "
+                   "consider using -threads 1 or a constant quantiser\n");
         break;
     default:
         if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) {


More information about the ffmpeg-devel mailing list