<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 3, 2021 at 5:22 AM william keeling <<a href="mailto:williamkeeling@hotmail.com">williamkeeling@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I did some digging and found the error is coming from this code in flvenv.c line 921.
<div><br>
</div>
<div> if (pkt->dts < -flv->delay) {</div>
<div> av_log(s, AV_LOG_WARNING,</div>
<div> "Packets are not in the proper order with respect to DTS\n");</div>
<div> return AVERROR(EINVAL);</div>
<div><br>
</div>
<div>flv is a pointer to FLVContext from AVFormatContext->priv_data.<br>
</div>
<div><br>
</div>
<div>Looks like the avformat_write_header()/avformat_init_output uses the state of the muxer at the last run even if the AVFormatContext has been freed and reallocated.</div>
So how do I get the FLVContext to be initlized as if a fresh run. Or how do I free the old FLVContext so when avformat_write_header() initlizes the priv_data it is fresh.<br>
</div>
<div id="gmail-m_8628966046779895580appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_8628966046779895580divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Libav-user <<a href="mailto:libav-user-bounces@ffmpeg.org" target="_blank">libav-user-bounces@ffmpeg.org</a>> on behalf of william keeling <<a href="mailto:WilliamKeeling@hotmail.com" target="_blank">WilliamKeeling@hotmail.com</a>><br>
<b>Sent:</b> Monday, March 1, 2021 2:32 PM<br>
<b>To:</b> <a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a> <<a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a>><br>
<b>Subject:</b> [Libav-user] Reuse of format context after free and reallocate?</font>
<div> </div>
</div>
<div dir="ltr">
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
I have a program the creates flash format stream and is work the first time thru but when I process the second stream, I get DTS/PTS non monotonically errors. </p>
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
After each stream I free and reallocate all contexts: </p>
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
avcodec_free_context() of all streams video and audio </p>
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
avformat_free_context() </p>
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
avio_close() </p>
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
</p>
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
What am I missing so the format context can be reallocate and used? </p></div></div></blockquote><div><br></div><div>Looks like to be real bug to me.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
</p>
<p style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">
Thanks William </p>
</div>
</div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>