NDEVR
API Documentation
GStreamerVulkanWriter

Captures Vulkan framebuffer images and encodes them to an MP4 video file via GStreamer. More...

Public Member Functions

 GStreamerVulkanWriter (VkPhysicalDevice phys, VkDevice dev, VkQueue q, uint32_t queueFamilyIndex, VkCommandPool commandPool, uint32_t w, uint32_t h, VkFormat fmt, const std::string &outFile, uint32_t fpsNumer=30, uint32_t fpsDenom=1)
 Constructs a writer that encodes Vulkan frames to a video file.
void finish ()
 Signals the end of the video stream to the GStreamer pipeline.
void pushFrame (VkImage srcImage, VkImageLayout currentLayout, uint64_t frameIndex)
 Copies a Vulkan image to the staging buffer and pushes it as a video frame.

Detailed Description

Captures Vulkan framebuffer images and encodes them to an MP4 video file via GStreamer.


Copies each frame from a VkImage into a host-visible staging buffer, then pushes raw pixel data through a GStreamer pipeline (appsrc -> videoconvert -> x264enc -> mp4mux -> filesink).

Definition at line 28 of file GstreamerVulkanWriter.h.

Constructor & Destructor Documentation

◆ GStreamerVulkanWriter()

GStreamerVulkanWriter::GStreamerVulkanWriter ( VkPhysicalDevice phys,
VkDevice dev,
VkQueue q,
uint32_t queueFamilyIndex,
VkCommandPool commandPool,
uint32_t w,
uint32_t h,
VkFormat fmt,
const std::string & outFile,
uint32_t fpsNumer = 30,
uint32_t fpsDenom = 1 )
inline

Constructs a writer that encodes Vulkan frames to a video file.

Parameters
[in]physVulkan physical device handle.
[in]devVulkan logical device handle.
[in]qVulkan queue for transfer commands.
[in]queueFamilyIndexQueue family index for the transfer queue.
[in]commandPoolCommand pool for allocating transfer command buffers.
[in]wFrame width in pixels.
[in]hFrame height in pixels.
[in]fmtPixel format (must be B8G8R8A8_UNORM or R8G8B8A8_UNORM).
[in]outFileOutput MP4 file path.
[in]fpsNumerFramerate numerator (default 30).
[in]fpsDenomFramerate denominator (default 1).

Definition at line 43 of file GstreamerVulkanWriter.h.

Member Function Documentation

◆ pushFrame()

void GStreamerVulkanWriter::pushFrame ( VkImage srcImage,
VkImageLayout currentLayout,
uint64_t frameIndex )
inline

Copies a Vulkan image to the staging buffer and pushes it as a video frame.

Parameters
[in]srcImageThe source VkImage to capture.
[in]currentLayoutThe current layout of the source image.
[in]frameIndexZero-based frame index for timestamp calculation.

Definition at line 83 of file GstreamerVulkanWriter.h.


The documentation for this class was generated from the following file: