X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fstream_out%2Ftranscode.c;h=a6f168bae5b196009035ff494d578a8783aac2cf;hb=89e1637e4e06feac851edcafb4ebe760ce611595;hp=8c79c24177248f87acda06a37fe15078e5764f6f;hpb=54f1118b5e119508302d5967e2df8e3cbfeb630e;p=vlc diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index 8c79c24177..a6f168bae5 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -1547,9 +1547,24 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream, if( id->p_encoder->fmt_out.video.i_width <= 0 && id->p_encoder->fmt_out.video.i_height <= 0 && p_sys->f_scale ) { - /* Apply the scaling */ + /* Apply the scaling and round at the nearest 16. Don't allow 0 size */ id->p_encoder->fmt_out.video.i_width = i_width * p_sys->f_scale; + if( id->p_encoder->fmt_out.video.i_width % 16 <= 7 && + id->p_encoder->fmt_out.video.i_width >= 16 ) + id->p_encoder->fmt_out.video.i_width -= + id->p_encoder->fmt_out.video.i_width % 16; + else + id->p_encoder->fmt_out.video.i_width += + 16 - id->p_encoder->fmt_out.video.i_width % 16; + id->p_encoder->fmt_out.video.i_height = i_height * p_sys->f_scale; + if( id->p_encoder->fmt_out.video.i_height % 16 <= 7 && + id->p_encoder->fmt_out.video.i_height >= 16 ) + id->p_encoder->fmt_out.video.i_height -= + id->p_encoder->fmt_out.video.i_height % 16; + else + id->p_encoder->fmt_out.video.i_height += + 16 - id->p_encoder->fmt_out.video.i_height % 16; } else if( id->p_encoder->fmt_out.video.i_width > 0 && id->p_encoder->fmt_out.video.i_height <= 0 )