[Libav-user] Idiomatic way to set encoding codec options for a stream

GRANGER Nicolas nicolas.granger at cea.fr
Thu Feb 13 11:49:34 EET 2020


Hi all,

I need to encode images into an mkv container file using the h264
codec. I would like to set codec-specific options such as '-crf'
but I don't know how to do it. So far I have found/considered several
ways:

- let avformat_new_stream allocate AVCodecContext then use the
deprecated Stream.codec field to set the options.
- let avformat_new_stream allocate the AVCodecContext then use
av_opt_set on Stream.priv_data
- pass NULL for the codec to avformat_new_stream and find a way to
create and set the codec context manually? Is this even supported?

How else am I supposed to do this?

Best,
Nicolas


More information about the Libav-user mailing list