<div dir="ltr"><div>Charles,<br></div>perhaps the example here can help ?<br><br> <a href="https://ffmpeg.org/doxygen/3.1/decoding__encoding_8c_source.html#l00347">https://ffmpeg.org/doxygen/3.1/decoding__encoding_8c_source.html#l00347</a><br><br><br><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><br><a href="http://lives-video.com" target="_blank">http://lives-video.com</a><br><a href="https://www.openhub.net/accounts/salsaman" target="_blank">https://www.openhub.net/accounts/salsaman</a><br></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Aug 23, 2016 at 8:39 AM, Charles <span dir="ltr"><<a href="mailto:linux2@orion15.org" target="_blank">linux2@orion15.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 08/23/2016 03:08 AM, Nicolas George wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Le sextidi 6 fructidor, an CCXXIV, Charles a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
6 - avcodec_parameters_to_context( av_encode_codec_ctx, av_out_fmt_ctx->streams[ 0 ]->codecpar )<br>
</blockquote>
<br>
You are copying the parameters from a newly created blank stream to an<br>
initialized encoder. That feels wrong.<br>
<br>
Regards,<br>
</blockquote>
<br></span>
Thanks for the look, I did some rearranging and I am to the point where the muxer is happy or the encoder is happy but cant get both at the same time:<br>
<br>
Currently Op order:<br>
1) av_encode_codec = avcodec_find_encoder( AV_CODEC_ID_H264 )<br>
2) avformat_alloc_output_context2<wbr>( &av_out_fmt_ctx, NULL, NULL, f.c_str() )<br>
3) video_st = avformat_new_stream( av_out_fmt_ctx, av_encode_codec )<br>
video_st->id = 0;<br>
video_st->time_base.den = 60; // * 2;<br>
video_st->time_base.num = 1;<br>
// This solved the time_base error<br>
4) parameters = video_st->codecpar;<br>
parameters->codec_tag = tag;<br>
parameters->format = AV_PIX_FMT_YUV420P;<br>
parameters->bit_rate = 5e6;<br>
parameters->width = 1024;<br>
parameters->height = 768;<br>
parameters->bit_rate = 5e6;<br>
av_dict_set( &av_dict_opts, "b", "2.5M", 0);<br>
av_dict_set( &av_dict_opts, "preset", "losslesshp", 0 );<br>
av_dict_set( &av_dict_opts, "profile", "high", 0 );<br>
av_dict_set( &av_dict_opts, "rc", "vbr_minqp", 0 );<br>
av_dict_set( &av_dict_opts, "gpu", "1", 0 );<br>
5) av_encode_codec_ctx = avcodec_alloc_context3( av_encode_codec )<br>
av_encode_codec_ctx->bit_<wbr>rate = 5e6;<br>
av_encode_codec_ctx->width = 1024; /// \note multiple of 2<br>
av_encode_codec_ctx->height = 768; /// \note multiple of 2<br>
av_encode_codec_ctx->time_<wbr>base = (AVRational) { 1, 60 }; //* 2;<br>
av_encode_codec_ctx->gop_<wbr>size = 15; // Intra frames per x P frames<br>
av_encode_codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P; // MUST DO NOT CHANGE nvenc required<br>
// This appears to make h264_nvenc happy<br>
6) avcodec_parameters_to_context( av_encode_codec_ctx, parameters )<br>
7) avcodec_open2( av_encode_codec_ctx, av_encode_codec, &av_dict_opts )<br>
<br>
[mp4 @ 0xc2ed60] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.<br>
[mp4 @ 0xc2ed60] dimensions not set<br>
<br>
AVStream does not have dimensions, and the error makes me think its in the ctx but I am setting those dims.<br>
<br>
Clearly I am not setting something, just haven't found it.<div class="HOEnZb"><div class="h5"><br>
<br>
Thanks<br>
cco<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/list<wbr>info/libav-user</a><br>
</div></div></blockquote></div><br></div>