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

Michael Niedermayer michaelni at gmx.at
Tue Dec 17 20:02:25 CET 2013


On Tue, Dec 17, 2013 at 12:09:28PM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> JPEG CBR encoding will fail badly (concerning the bitrate) for threads > 1, 
> attached patch prints a warning.
> 
> Please comment, Carl Eugen

>  mpegvideo_enc.c |    3 +++
>  1 file changed, 3 insertions(+)
> d76559eb221490bea8e4c6844e3cf4ecfdbe8964  patchmjpegcbr.diff
> 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");

it should work with slice threads, just frame threads maybe dont work
also disabling frame threads in case no explicit threads is specified
might be nice
see ff_frame_thread_encoder_init()
note, if adding a limit there doesnt work tell me and ill take a look

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131217/cadf2ba3/attachment.asc>


More information about the ffmpeg-devel mailing list