[Libav-user] How to get the byte position of a just written av_write_frame?

MSC_Edge mczarnek at edge360.com
Tue Jan 28 23:56:59 EET 2020


Hope no one minds me posting twice, different topic this time. Since there
appears to be an ffmpeg error with writing out segmented flv files, I
decided to do what the ffmpeg was doing using command line by myself in
code. Especially since for our project we need to store an index of
key-frames associated with the flv file for fast access of frames during
playback.

So, I can get the 'pos' of an AVPacket that has been read from a file using
av_read_frame.

However, I can't get the 'pos' of the AVPacket that has just been written
using av_write_frame.

I've tried looking for callbacks, looking at the packet itself, looking at
the AVFormatContext, AVIO, AVStream, etc. And I can't find a way to do it.
Would be really nice if av_write_frame would set the new pos after writing
the packet to the file.

If I try to use avformat_open_input to open the same file that's already
open for writing, it throws an error: "Invalid data found when processing
input".  This still happens even if I write the head, first packet, and
flush too.

Anyone know how to do this in real time like I'd like to do? Or do I need to
work around it?



--
Sent from: http://libav-users.943685.n4.nabble.com/


More information about the Libav-user mailing list