<div dir="ltr">In the encoding/decoding example[1], in the video_encode_example() function, av_opt_set() is used to set the option "preset" to "slow" (here, c is a AVCodecContext*):<div><br></div><div>    av_opt_set(c->priv_data, "preset", "slow", 0);<br><div><br></div><div>I have come across a few people repeating this, all stating that the options aren't being set correctly.</div><div><br></div><div>After I suggest passing the AVCodecContext* instead of the priv_data member, like so:</div><div><br></div><div>    av_opt_set(c, "preset", "slow", 0);<br><div><br></div><div>they report that the options are correctly set.</div><div><br></div><div>The ffmpeg source itself (ffmpeg.c) seems to use the codec context, not the priv_data member; for example:</div><div><br>   av_opt_set_int(ist->dec_ctx, "refcounted_frames", 1, 0);<br></div><div><br></div><div>Is the encoding/decoding example flawed? Should it be passing c instead of c->priv_data to av_opt_set()?</div><div><br></div><div>Thanks,</div><div><br></div><div>Michael Bradshaw</div><div><br></div><div>[1]: <a href="https://www.ffmpeg.org/doxygen/trunk/decoding_encoding_8c-example.html">https://www.ffmpeg.org/doxygen/trunk/decoding_encoding_8c-example.html</a></div></div></div></div>