VAAPI: How to reduce fps of decoded video being copied out of graphics memory?

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

VAAPI: How to reduce fps of decoded video being copied out of graphics memory?

kmliu
I'm trying to use VAAPI to decode H.264 video from an IP camera and then
export the raw frames out of graphics memory to main memory for some
unspecified "further processing". Say the H.264 is 30fps but I only want to
process 10fps. I can do something like this:

gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
videorate ! "video/x-raw,framerate=10/1" ! filesink location=video.yuv

But this seems to first copy all 30fps from graphics memory and then lower
it to 10fps. How can I reduce the fps of raw frames being copied out of
graphics memory in the first place (to reduce memory bandwidth consumption)?

I have also tried this:

gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
"video/x-raw,framerate=10/1" ! filesink location=video.yuv

and this:

gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
"video/x-raw(memory:VASurface),framerate=10/1" ! filesink location=video.yuv

Neither seems to work. They both have the WARN message "GST_PADS:
gst-pad.c:4226:gst_pad_peer_query:<vaapidecode_h264-0:src> could not send
sticky events". And the output file video.yuv is empty.




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

Re: VAAPI: How to reduce fps of decoded video being copied out of graphics memory?

junyan.he
The videorate plugin seems just have transform_ip function and just
transform gstbuffer in place, will not copy the buffers. So it seems
will not generate copying memory from GPU(Graphic) to CPU. Are you sure
the memory copy generated?


On 四, 2019-08-01 at 18:24 -0500, kmliu wrote:

> I'm trying to use VAAPI to decode H.264 video from an IP camera and
> then
> export the raw frames out of graphics memory to main memory for some
> unspecified "further processing". Say the H.264 is 30fps but I only
> want to
> process 10fps. I can do something like this:
>
> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay !
> vaapih264dec !
> videorate ! "video/x-raw,framerate=10/1" ! filesink
> location=video.yuv
>
> But this seems to first copy all 30fps from graphics memory and then
> lower
> it to 10fps. How can I reduce the fps of raw frames being copied out
> of
> graphics memory in the first place (to reduce memory bandwidth
> consumption)?
>
> I have also tried this:
>
> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay !
> vaapih264dec !
> "video/x-raw,framerate=10/1" ! filesink location=video.yuv
>
> and this:
>
> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay !
> vaapih264dec !
> "video/x-raw(memory:VASurface),framerate=10/1" ! filesink
> location=video.yuv
>
> Neither seems to work. They both have the WARN message "GST_PADS:
> gst-pad.c:4226:gst_pad_peer_query:<vaapidecode_h264-0:src> could not
> send
> sticky events". And the output file video.yuv is empty.
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> 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
|

AW: VAAPI: How to reduce fps of decoded video being copied out of graphics memory?

Thornton, Keith
In reply to this post by kmliu
Hi,
I Think you will find that all decoders have to decode all the frames. Afterwards you could put a pad_probe on the decoders video src pad and drop two out of three frames
Grüße

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel <[hidden email]> Im Auftrag von kmliu
Gesendet: Freitag, 2. August 2019 01:25
An: [hidden email]
Betreff: VAAPI: How to reduce fps of decoded video being copied out of graphics memory?

I'm trying to use VAAPI to decode H.264 video from an IP camera and then export the raw frames out of graphics memory to main memory for some unspecified "further processing". Say the H.264 is 30fps but I only want to process 10fps. I can do something like this:

gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
videorate ! "video/x-raw,framerate=10/1" ! filesink location=video.yuv

But this seems to first copy all 30fps from graphics memory and then lower it to 10fps. How can I reduce the fps of raw frames being copied out of graphics memory in the first place (to reduce memory bandwidth consumption)?

I have also tried this:

gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
"video/x-raw,framerate=10/1" ! filesink location=video.yuv

and this:

gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
"video/x-raw(memory:VASurface),framerate=10/1" ! filesink location=video.yuv

