[Libav-user] Can not delete video file while program is running
Kevin J. Brooks
kbrooks at r2c-ss.com
Wed Nov 4 20:41:57 CET 2015
Baris,
Thank you for your help.
Sincerely,
Kevin J. Brooks
Senior Software Engineer
On 11/4/2015 2:40 AM, Baris Demiray wrote:
>
> 2015-11-03 23:15 GMT+01:00 Kevin J. Brooks <kbrooks at r2c-ss.com
> <mailto:kbrooks at r2c-ss.com>>:
>
> Hello All,
>
> I have a program that the user can start and stop recording video
> at their will. Each time the user starts recording, the video is
> saved to a new file. The problem is if the user decides to delete
> a newly created video without shutting down my program first, then
> he is unable to do so. Windows tells the user that my program
> still has the file open. Here is my code when the user stops
> recording.
>
> av_write_trailer(m_oc);
>
>
> avcodec_close(m_videoCodecCTX);
>
> avcodec_close(m_audioCodecCTX);
>
> sws_freeContext(m_video_st.sws_ctx);
>
> avformat_free_context(m_oc);
>
> av_frame_free(&m_videoPicture);
>
>
> What am I missing?
>
>
> These are mostly about releasing the memory resources. How do you open
> the video file? You may need avio_close() if you used avio_open(), or
> standard file closure methods if you're handling it yourself.
>
> Also, AFAIK you don't need keep your conversation context that long,
> you can release it right after sws_scale() is done.
>
>
> Thanks,
> Kevin
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org>
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20151104/bd9112e4/attachment.html>
More information about the Libav-user
mailing list