[Libav-user] How to set x264 options

ALESSANDRO PAGANELLI 83670 at studenti.unimore.it
Tue Mar 6 08:48:20 CET 2012


Hi Adreas,

a possible way to setup some of the parameters you mentioned could be
something like this:

m_outputFormatContext = avformat_alloc_context();
m_outputFormat = av_guess_format("mp4", NULL, NULL); // if you are using
MP4 as container for h264
m_outputFormatContext->oformat = m_outputFormat;
AVStream* outputStream = av_new_stream(m_outputFormatContext, 0);

AVCodec* codec = avcodec_find_encoder(CODEC_ID_H264);
outputStream->codec = avcodec_alloc_context3(codec);

Then, you can access every parameter of the AVCodecContext structure, like
this:

outputStream->codec->codec_type = ...
outputStream->codec->coder_type = ...
outputStream->codec->flags = ....
outputStream->codec->me_cmp = ...

You may see at the AVCodecContext source code (within avcodec.h) to
determine which parameters are present in the AVCodecContext structure.

Regards,
Alessandro

Il giorno 05 marzo 2012 17:47, adreas Polyxronopoulos <
apolyxrono at yahoo.co.uk> ha scritto:

> Hi all,
>
> i would like to set the following x264 command line options from within my
> source code:
>
> x264 --profile baseline
>         --no-mixed-refs
>         --rc-lookahead 1
>         --ref 1
>         --subme 1
>         --trellis 0
>         --weightp 1
>         --me dia
>         --no-deblock
>         --no-8x8dct
>         --partitions none
>
> I have tried the av_opt_set(c->priv_data, "profile", "baseline", 0); But
> i can't set all the above values.
> For example the call   ret = av_opt_set(c->priv_data, "me", "dia", 0);gives ret
> = -1414549496  which i don't know what it means or i don't know how to
> find the error_code
>
> thanks
>
> Adreas Polychronopoulos
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>


-- 
______________________________________________

Ing. Alessandro Paganelli, Ph. D. Student, 25th Cycle

Department of Information Engineering
University of Modena and Reggio Emilia
via Vignolese 905, 41125 Modena (MO), ITALY

E-mail: alessandro.paganelli at unimore.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120306/22cc37fd/attachment.html>


More information about the Libav-user mailing list