Hi Adreas, <div><br></div><div>a possible way to setup some of the parameters you mentioned could be something like this:</div><div><br></div><div>m_outputFormatContext = avformat_alloc_context();</div><div>m_outputFormat = av_guess_format("mp4", NULL, NULL); // if you are using MP4 as container for h264</div>
<div>m_outputFormatContext->oformat = m_outputFormat;</div><div>AVStream* outputStream = av_new_stream(m_outputFormatContext, 0);</div><div><br></div><div><div>AVCodec* codec = avcodec_find_encoder(CODEC_ID_H264);</div>
<div>outputStream->codec = avcodec_alloc_context3(codec);</div></div><div><br></div><div>Then, you can access every parameter of the AVCodecContext structure, like this:</div><div><br></div><div><div>outputStream->codec->codec_type = ...</div>
<div>outputStream->codec->coder_type = ...</div><div>outputStream->codec->flags = ....</div><div>outputStream->codec->me_cmp = ...</div><div><br></div></div><div>You may see at the AVCodecContext source code (within avcodec.h) to determine which parameters are present in the AVCodecContext structure.</div>
<div><br></div><div>Regards,</div><div>Alessandro</div><div><br><div class="gmail_quote">Il giorno 05 marzo 2012 17:47, adreas Polyxronopoulos <span dir="ltr"><<a href="mailto:apolyxrono@yahoo.co.uk">apolyxrono@yahoo.co.uk</a>></span> ha scritto:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div style="font-family:arial,helvetica,sans-serif">
<span>Hi all,</span></div><div style="font-family:arial,helvetica,sans-serif"><span><br></span></div><div style="font-family:arial,helvetica,sans-serif"><span>i would like to set the following x264 command line options from within my source code:</span></div>
<div style="font-family:arial,helvetica,sans-serif"><span><br></span></div><div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif">x264 --profile baseline </span></div><div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --no-mixed-refs </span></div>
<div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --rc-lookahead 1</span></div><div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --ref 1</span></div>
<div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --subme 1</span></div><div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --trellis 0</span></div>
<div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --weightp 1</span></div><div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --me dia</span></div>
<div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --no-deblock</span></div><div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --no-8x8dct</span></div>
<div><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif"> --partitions none</span></div><div style="font-family:arial,helvetica,sans-serif"><span><br></span></div><div><span style="font-family:arial,helvetica,sans-serif">I have tried the </span><span style="font-family:'Courier New',courier,monaco,monospace,sans-serif">av_opt_set(c->priv_data, "profile", "baseline", 0);</span> <span style="font-family:arial,helvetica,sans-serif;font-size:10pt">But i can't set all the above values.</span></div>
<div><span style="font-size:10pt">For example the call <span style="font-family:'Courier New',courier,monaco,monospace,sans-serif">ret = av_opt_set(c->priv_data, "me", "dia", 0);</span> gives<span style="font-family:arial,helvetica,sans-serif;font-style:italic"> </span><span style="font-family:arial,helvetica,sans-serif">ret = -1414549496</span>
which i don't know what it means or i don't know how to find the error_code</span></div><div style="font-family:arial,helvetica,sans-serif"><span style="font-size:10pt"><br></span></div><div style="font-family:arial,helvetica,sans-serif">
<span style="font-size:10pt">thanks</span></div><div style="font-family:arial,helvetica,sans-serif"> </div><div style="font-family:arial,helvetica,sans-serif"><span style="font-weight:bold;color:rgb(91,91,91);font-family:'comic sans ms'">Adreas Polychronopoulos</span><br style="font-weight:bold;color:rgb(0,0,255);font-family:'comic sans ms'">
</div></div></div><br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>______________________________________________<br><br>Ing. Alessandro Paganelli, Ph. D. Student, 25th Cycle<br><br>Department of Information Engineering<br>
University of Modena and Reggio Emilia<br>via Vignolese 905, 41125 Modena (MO), ITALY<br><br>E-mail: <a href="mailto:alessandro.paganelli@unimore.it">alessandro.paganelli@unimore.it</a><br>
</div>