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

Nicolas Dufresne nicolas at ndufresne.ca
Fri Aug 2 12:00:43 UTC 2019


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
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list