在我的 Ubuntu 20.04 机器中,我按照https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c上的官方文档安装了 gstreamer
然后我安装了以下内容:
$ sudo apt install va-driver-all gstreamer1.0-vaapi
但是当我尝试使用 vaapih265enc 时,管道失败了:
$ export GST_VAAPI_ALL_DRIVERS=1
$ gst-launch-1.0 filesrc location=output.mp4 ! h264parse ! vaapih264dec ! vaapih265enc rate-control=cbr bitrate=5000 ! video/x-h265,profile=main ! h265parse ! filesink location=output2.mp4
WARNING: erroneous pipeline: no element "vaapih265enc"
如果我检查插件,输出显示为:
$ gst-inspect-1.0 vaapi
Plugin Details:
Name vaapi
Description VA-API based elements
Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so
Version 1.16.2
License LGPL
Source module gstreamer-vaapi
Source release date 2019-12-03
Binary package gstreamer-vaapi
Origin URL http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer
vaapijpegdec: VA-API JPEG decoder
vaapimpeg2dec: VA-API MPEG2 decoder
vaapih264dec: VA-API H264 decoder
vaapivp8dec: VA-API VP8 decoder
vaapivp9dec: VA-API VP9 decoder
vaapih265dec: VA-API H265 decoder
vaapipostproc: VA-API video postprocessing
vaapidecodebin: VA-API Decode Bin
vaapisink: VA-API sink
vaapijpegenc: VA-API JPEG encoder
vaapih264enc: VA-API H264 encoder
11 features:
+-- 11 elements
当我 grep 库中的 h265 行时,我找到了编码器:
$ strings /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so | grep h265
gst_h265_parser_free
gst_h265_slice_hdr_free
gst_h265_parser_parse_vps
gst_h265_parser_parse_sps
gst_h265_parser_parse_pps
gst_h265_parser_parse_sei
gst_h265_parser_identify_nalu_hevc
gst_h265_parser_new
gst_h265_parser_parse_slice_hdr
gst_h265_parser_identify_nalu_unchecked
gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal
gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
vaapih265enc
video/x-h265
video/mpeg, mpegversion=2, systemstream=(boolean)false; video/mpeg, mpegversion=4; video/x-divx; video/x-xvid; video/x-h263; video/x-h264; video/x-h265; video/x-wmv; video/x-vp8; video/x-vp9;
video/mpeg, mpegversion=2, systemstream=(boolean)false; video/mpeg, mpegversion=4; video/x-divx; video/x-xvid; video/x-h263; video/x-h264; video/x-h265; video/x-wmv; video/x-vp8; video/x-vp9;
video/x-h265, stream-format = (string) { hvc1, byte-stream }, alignment = (string) au
../../../gst/vaapi/gstvaapiencode_h265.c
gst_vaapiencode_h265_set_config
_h265_byte_stream_next_nal
_h265_convert_byte_stream_to_hvc
gst_vaapiencode_h265_alloc_buffer
video/x-h265, stream-format = (string) { hvc1, byte-stream }, alignment = (string) au, profile = (string) { main, main-10 }
../../../../gst-libs/gst/vaapi/gstvaapiutils_h265.c
gst_vaapi_utils_h265_get_chroma_format_idc
gst_vaapi_utils_h265_get_chroma_type
gst_vaapi_utils_h265_get_level
gst_vaapi_utils_h265_get_profile_idc
gst_vaapi_utils_h265_get_profile
../../../../gst-libs/gst/vaapi/gstvaapidecoder_h265.c
gst_vaapi_decoder_h265_set_alignment
gst_vaapi_decoder_h265_parse
gst_vaapi_decoder_h265_decode_codec_data
gst_vaapi_encoder_h265_get_profile_tier_level
gst_vaapi_encoder_h265_set_max_profile
gst_vaapi_encoder_h265_reconfigure
gst_vaapi_encoder_h265_reordering
gst_vaapi_encoder_h265_encode
gst_vaapi_encoder_h265_get_codec_data
gst_vaapi_encoder_h265_get_pending_reordered
../../../../gst-libs/gst/vaapi/gstvaapiencoder_h265.c
我该怎么做才能使其可用于 gstreamer?