[Libav-user] av_packet_get_side_data() not working

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] av_packet_get_side_data() not working

rohit khali
Hi,

I am using av_parser_parse2() to construct one H264 frame.
av_parser_parse2(parser, c, &pkt->data, &pkt->size,
                                   data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
                                   
Now, I am trying to use the below code to extract AV_PKT_DATA_A53_CC data. However av_packet_get_side_data() is unable to detect the presence of CC present in the pkt,
                //Extract side_data
                uint8_t *streaminfo;
                int streaminfo_size;
                /* check for updated streaminfo */
                //
                streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_A53_CC,
                                                    &streaminfo_size);
                if (streaminfo && streaminfo_size) {
                    printf("AV_PKT_DATA_A53_CC found \n");
                }
At the same time, av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC) works fine.

Any idea, what am I missing in above code?

Thanks,
Rohit Khali

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: av_packet_get_side_data() not working

Nicolas George
rohit khali (12020-06-23):

> I am using av_parser_parse2() to construct one H264 frame.
> av_parser_parse2(parser, c, &pkt->data, &pkt->size,
>                                    data, data_size, AV_NOPTS_VALUE,
> AV_NOPTS_VALUE, 0);
>
> Now, I am trying to use the below code to extract AV_PKT_DATA_A53_CC data.
> However av_packet_get_side_data() is unable to detect the presence of CC
> present in the pkt,
>                 //Extract side_data
>                 uint8_t *streaminfo;
>                 int streaminfo_size;
>                 /* check for updated streaminfo */
>                 //
>                 streaminfo = av_packet_get_side_data(pkt,
> AV_PKT_DATA_A53_CC,
>                                                     &streaminfo_size);
>                 if (streaminfo && streaminfo_size) {
>                     printf("AV_PKT_DATA_A53_CC found \n");
>                 }
> At the same time, av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC) works
> fine.
>
> Any idea, what am I missing in above code?
The side data is not present in the packet, the closed captions are
encoded in the bitstream, it needs to be decoded.

Regards,

--
  Nicolas George


_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: av_packet_get_side_data() not working

rohit khali

Thanks a lot for the response !
In that case what is the use of pkt->side_data_elems and av_packet_get_side_data() itself. Documetnation clearly says this API "Gets side information from packet."
I am not intrested in decoded CC, I just need to store 'encoded' CC data into my own buffers. Is there any other way to do it so? 

Regards,
Rohit Khali

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: av_packet_get_side_data() not working

Nicolas George
rohit khali (12020-06-23):
> In that case what is the use of pkt->side_data_elems and
> av_packet_get_side_data() itself.

It is for when the packet does contain side data, like the output of the
Decklink device.

> Documetnation clearly says this API "Gets side information from packet."

Please be more accurate when pointing a snippet of documentation.

I cannot help you more because I have no idea what you are trying to
achieve. You did not even tell if you were decoding, encoding or
something else.

Regards,

--
  Nicolas George

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: av_packet_get_side_data() not working

rohit khali

Thanks !
Sorry, my bad ! Let's start with this beginning to understand what am I trying to acheive here.

I am working on an application  which will decode only I frames(HEVC,AVC,MPEG2) however will do that parsing for each frame (I/P/B).

Parsing means, along with metadata I also need to get access to encoded user data containing CC/AFD/etc (if present). Basically anything present as part of 
enum AVPacketSideDataType
 mentioned in  https://ffmpeg.org/doxygen/3.4/group__lavc__packet.html#ga9a80bfcacc586b483a973272800edb97

Later, I'll decode this user-data "ONLY" externally for P/B frames.

Let's focus on H264 for now. My input H264 stream has EI608/EIA-708 in the sei-> user data section. And I have parsed a complete frame using av_parser_parse2().
Shall I not expect pkt->side_data_elems to be updated even though I know CC data is there for sure?
I was expecting that after using av_packet_get_side_data() for type AV_PKT_DATA_A53_CC , I will get access to encoded CC data. 
Is something wrong with my understanding of side data here?

Regards,
Rohit Khali




_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: av_packet_get_side_data() not working

Nicolas George
rohit khali (12020-06-23):
> Shall I not expect pkt->side_data_elems to be updated even though I know CC
> data is there for sure?

No. The CC data embedded in the H.264 bitstream is separated by the
decoder, no other piece of code in FFmpeg does it.

Also, IIRC, CC data is reordered with B-frames, which is stupid (yet
another industrial decision) but makes it very difficult to handle
without a significant part of decoding.

Regards,

--
  Nicolas George

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment