[Libav-user] Question regarding the fd protocol & av_open2
Kristina Rylander
Kristina.Rylander at axis.com
Mon Jan 20 11:08:38 EET 2025
Hi,
I have an open fd which has a specific file position (>0) and I provide that in the options dictionary for avio_open2. My assumption was that when writing with av_interleaved_write_frame it would start at the same position as the given fd has. But it always starts at 0. Looking into the code for avio_open2 I can see that there is a seek set to 0 last in ffurl_connect. So I was wondering how this is supposed to work if you don't want to start at 0. Should I control the starting position with avio_skip after avio_open2 or is there a better way to do this? And would this work for different formats, i.e. matroska, mp4, cmaf? Or is there some reason that the file position must be 0?
Just some calls to illustrate:
avformat_alloc_output_context2(&oc, NULL, container_format, filename);
av_dict_set(&file_opts, "fd", "fd_no", 0);
avio_open2(&oc->pb, "fd:", AVIO_FLAG_READ | AVIO_FLAG_WRITE, NULL, &file_opts)
avio_skip(oc->pb, filepos) // would this work for e.g. mp4?
...then several...
av_interleaved_write_frame(oc, pkt)
...
Thanks!
Br, Kristina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20250120/dba75b7f/attachment.htm>
More information about the Libav-user
mailing list