<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hey guys,<div><br></div><div>I want to use the V210 encoder now to prepare data for playout.</div><div>However, I’m getting a bug I don’t understand. </div><div>Maybe someone can help, here’s the code:</div><div><br></div><div><div style="margin: 0px; font-family: Menlo; color: rgb(61, 29, 129);"><span style="color: #4f8187">AVCodec* _pV210Codec</span><span style="color: #000000"> = </span>avcodec_find_encoder<span style="color: #000000">(</span>AV_CODEC_ID_V210<span style="color: #000000">);</span></div><div style="margin: 0px; font-family: Menlo; color: rgb(79, 129, 135);">AVCodecContext* _pV210CodecCtx<span style="color: #000000"> = </span><span style="color: #3d1d81">avcodec_alloc_context3</span><span style="color: #000000">(</span>_pV210Codec<span style="color: #000000">);</span></div><div style="margin: 0px; font-family: Menlo; color: rgb(61, 29, 129);"><span style="color: #4f8187">_pV210CodecCtx</span><span style="color: #000000">-></span><span style="color: #703daa">codec_type</span><span style="color: #000000"> = </span>AVMEDIA_TYPE_VIDEO<span style="color: #000000">;</span></div><div style="margin: 0px; font-family: Menlo; color: rgb(61, 29, 129);"><span style="color: #4f8187">_pV210CodecCtx</span><span style="color: #000000">-></span><span style="color: #703daa">codec_id</span><span style="color: #000000"> = </span>AV_CODEC_ID_V210<span style="color: #000000">;</span></div><div style="margin: 0px; font-family: Menlo; color: rgb(112, 61, 170);"><span style="color: #4f8187">_pV210CodecCtx</span><span style="color: #000000">-></span>bits_per_raw_sample<span style="color: #000000"> = </span><span style="color: #272ad8">10</span><span style="color: #000000">;</span></div><div style="margin: 0px; font-family: Menlo;"><span style="color: #4f8187">_pV210CodecCtx</span>-><span style="color: #703daa">width</span> = <span style="color: #272ad8">1920</span>;</div><div style="margin: 0px; font-family: Menlo; color: rgb(79, 129, 135);">_pVideoCodecCtx<span style="color: #000000">-></span><span style="color: #703daa">height</span><span style="color: #000000"> = </span><span style="color: #272ad8">1080</span><span style="color: #000000">;</span></div><div style="margin: 0px; font-family: Menlo; color: rgb(61, 29, 129);"><span style="color: #4f8187">_pV210CodecCtx</span><span style="color: #000000">-></span><span style="color: #703daa">pix_fmt</span><span style="color: #000000"> = </span>AV_PIX_FMT_YUV422P10LE<span style="color: #000000">;</span></div><div style="margin: 0px; font-family: Menlo;"><span style="color: #4f8187">_pV210CodecCtx</span>-><span style="color: #703daa">gop_size</span> = <span style="color: #272ad8">1</span>;</div><div style="margin: 0px; font-family: Menlo;"><span style="color: #4f8187">_pV210CodecCtx</span>-><span style="color: #703daa">time_base</span>.<span style="color: #703daa">den</span> = <span style="color: #272ad8">24</span>;</div><div style="margin: 0px; font-family: Menlo;"><span style="color: #4f8187">_pV210CodecCtx</span>-><span style="color: #703daa">time_base</span>.<span style="color: #703daa">num</span> = <span style="color: #272ad8">1</span>;</div><p style="margin: 0px; font-family: Menlo; min-height: 14px;"><br></p><p style="margin: 0px; font-family: Menlo; min-height: 14px;"><span style="color: rgb(0, 132, 0);">// Open codec</span></p><div style="margin: 0px; font-family: Menlo; color: rgb(79, 129, 135);"><span style="color: #c7289c">if</span><span style="color: #000000">(</span><span style="color: #3d1d81">avcodec_open2</span><span style="color: #000000">(</span>_pV210CodecCtx<span style="color: #000000">, </span>_pV210Codec<span style="color: #000000">,</span><span style="color: #c7289c">NULL</span><span style="color: #000000">)<</span><span style="color: #272ad8">0</span><span style="color: #000000">)</span></div><div style="margin: 0px; font-family: Menlo;">{</div><div style="margin: 0px; font-family: Menlo; color: rgb(209, 47, 27);"><span style="color: #000000">    </span><span style="color: #3d1d81">printf</span><span style="color: #000000">(</span>"ERROR: Could not open codec!\n"<span style="color: #000000">);</span></div><div style="margin: 0px; font-family: Menlo;">    <span style="color: #3d1d81">exit</span>(<span style="color: #272ad8">105</span>);</div><div style="margin: 0px; font-family: Menlo;">}</div></div><div style="margin: 0px; font-family: Menlo;"><br></div><div style="margin: 0px;">The error I’m getting is:</div><div style="margin: 0px; font-family: Menlo;"><br></div><div style="margin: 0px;"><div style="font-family: Menlo; margin: 0px; font-size: 11px;"><b>[NULL @ 0x11a800000] [IMGUTILS @ 0x7fff5fbff2a0] Picture size 0x0 is invalid</b></div><div style="font-family: Menlo; margin: 0px; font-size: 11px;"><b>[NULL @ 0x11a800000] Ignoring invalid width/height values</b></div><div style="font-family: Menlo; margin: 0px; font-size: 11px;"><b>[NULL @ 0x11a800000] [IMGUTILS @ 0x7fff5fbff2a0] Picture size 0x0 is invalid</b></div><div style="font-family: Menlo; margin: 0px; font-size: 11px;"><b>[v210 @ 0x11a800000] dimensions not set</b></div><div style="font-family: Menlo;"><b><br></b></div><div>I already tried to not set the resolution but then it also fails.</div><div>I don’t see why the width/height values would not be valid.</div></div><div><br></div><div>Thanks!</div></body></html>