avcodec: define coded_width/height on encoding
authorIlkka Ollakka <ileoo@videolan.org>
Mon, 11 Feb 2019 08:49:37 +0000 (10:49 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Tue, 12 Feb 2019 07:49:55 +0000 (09:49 +0200)
With this change, transcoding to multiple outputs with intermediate encode works.

Example sout-chain used to test:
--sout="#transcode{vcodec=I420,deinterlace}:duplicate{dst={transcode{vcodec=h264,vfilter=canvas{width=640,height=320}}},dst={transcode{vcodec=h264,vfilter=canvas{width=320,height=240}}}}:file{dst=test_output.ts}"

Without this change, rawvideo codec will complain about invalid frame size.

modules/codec/avcodec/encoder.c

index 2b824d0..2f8e2d8 100644 (file)
@@ -500,6 +500,8 @@ int InitVideoEnc( vlc_object_t *p_this )
 
         p_context->codec_type = AVMEDIA_TYPE_VIDEO;
 
+        p_context->coded_width = p_enc->fmt_in.video.i_width;
+        p_context->coded_height = p_enc->fmt_in.video.i_height;
         p_context->width = p_enc->fmt_in.video.i_visible_width;
         p_context->height = p_enc->fmt_in.video.i_visible_height;