Neither seems to work. They both have the WARN message "GST_PADS:
gst-pad.c:4226:gst_pad_peer_query:<vaapidecode_h264-0:src> could not send sticky events". And the output file video.yuv is empty.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
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: VAAPI: How to reduce fps of decoded video being copied out of graphics memory?

Nicolas Dufresne-5
In reply to this post by kmliu
Le jeudi 01 août 2019 à 18:24 -0500, kmliu a écrit :

> I'm trying to use VAAPI to decode H.264 video from an IP camera and then
> export the raw frames out of graphics memory to main memory for some
> unspecified "further processing". Say the H.264 is 30fps but I only want to
> process 10fps. I can do something like this:
>
> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
> videorate ! "video/x-raw,framerate=10/1" ! filesink location=video.yuv
>
> But this seems to first copy all 30fps from graphics memory and then lower
> it to 10fps. How can I reduce the fps of raw frames being copied out of
> graphics memory in the first place (to reduce memory bandwidth consumption)?

The download is unrelated to videorate, to save VASurface to disk,
there is no choice but to untile the frames, which is a slow path. In
general, with special memory type, you should use drop-only=1 property
of videorate. Here's an working example I have tested for you:

gst-launch-1.0 filesrc location=bbb_sunflower_2160p_60fps_normal.mp4 ! parsebin ! h264parse \
  ! vaapih264dec ! videorate drop-only=1 ! video/x-raw\(memory:VASurface\),framerate=10/1 \
  ! vaapipostproc ! glimagesink

>
> I have also tried this:
>
> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
> "video/x-raw,framerate=10/1" ! filesink location=video.yuv
>
> and this:
>
> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay ! vaapih264dec !
> "video/x-raw(memory:VASurface),framerate=10/1" ! filesink location=video.yuv

VASurface cannot be written to disk directly as they cannot be mapped.

>
> Neither seems to work. They both have the WARN message "GST_PADS:
> gst-pad.c:4226:gst_pad_peer_query:<vaapidecode_h264-0:src> could not send
> sticky events". And the output file video.yuv is empty.
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> 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: VAAPI: How to reduce fps of decoded video being copied out of graphics memory?

kmliu
In reply to this post by junyan.he
I think you may be right. There is apparently no copying if I use "videorate
max-rate=10".



junyan.he wrote

> The videorate plugin seems just have transform_ip function and just
> transform gstbuffer in place, will not copy the buffers. So it seems
> will not generate copying memory from GPU(Graphic) to CPU. Are you sure
> the memory copy generated?
>
>
> On 四, 2019-08-01 at 18:24 -0500, kmliu wrote:
>> I'm trying to use VAAPI to decode H.264 video from an IP camera and
>> then
>> export the raw frames out of graphics memory to main memory for some
>> unspecified "further processing". Say the H.264 is 30fps but I only
>> want to
>> process 10fps. I can do something like this:
>>
>> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay !
>> vaapih264dec !
>> videorate ! "video/x-raw,framerate=10/1" ! filesink
>> location=video.yuv
>>
>> But this seems to first copy all 30fps from graphics memory and then
>> lower
>> it to 10fps. How can I reduce the fps of raw frames being copied out
>> of
>> graphics memory in the first place (to reduce memory bandwidth
>> consumption)?
>>
>> I have also tried this:
>>
>> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay !
>> vaapih264dec !
>> "video/x-raw,framerate=10/1" ! filesink location=video.yuv
>>
>> and this:
>>
>> gst-launch-1.0 rtspsrc location=rtsp_uri ! rtph264depay !
>> vaapih264dec !
>> "video/x-raw(memory:VASurface),framerate=10/1" ! filesink
>> location=video.yuv
>>
>> Neither seems to work. They both have the WARN message "GST_PADS:
>> gst-pad.c:4226:gst_pad_peer_query:
> <vaapidecode_h264-0:src>
>  could not
>> send
>> sticky events". And the output file video.yuv is empty.
>>
>>
>>
>>
>> --
>> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
>> _______________________________________________
>> gstreamer-devel mailing list
>>

> gstreamer-devel@.freedesktop

>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list

> gstreamer-devel@.freedesktop

> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel