vulkanh264enc: add Vulkan H264 encoder
Add an element to encode h264 content using the vulkan API. Co-authored-by: Stéphane Cerveau <scerveau@igalia.com> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7197>
This commit is contained in:
parent
d81726f8d2
commit
41ff02c349
@ -254996,6 +254996,160 @@
|
||||
},
|
||||
"rank": "none"
|
||||
},
|
||||
"vulkanh264enc": {
|
||||
"author": "Stéphane Cerveau <scerveau@igalia.com>, Victor Jaquez <vjaquez@igalia.com>",
|
||||
"description": "A H.264 video encoder based on Vulkan",
|
||||
"hierarchy": [
|
||||
"GstVulkanH264Encoder",
|
||||
"GstH264Encoder",
|
||||
"GstVideoEncoder",
|
||||
"GstElement",
|
||||
"GstObject",
|
||||
"GInitiallyUnowned",
|
||||
"GObject"
|
||||
],
|
||||
"interfaces": [
|
||||
"GstPreset"
|
||||
],
|
||||
"klass": "Codec/Encoder/Video/Hardware",
|
||||
"pad-templates": {
|
||||
"sink": {
|
||||
"caps": "video/x-raw(memory:VulkanImage):\n format: NV12\n width: [ 1, 2147483647 ]\n height: [ 1, 2147483647 ]\n framerate: [ 0/1, 2147483647/1 ]\n",
|
||||
"direction": "sink",
|
||||
"presence": "always"
|
||||
},
|
||||
"src": {
|
||||
"caps": "video/x-h264:\n profile: { (string)main, (string)high, (string)constrained-baseline }\n stream-format: byte-stream\n alignment: au\n",
|
||||
"direction": "src",
|
||||
"presence": "always"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"aud": {
|
||||
"blurb": "Insert AU (Access Unit) delimeter for each frame",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "true",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "gboolean",
|
||||
"writable": true
|
||||
},
|
||||
"bitrate": {
|
||||
"blurb": "The desired bitrate expressed in kbps (0: auto-calculate)",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "0",
|
||||
"max": "-1",
|
||||
"min": "0",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"max-qp": {
|
||||
"blurb": "Maximum quantization value for each frame (0: disabled)",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "0",
|
||||
"max": "51",
|
||||
"min": "0",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"min-qp": {
|
||||
"blurb": "Minimum quantization value for each frame (0: disabled)",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "0",
|
||||
"max": "51",
|
||||
"min": "0",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"qp-b": {
|
||||
"blurb": "Constant quantization value for each B-frame slice",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "26",
|
||||
"max": "51",
|
||||
"min": "0",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"qp-i": {
|
||||
"blurb": "Constant quantization value for each I-frame slice",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "26",
|
||||
"max": "51",
|
||||
"min": "0",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"qp-p": {
|
||||
"blurb": "Constant quantization value for each P-frame slice",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "26",
|
||||
"max": "51",
|
||||
"min": "0",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"quality": {
|
||||
"blurb": "Video encoding quality level",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "2",
|
||||
"max": "10",
|
||||
"min": "0",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "guint",
|
||||
"writable": true
|
||||
},
|
||||
"rate-control": {
|
||||
"blurb": "The encoding rate control mode to use",
|
||||
"conditionally-available": false,
|
||||
"construct": true,
|
||||
"construct-only": false,
|
||||
"controllable": false,
|
||||
"default": "cqp (1)",
|
||||
"mutable": "playing",
|
||||
"readable": true,
|
||||
"type": "GstVulkanEncoderRateControlMode",
|
||||
"writable": true
|
||||
}
|
||||
},
|
||||
"rank": "none"
|
||||
},
|
||||
"vulkanh265dec": {
|
||||
"author": "Víctor Jáquez <vjaquez@igalia.com>",
|
||||
"description": "A H.265 video decoder based on Vulkan",
|
||||
@ -255428,6 +255582,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"GstVulkanEncoderRateControlMode": {
|
||||
"ignore-enum-members": true,
|
||||
"kind": "enum",
|
||||
"values": [
|
||||
{
|
||||
"desc": "Driver's default",
|
||||
"name": "default",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"desc": "Constant quantizer",
|
||||
"name": "cqp",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"desc": "Constant bitrate",
|
||||
"name": "cbr",
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"desc": "Variable bitrate",
|
||||
"name": "vbr",
|
||||
"value": "4"
|
||||
}
|
||||
]
|
||||
},
|
||||
"GstVulkanStereoDownmix": {
|
||||
"kind": "enum",
|
||||
"values": [
|
||||
|
@ -46,6 +46,7 @@
|
||||
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
|
||||
#include "vkh264dec.h"
|
||||
#include "vkh265dec.h"
|
||||
# include "vkh264enc.h"
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
@ -104,6 +105,10 @@ plugin_init (GstPlugin * plugin)
|
||||
VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME)) {
|
||||
ret |= gst_vulkan_h265_decoder_register (plugin, device, GST_RANK_NONE);
|
||||
}
|
||||
if (gst_vulkan_device_is_extension_enabled (device,
|
||||
VK_KHR_VIDEO_ENCODE_H264_EXTENSION_NAME)) {
|
||||
ret |= gst_vulkan_h264_encoder_register (plugin, device, GST_RANK_NONE);
|
||||
}
|
||||
#endif
|
||||
ret |= gst_vulkan_sink_register (plugin, device, GST_RANK_NONE);
|
||||
gst_object_unref (device);
|
||||
|
@ -32,6 +32,7 @@ glsc_sources = [
|
||||
|
||||
video_sources = [
|
||||
'base/gsth264encoder.c',
|
||||
'vkh264enc.c',
|
||||
'vkh264dec.c',
|
||||
'vkh265dec.c',
|
||||
]
|
||||
|
2310
subprojects/gst-plugins-bad/ext/vulkan/vkh264enc.c
Normal file
2310
subprojects/gst-plugins-bad/ext/vulkan/vkh264enc.c
Normal file
File diff suppressed because it is too large
Load Diff
30
subprojects/gst-plugins-bad/ext/vulkan/vkh264enc.h
Normal file
30
subprojects/gst-plugins-bad/ext/vulkan/vkh264enc.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* GStreamer
|
||||
* Copyright (C) 2025 Igalia, S.L.
|
||||
* Author: Stéphane Cerveau <scerveau@igalia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gst/vulkan/vulkan.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean
|
||||
gst_vulkan_h264_encoder_register (GstPlugin * plugin, GstVulkanDevice * device, guint rank);
|
||||
|
||||
G_END_DECLS
|
Loading…
x
Reference in New Issue
Block a user