<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="text-align:left; direction:ltr;">
<div>Thank you for the quick reply.</div>
<div><br>
</div>
<div>If I understand correctly, the AVCodecContext is instantiated separately from the FormatContext and Streams.</div>
<div>So what I have to do is:</div>
<div><br>
</div>
<div>1- Instanciate the codec context and configure it as you suggested</div>
<div>2- Instanciate an AVFormatContext</div>
<div>3- Add a stream without codec using avformat_new_stream(fmt_ctx, NULL)</div>
<div>4- set stream id and update codecpar using avcodec_parameters_from_context</div>
<div>5- generate the format header with avformat_write_header</div>
<div>6- proceed to the frame encoding loop</div>
<div><br>
</div>
<div>right?</div>
<div><br>
</div>
<div>Le jeudi 13 février 2020 à 11:07 +0100, Strahinja Radman a écrit :</div>
<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<div>I need to encode images into an mkv container file using the h264</div>
<div>codec. I would like to set codec-specific options such as '-crf'</div>
<div>but I don't know how to do it. So far I have found/considered several</div>
<div>ways:</div>
<div><br>
</div>
</blockquote>
<div><br>
</div>
<div>Before you call avcodec_open2 set the property by calling the</div>
<div> </div>
<div>     av_opt_set_double(enc_ctx->priv_data, "crf", 23.0, 0);</div>
<div><br>
</div>
<div>Some of the options need to be set on the "priv_data", ones that are </div>
<div>codec related, others can be set directly to the enc_ctx </div>
<div><br>
</div>
<div>     av_opt_set_int(enc_ctx, "sc_threshold", 1, 0);</div>
<div><br>
</div>
<div><br>
</div>
<div>_______________________________________________</div>
<div>Libav-user mailing list</div>
<div><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a></div>
<div><a href="https://ffmpeg.org/mailman/listinfo/libav-user">https://ffmpeg.org/mailman/listinfo/libav-user</a></div>
<div><br>
</div>
<div>To unsubscribe, visit link above, or email</div>
<div><a href="mailto:libav-user-request@ffmpeg.org">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</div>
</blockquote>
</body>
</html>