[Libav-user] Custom data in AVPacket or AVFrame

Brad Hards bradh at frogmouth.net
Wed Feb 16 11:28:19 EET 2022


On Wednesday, 16 February 2022 8:16:17 PM AEDT laddoe wrote:
> Correction, I meant av_frame_new_side_data but it looks like the "side data"
> is not meant for that. I couldn't find the right documentation that would
> explain what the purpose is for the "side data" ( the same for
> AVPacketSideData). I also tried the metadata struct (AVDictionary) in the
> AVFrame struct but it did not work either.
We know it didn't work - you wouldn't be posting if it did.
However we have no idea what actually happened instead. We still don't know 
what version of the libraries you are using.

Here is an extract from a sample I used:

    AVFrame *frame;
    AVFrameSideData *side_data;
    // This is from MISB ST 2101
    char sei_message[] = {0xa5, 0x50, 0x52, 0xaf, 0x52, 0x16, 0x5f, 0x45,
                          0xa3, 0x18, 0x1c, 0xfc, 0x7a, 0xbb, 0xc2, 0x67,
                          0x01, 0x70, 0xF5, 0x92, 0xF0, 0x23, 0x73, 0x36,
                          0x4A, 0xF8, 0xAA, 0x91, 0x62, 0xC0, 0x0F, 0x2E,
                          0xB2, 0xDA, 0x16, 0xB7, 0x43, 0x41, 0x00, 0x08,
                          0x41, 0xA0, 0xBE, 0x36, 0x5B, 0x5A, 0xB9, 0x6A,
                          0x36, 0x45};

    side_data = av_frame_new_side_data(frame, AV_FRAME_DATA_SEI_UNREGISTERED, 
sizeof(sei_message));
    if (!side_data)
    {
        fprintf(stderr, "Could not allocate the video frame side data\n");
        exit(1);
    }
    memcpy(side_data->data, sei_message, side_data->size);

If that doesn't work for you, please make a SSCCE (http://sscce.org/) of what 
you are doing, what you expected that code to do, and what happened instead.

Brad





More information about the Libav-user mailing list