[Libav-user] Using av_dict_set to set options

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Nov 28 20:53:43 EET 2016

2016-11-28 3:16 GMT+01:00 Joel Ng <blood_elves88-at-yahoo.com.sg at ffmpeg.org>:
> Hello, I have several questions about using av_dict_set(AVDictionary **pm,
> const char *key, const char *value, int flags) to set the options for input
> and output videos.
> I am trying to translate several options from the FFmpeg binary usage to the
> libav-api, and I have trouble with some of them.
> 1. If I have multiple options to set (e.g. "-preset ultrafast", and "-tune
> zerolatency"), do I just use av_dict_set repeatedly, one after the other?


> Will they overwrite each other?

One "preset" will (hopefully) overwrite another "preset".

> I believe they do, since the documentation
> says "Set the given entry in *pm, overwriting an existing entry."

... with the same name.

> How do I add more options then?

> 2. I used "-re" on FFmpeg. av_dict_set requires a key and value. How do I
> apply this option?

This is not an option that you can pass to the library, your calling
code has to take care that it does not work faster than realtime.
(Just as ffmpeg.c does)

> 3. How would I translate this to an option:
> "-x264opts ...

"x264opts" is an option that takes a string as argument (iirc).

Carl Eugen

More information about the Libav-user mailing list