Aim of this patch is to mirror behavior of ffmpeg tool when encoding.
So far I was focused on H264 codec, because it didn't work as expected.
H264 codec is also only one I have tested so far.
Use avcodec_get_context_defaults3() to initialize encoder codec
context. In case of H264, when not using default values, presets are
working incorrectly. In case of ultrafast preset, this caused crash.
On crash, error was reported: "broken ffmpeg default settings detected"
See libx264 source x264/encoder/encoder.c for more details.
Removed H264 settings are from 12 years ago, and I am not familiar with
how libx264 worked back then, nor whether this was correct approach.
With this patch all settings except user controllable ones
(quality, gop size, ...) match ffmpeg tool.