In #1050, VideoEncoder is updated to use raw AVDictionary pointers (avFormatOptions_, avCodecOptions) and manual calls to av_dict_free() to clean up those objects.
void sortCodecOptions(
const std::map<std::string, std::string>& extraOptions,
AVDictionary** codecDict,
AVDictionary** formatDict)
. . .
av_dict_free(&avCodecOptions);
We should create a UniqueAVDictionary wrapper class (similar to existing UniqueAVFrame) that automatically manages the AVDictionary objects using the RAII pattern, then refactor VideoEncoder to use UniqueAVDictionary and remove manual cleanup calls.