[FFmpeg-user] Setting the "preset" and "crf" options programatically.
edufelipe at e3c.com.br
Wed Feb 12 21:12:08 CET 2014
I'm trying understand how the "preset" and "crf" command-line options for
ffmpeg gets filled in into the AVCodecContext structure. I've looked into
"ffmpeg_opt.c", "ffmpeg.c" and "libx264.c" trying to figure out how it gets
filled when encoding H.264 but there are just too many layers for me to
On the command line I do something like this:
ffmpeg -i Sintel.avi -vcodec libx264 -preset ultrafast -crf 18 -f
Then I replicated that in code:
AVFormatContext *oc = NULL;
avformat_alloc_output_context2(&oc, NULL, "mpegts", "udp://
AVCodec *codec = avcodec_find_encoder_by_name("libx264");
AVStream *st = avformat_new_stream(oc, codec);
AVCodecContext *c = st->codec;
And that's where I get stuck. What should I do with AVCodecContext to set
those parameters as that struct does not have a "preset" or "crf" field.
Thanks in advance.
More information about the ffmpeg-user