[Libav-user] force_key_frames

Igor Belyakov belyakov-i at spsinf.ru
Thu Apr 2 22:13:17 EEST 2020


02.04.2020, 21:22, "M Parker" <diesirae777 at hotmail.com>:
>>The option force_key_frames is handled in fftools/ffmpeg.c, so your best
> approach is to copy its behaviour.
>
> I had gotten that far, but setting it still eluded me. After much digging, some experimentation
> and a little luck, I figured out how to code it in:
>
> AVDictionary *dict;
> av_dict_set(&dict, "force_key_frames", expression_string, NULL);
> avcodec_open2(videoCodecContext, videoCodec, &dict);
>
> Hopefully this helps someone in the future.
>
> ----------------------------------------
> From: Libav-user <libav-user-bounces at ffmpeg.org> on behalf of Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Sent: Wednesday, April 1, 2020 7:02 PM
> To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org>
> Subject: Re: [Libav-user] force_key_frames
>
> Am Mi., 1. Apr. 2020 um 20:23 Uhr schrieb M Parker <diesirae777 at hotmail.com>:
>>
>> The command line has an option for forcing key frames, aptly named: -force_key_frames
>>
>> Is it possible to set this via libav, and where would I do it? The closest I've been able
>> to find is a forced_key_frames option on an OutputStream, and I can't find
>> where to access it.
>
> The option force_key_frames is handled in fftools/ffmpeg.c, so your best
> approach is to copy its behaviour.
>
> Carl Eugen


> AVDictionary *dict;
You use av_dict_set to allocate a new dictionary here. It will not allocate unless dict == nullptr so I think you need to initialize dict with nullptr.

> Hopefully this helps someone in the future.
I hope it will help me, but what is "expression_string"?


More information about the Libav-user mailing list