<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have not used "<span style="font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">valgrind"
I will need to look into that tool. any tips on how to use it?</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">yes, I am free the all contexts
before reallocation but I cannot find a way to for the FLVContext/Muxer to be freed/reinitialized thru the API.</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">I am doing the following:</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">
<p style="background-color:rgb(255, 255, 255);font-size:11pt;font-family:Calibri, sans-serif;margin:0px 0px 8pt;line-height:15.6933px">
avcodec_free_context() of all streams video and audio </p>
<p style="background-color:rgb(255, 255, 255);font-size:11pt;font-family:Calibri, sans-serif;margin:0px 0px 8pt;line-height:15.6933px">
<span style="font-family: Calibri, sans-serif; font-size: 11pt;">avformat_free_context() </span></p>
<p style="background-color:rgb(255, 255, 255);font-size:11pt;font-family:Calibri, sans-serif;margin:0px 0px 8pt;line-height:15.6933px">
avio_close() </p>
<br>
</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Libav-user <libav-user-bounces@ffmpeg.org> on behalf of Paul B Mahol <onemda@gmail.com><br>
<b>Sent:</b> Wednesday, March 3, 2021 5:54 AM<br>
<b>To:</b> This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user@ffmpeg.org><br>
<b>Subject:</b> Re: [Libav-user] Reuse of format context after free and reallocate?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr"><br>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_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="x_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="x_gmail-m_8628966046779895580appendonsend"></div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_8628966046779895580divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><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="x_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>
</div>
</body>
</html>