[Libav-user] Custom data in AVPacket or AVFrame
Dan Egnor
egnor at ofb.net
Tue Feb 15 17:38:53 EET 2022
(What a gruff answer!)
Caveat: I'm no expert, I'm also bumbling my way into this world, but:
My understanding is that the packet "side data" and the frame "side data"
are distinct universes, one is not copied to the other, which is why the
approach you're trying doesn't work.
You might look into the "reordered_opaque" field. It's an opaque int64_t. I
THINK the way it works is you set it in AVCodecContext before
av_send_packet and then read it out of AVFrame. The "reordered_" is a
reminder that packets and frames don't happen in the same order. I haven't
actually used this!! I don't know if it actually works like that!!
Otherwise I THINK you're down to having your own table on the side indexed
by timestamp (either pts or dts) which has the advantage of being entirely
independent of libavcodec and its vagaries.
To echo the gruff answer below, if you convey your larger goal, there may
be other creative solutions...??
Good luck,
-- egnor
On Tue, Feb 15, 2022, 5:53 AM Nicolas George <george at nsup.org> wrote:
> laddoe (12022-02-15):
> > I want to add a custom number to either an AVFame or an AVPacket
> > before I encode it and I want to retrieve it back when I decode it. I
> > have tried using the AVFrame/AVPacket metadata or side_data but I
> > guess I don't understand how to get it to work.
>
> Since you want your data to be carried from encoder to decoder, it needs
> to be present in the encoded output, either in the bitstream code or at
> container level.
>
> Therefore, you must first choose a codec or a format that allows to
> store arbitrary user data on a per-frame basis. This is not specific to
> FFmpeg. You will need one that meets your other constraints, which you
> have not stated.
>
> Then you must make sure FFmpeg supports the per-frame data for this
> container or codec.
>
> You gave very little information on what you want to achieve. Odds are
> you do not really need this at all.
>
> Regards,
>
> --
> Nicolas George
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220215/449ea346/attachment.htm>
More information about the Libav-user
mailing list