How can I deserialize codec_data from h.264 (avc) caps

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

How can I deserialize codec_data from h.264 (avc) caps

David Ing
I can't figure out how to deserialize the codec_data within a caps structure like this one:

video/x-h264
stream-format=(string)avc
alignment=(string)au
level=(string)4.2
profile=(string)main
codec_data=(buffer)014d402affe10029674d402a965403c0113f2e02d404040500000300010000030032e04000fa000005dc026a540ed0913501000468ce3520
width=(int)1920
height=(int)1080
framerate=(fraction)25/1
pixel-aspect-ratio=(fraction)1/1
interlace-mode=(string)progressive, parsed=(boolean)true

Can someone point me in the right direction?

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I deserialize codec_data from h.264 (avc) caps

Nicolas Dufresne-5
Le jeudi 06 septembre 2018 à 14:25 -0700, David Ing a écrit :

> I can't figure out how to deserialize the codec_data within a caps
> structure like this one:
>
> video/x-h264
> > stream-format=(string)avc
> > alignment=(string)au
> > level=(string)4.2
> > profile=(string)main
> > codec_data=(buffer)014d402affe10029674d402a965403c0113f2e02d4040405
> > 00000300010000030032e04000fa000005dc026a540ed0913501000468ce3520

I believe this is just hex representation of the bytes, isn't it ? From
API point of view, gst_caps_from_string() will handle this. I believe
we use a GValue transform to do string to GstBuffer, and have a handle
for that transform registered into GLib.

> > width=(int)1920
> > height=(int)1080
> > framerate=(fraction)25/1
> > pixel-aspect-ratio=(fraction)1/1
> > interlace-mode=(string)progressive, parsed=(boolean)true
> >
> Can someone point me in the right direction?
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I deserialize codec_data from h.264 (avc) caps

David Ing
Yes, it is just a hex representation of a byte array.

To clarify my question:  How can I extract the information from the byte array?

I found some code inside gst-plugins-bad (gsth264parse.c) that seems like it might work.  I am probably going to hack something together from that (unless anyone knows of a better solution).

On Thu, Sep 6, 2018 at 4:44 PM Nicolas Dufresne <[hidden email]> wrote:
Le jeudi 06 septembre 2018 à 14:25 -0700, David Ing a écrit :
> I can't figure out how to deserialize the codec_data within a caps
> structure like this one:
>
> video/x-h264
> > stream-format=(string)avc
> > alignment=(string)au
> > level=(string)4.2
> > profile=(string)main
> > codec_data=(buffer)014d402affe10029674d402a965403c0113f2e02d4040405
> > 00000300010000030032e04000fa000005dc026a540ed0913501000468ce3520

I believe this is just hex representation of the bytes, isn't it ? From
API point of view, gst_caps_from_string() will handle this. I believe
we use a GValue transform to do string to GstBuffer, and have a handle
for that transform registered into GLib.

> > width=(int)1920
> > height=(int)1080
> > framerate=(fraction)25/1
> > pixel-aspect-ratio=(fraction)1/1
> > interlace-mode=(string)progressive, parsed=(boolean)true
> >
> Can someone point me in the right direction?
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I deserialize codec_data from h.264 (avc) caps

Nicolas Dufresne-5
Le jeudi 06 septembre 2018 à 17:54 -0700, David Ing a écrit :
> Yes, it is just a hex representation of a byte array.
>
> To clarify my question:  How can I extract the information from the
> byte array?
>
> I found some code inside gst-plugins-bad (gsth264parse.c) that seems
> like it might work.  I am probably going to hack something together
> from that (unless anyone knows of a better solution).

If you want to parse the H264 Codec data, you can use the H264 parser
library in -bad. The codec data contains PPS and SPS nals. You'll have
to iterate over the AVC nals, and parse them base on their type.

>
> On Thu, Sep 6, 2018 at 4:44 PM Nicolas Dufresne <[hidden email]
> > wrote:
> > Le jeudi 06 septembre 2018 à 14:25 -0700, David Ing a écrit :
> > > I can't figure out how to deserialize the codec_data within a
> > caps
> > > structure like this one:
> > >
> > > video/x-h264
> > > > stream-format=(string)avc
> > > > alignment=(string)au
> > > > level=(string)4.2
> > > > profile=(string)main
> > > >
> > codec_data=(buffer)014d402affe10029674d402a965403c0113f2e02d4040405
> > > >
> > 00000300010000030032e04000fa000005dc026a540ed0913501000468ce3520
> >
> > I believe this is just hex representation of the bytes, isn't it ?
> > From
> > API point of view, gst_caps_from_string() will handle this. I
> > believe
> > we use a GValue transform to do string to GstBuffer, and have a
> > handle
> > for that transform registered into GLib.
> >
> > > > width=(int)1920
> > > > height=(int)1080
> > > > framerate=(fraction)25/1
> > > > pixel-aspect-ratio=(fraction)1/1
> > > > interlace-mode=(string)progressive, parsed=(boolean)true
> > > >
> > > Can someone point me in the right direction?
> > > _______________________________________________
> > > gstreamer-devel mailing list
> > > [hidden email]
> > > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel