How to use vaapi to accelerate video coding?
I want to hard-code the video by gstreamer-vaapi but failed. Here is my system environment and modify:
-
ubuntu 16.04 desktop
-
apt install gstreamer1.0-vaapi libgstreamer1.0-dev gstreamer1.0-tools gstreamer1.0-plugins-base libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav
3.Modify server/reds.c
default_video_codecs[] = "gstreamer:h264;"
Modify server/gstreamer-encoder.c
case SPICE_VIDEO_CODEC_TYPE_H264: return "vaapih264enc";
case SPICE_VIDEO_CODEC_TYPE_H264: gstenc_opts = g_strdup("");
When I play the video, the /var/log/libvirt/qemu/win7.log output: gstreamer-encoder.c:831:handle_pipline_message: GStreamer error from element encoder: Could not initialize supporting library. gstreamer-encoder.c:1122:configure_pipline: Gstreamer error: unable to set the pipeline to the playing state.
when I set GST_DEBUG=2 , it will output videoencoder gstvideoencoder.c:1534:gst_video_encoder_change_state: error: Failed to open encoder.
In addition,When I build spice and kvm in the same way as Ubuntu18.04 The log report "gstreamer-encoder.c:985:create_pipeline: GStreamer error: no element "vaapih264enc" " , but I check "gst-inspect-1.0 , vaapih264enc", it exists.
What did I do wrong or what else do I need to set? Looking forward to your reply. Thank you!