<div dir="ltr"><div>Hi 

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Philippe!</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div>These two,for example are super confusing:</div><div><br></div><div><span style="white-space:pre">     </span>avcodec_parameters_from_context(mAudioOutStream->codecpar, inStream->codec)  </div><div><span style="white-space:pre">                         </span> </div><div><span style="white-space:pre">    </span>avcodec_parameters_to_context(mAudioOutStream->codec, inStream->codecpar)  </div><div><br></div><div>In my case the first option didn't copy everything ,I had to add props manually for the muxer to work. The second  function is better. I didn't have to manually copy params after calling it.</div><div>But looking at the signatures of these two methods it is hard to understand which to use when.</div><div>So you wrote the second one is used for demuxing. In my case I actually do muxing of input inStream into 

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">mAudioOutStream... So I don't get it.</span></div><div><br></div><div><br></div></div><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 14, 2018 at 9:52 PM Michael IV <<a href="mailto:explomaster@gmail.com">explomaster@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Exactly:<div><br></div><div>

<i><b><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">For muxing/encoding:</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">avcodec_parameters_from_contex</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">t(stream->codecpar, codec_ctx);</span>

</b></i><br></div><div><i><b><br></b></i></div><div>That's what I am talking about.In my case ,codec_ctx is context I access from the input stream.</div><div>I don't create it. So the deprecation warning is appears in this case. I don't see why I have to</div><div>create codec context just to get rid of those warnings.</div><div><br></div></div><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 14, 2018 at 9:44 PM Philippe Gorley <<a href="mailto:philippe.gorley@savoirfairelinux.com" target="_blank">philippe.gorley@savoirfairelinux.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2018-03-14 03:26 PM, Michael IV wrote:<br>
> Hi. I am trying to get rid of deprecation warning in the API. I am<br>
> running with<br>
> ffmpeg -20170711 version. I have a code where I don't explicitly create<br>
> AVCodecContext<br>
> because I multiplex already existing h264 NALS. But I still have to<br>
> setup AVStream which has AVCodecContext which it creates internally<br>
> based on the codec I pass into<br>
><br>
> avformat_new_stream<br>
><br>
> .So I have something like this then:<br>
><br>
> mVideoOutStream->codec->gop_size = muxerParams.gopSize;<br>
> mVideoOutStream->codec->time_base.den = mVideoOutStream->time_base.den;<br>
> mVideoOutStream->codec->time_base.num = mVideoOutStream->time_base.num;<br>
><br>
> EYE_ASSERT(mVideoOutStream);<br>
><br>
> if (mOutputFormatContext->oformat->flags & AVFMT_GLOBALHEADER)<br>
> {<br>
> mVideoOutStream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;<br>
> }<br>
><br>
> Every place I access '->codec->' the compiler says it's deprecated,and<br>
> the FFMPEG says<br>
> I have to use codecpar instead.But codecpar doesn't have those params.<br>
<br>
For demuxing/decoding:<br>
avcodec_parameters_to_context(codec_ctx, stream->codecpar);<br>
<br>
For muxing/encoding:<br>
avcodec_parameters_from_context(stream->codecpar, codec_ctx);<br>
<br>
Documentation for these functions can be found here:<br>
<a href="https://www.ffmpeg.org/doxygen/trunk/group__lavc__core.html" rel="noreferrer" target="_blank">https://www.ffmpeg.org/doxygen/trunk/group__lavc__core.html</a><br>
<br>
doc/examples/transcoding.c shows how to use both.<br>
<br>
> What do I do in this case? Create explicitly codec context and assign it<br>
> to the stream? Looks like newer API has some design gaps > Thanks.<br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<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/listinfo/libav-user</a><br>
><br>
<br>
--<br>
Philippe Gorley<br>
Free Software Consultant | Montréal, Qc<br>
Savoir-faire Linux<br>
<br>
Confidentiality Message: This communication (including any files<br>
transmitted with it) is intended solely for the person or entity to<br>
whom it is addressed, and may contain confidential or privileged<br>
information.<br>
The disclosure, distribution or copying of this message is strictly<br>
forbidden. Should you have received this communication in error,<br>
kindly contact the sender promptly, destroy any copies and delete<br>
this message from your computer system.<br>
_______________________________________________<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/listinfo/libav-user</a><br>
</blockquote></div></blockquote></div>