[FFmpeg-user] Setting the "preset" and "crf" options programatically.
Eduardo Felipe
edufelipe at e3c.com.br
Wed Feb 12 21:12:08 CET 2014
Hello everyone,
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
understand alone.
On the command line I do something like this:
ffmpeg -i Sintel.avi -vcodec libx264 -preset ultrafast -crf 18 -f
mpegts udp://127.0.0.1:8000
Then I replicated that in code:
AVFormatContext *oc = NULL;
avformat_alloc_output_context2(&oc, NULL, "mpegts", "udp://
127.0.0.1:8000");
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.
Eduardo Felipe.
More information about the ffmpeg-user
mailing list