On Thu, Mar 4, 2021 at 3:42 AM william keeling <[email protected]> wrote:
> Again, Thanks for your input -- never said the code was bug free or even > not buggy -- but I do know the free of all the context listed are being > called and other than avformat_free_context() which has no way to check it > worked (not sure way it was written like that) are validated. > > code is here https://github.com/wkeeling63/racecam > > Please let me know if you have any ideas > Hmm, If I free and allocate avformat context with code from examples/muxing.c it works fine writing to flv twice. Perhaps you do not reset some variables when writing 2nd file? > > Thanks > > ------------------------------ > *From:* Libav-user <[email protected]> on behalf of Paul B > Mahol <[email protected]> > *Sent:* Wednesday, March 3, 2021 1:28 PM > *To:* This list is about using libavcodec, libavformat, libavutil, > libavdevice and libavfilter. <[email protected]> > *Subject:* Re: [Libav-user] Reuse of format context after free and > reallocate? > > > > On Wed, Mar 3, 2021 at 8:26 PM william keeling <[email protected]> > wrote: > > thanks for you input -- I am freeing all context and still get the errors > as if FLVContext is not freed > > > Than show actual code, It must be buggy. > > > ------------------------------ > *From:* Libav-user <[email protected]> on behalf of Paul B > Mahol <[email protected]> > *Sent:* Wednesday, March 3, 2021 11:21 AM > *To:* This list is about using libavcodec, libavformat, libavutil, > libavdevice and libavfilter. <[email protected]> > *Subject:* Re: [Libav-user] Reuse of format context after free and > reallocate? > > > > On Wed, Mar 3, 2021 at 5:50 PM william keeling <[email protected]> > wrote: > > I have not used "valgrind" I will need to look into that tool. any tips > on how to use it? > > > If you are on Linux, using it is very easy. > > > > 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. > I am doing the following: > > avcodec_free_context() of all streams video and audio > > avformat_free_context() > > avio_close() > > > If you really do all this than that error would never happen. > > > > ------------------------------ > *From:* Libav-user <[email protected]> on behalf of Paul B > Mahol <[email protected]> > *Sent:* Wednesday, March 3, 2021 5:54 AM > *To:* This list is about using libavcodec, libavformat, libavutil, > libavdevice and libavfilter. <[email protected]> > *Subject:* Re: [Libav-user] Reuse of format context after free and > reallocate? > > > > On Wed, Mar 3, 2021 at 5:22 AM william keeling <[email protected]> > wrote: > > I did some digging and found the error is coming from this code in > flvenv.c line 921. > > if (pkt->dts < -flv->delay) { > av_log(s, AV_LOG_WARNING, > "Packets are not in the proper order with respect to > DTS\n"); > return AVERROR(EINVAL); > > flv is a pointer to FLVContext from AVFormatContext->priv_data. > > 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. > 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. > ------------------------------ > *From:* Libav-user <[email protected]> on behalf of william > keeling <[email protected]> > *Sent:* Monday, March 1, 2021 2:32 PM > *To:* [email protected] <[email protected]> > *Subject:* [Libav-user] Reuse of format context after free and reallocate? > > > 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. > > After each stream I free and reallocate all contexts: > > avcodec_free_context() of all streams video and audio > > avformat_free_context() > > avio_close() > > > > What am I missing so the format context can be reallocate and used? > > > Looks like to be real bug to me. > > > > > Thanks William > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". > > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". > > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". > > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe".
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
