[vlc-devel] [PATCH] avcodec: define coded_width/height on encoding

Ilkka Ollakka ileoo at videolan.org
Mon Feb 11 10:01:24 CET 2019


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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 2b824d0af3..2f8e2d8a14 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -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;
 
-- 
2.20.1



More information about the vlc-devel mailing list