How to use VA-API in gstreamer?

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

How to use VA-API in gstreamer?

CC
Hi,

I find the software h264 encode and decode will cause high cpu usage, so I want to use VA-API..

This is my origin command using avdec_h264 and x264enc.

gst-launch-1.0 -v udpsrc port=12347 ! application/x-rtp,payload=107,encoding-name=H264 ! rtph264depay ! video/x-h264, framerate=30/1 ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw, width=640, height=480 ! queue ! videoconvert ! queue ! x264enc bitrate=1000 key-int-max=60 bframes=0 byte-stream=false aud=true tune=zerolatency ! h264parse ! video/x-h264,profile=main ! queue ! mux. udpsrc port=12345 ! application/x-rtp,payload=111,encoding-name=OPUS,clock-rate=48000, channels=2 ! rtpopusdepay ! opusparse ! opusdec ! queue ! voaacenc bitrate=128000 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw ! queue ! flvmux streamable=true name=mux ! queue ! rtmpsink location=rtmp://192.168.1.165:1935/myapp/testav

I try to replace  avdec_h264 and x264enc with  vaapih264dec and vaapih264enc. But it seems not working.

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: How to use VA-API in gstreamer?

Victor Jaquez
On 06/30/17 at 01:15am, CC wrote:

> Hi,
>
> I find the software h264 encode and decode will cause high cpu usage, so I
> want to use  VA-API.
> <https://gstreamer.freedesktop.org/modules/gstreamer-vaapi.html>  .
>
> This is my origin command using avdec_h264 and x264enc.
>
> gst-launch-1.0 -v udpsrc port=12347 !
> application/x-rtp,payload=107,encoding-name=H264 ! rtph264depay !
> video/x-h264, framerate=30/1 ! h264parse ! avdec_h264 ! videoconvert !
> videoscale ! video/x-raw, width=640, height=480 ! queue ! videoconvert !
> queue ! x264enc bitrate=1000 key-int-max=60 bframes=0 byte-stream=false
> aud=true tune=zerolatency ! h264parse ! video/x-h264,profile=main ! queue !
> mux. udpsrc port=12345 !
> application/x-rtp,payload=111,encoding-name=OPUS,clock-rate=48000,
> channels=2 ! rtpopusdepay ! opusparse ! opusdec ! queue ! voaacenc
> bitrate=128000 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw !
> queue ! flvmux streamable=true name=mux ! queue ! rtmpsink
> location=rtmp://192.168.1.165:1935/myapp/testav
>
> I try to replace  avdec_h264 and x264enc with  vaapih264dec and
> vaapih264enc. But it seems not working.

What's the error?

Using videoconvert and videoscale with vaapi is a bad idea, is better to
use vaapipostproc.

And the parameters of x264enc are different from the vaapih264enc, it is not a
1:1 replacement.

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

Re: How to use VA-API in gstreamer?

CC
Thanks for your reply.

I try to replace x264enc with vaapih264enc, i got a warning(WARNING: Input ref list is Wrong !) , but it works and the cpu usage is reduced.

And when I replace avdec_h264 with vaapih264dec , i got an error.

The error log :
https://gist.github.com/zombiecong/fcb94a15d704081b6db284978afb9754

Reply | Threaded
Open this post in threaded view
|

Re: How to use VA-API in gstreamer?

Hyunjun Ko
CC wrote
Thanks for your reply.

I try to replace x264enc with vaapih264enc, i got a warning(WARNING: Input ref list is Wrong !) , but it works and the cpu usage is reduced.

And when I replace avdec_h264 with vaapih264dec , i got an error.

The error log :
https://gist.github.com/zombiecong/fcb94a15d704081b6db284978afb9754
Working here on the master. Could you try with ther new version at least 1.12, which is the latest stable version.

My test pipelines to make the pipeline working:
gst-launch-1.0 videotestsrc ! vaapih264enc ! rtph264pay ! udpsink port=12347
gst-launch-1.0 audiotestsrc ! opusenc ! rtpopuspay ! udpsink port=12345


In addition, please show full log of vaapi elements in this case. (eg. GST_DEBUG=vaapi*:6,2) :)

CC
Reply | Threaded
Open this post in threaded view
|

Re: How to use VA-API in gstreamer?

CC
There is no problem with vaapih264enc ,  the error is caused by replacing "avdec_h264" with "vaapih264dec"  .   And I use the latest release stable version of gstreamer(1.12.1).

The error log after setting "GST_DEBUG=vaapi*:6,2" :

https://gist.github.com/zombiecong/9e471bef3f3679dbe28d7fa98446b7b8

Thanks for your help!
Reply | Threaded
Open this post in threaded view
|

Re: How to use VA-API in gstreamer?

Hyunjun Ko
Ah, the profile of h264 stream of your source from udpsrc is "baseline", which is not supported on gst-vaapi decoder. vaapi decoder supports constrained-baseline profile instead of it.

If you can try with other profiles of h264 stream between { constrained-profile, main, high }, you should be successfull.
If not, I think you should try other decoder unfortunately.
CC
Reply | Threaded
Open this post in threaded view
|

Re: How to use VA-API in gstreamer?

CC
Thank you very much , I change the source and it works now!
Reply | Threaded
Open this post in threaded view
|

Re: How to use VA-API in gstreamer?

horai
In reply to this post by CC
Actually, I am trying to use vaapih264dec as well. It works good this way,
but I experience problem trying to integrate it.
http://gstreamer-devel.966125.n4.nabble.com/VAAPI-clutter-td4685837.html

On the other hand, assuming avdec_h264 is a gstreamer library, wrapper,
whatever to libav library
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-libav-plugins/html/gst-libav-plugins-plugin-libav.html
or codecs. And according to this:
https://wiki.libav.org/Hardware/vaapi
Could it be possible that when using avdec_h264, could avdec_h264 be in
theory also accelerated via VAAPI?
I have very low CPU usage when using avdec_h264 on latest Debian.



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