Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
resolver = "2"
members = ["native/vkvideo"]
members = ["native/gpuvideo"]
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# Membrane vk video plugin
# Membrane GPU video plugin

[![Hex.pm](https://img.shields.io/hexpm/v/membrane_vk_video_plugin.svg)](https://hex.pm/packages/membrane_vk_video_plugin)
[![API Docs](https://img.shields.io/badge/api-docs-yellow.svg?style=flat)](https://hexdocs.pm/membrane_vk_video_plugin)
[![CircleCI](https://circleci.com/gh/membraneframework/membrane_vk_video_plugin.svg?style=svg)](https://circleci.com/gh/membraneframework/membrane_vk_video_plugin)
[![Hex.pm](https://img.shields.io/hexpm/v/membrane_gpu_video_plugin.svg)](https://hex.pm/packages/membrane_gpu_video_plugin)
[![API Docs](https://img.shields.io/badge/api-docs-yellow.svg?style=flat)](https://hexdocs.pm/membrane_gpu_video_plugin)
[![CircleCI](https://circleci.com/gh/membraneframework/membrane_gpu_video_plugin.svg?style=svg)](https://circleci.com/gh/membraneframework/membrane_gpu_video_plugin)

Membrane H.264 decoder based on [vk-video](https://crates.io/crates/vk-video).
Membrane H.264 decoder based on [gpu-video](https://crates.io/crates/gpu-video).
It's a part of the [Membrane Framework](https://membrane.stream).

## Installation

The package can be installed by adding `membrane_vk_video_plugin` to your list of dependencies in `mix.exs`:
The package can be installed by adding `membrane_gpu_video_plugin` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:membrane_vk_video_plugin, "~> 0.2.2"}
{:membrane_gpu_video_plugin, "~> 0.2.3"}
]
end
```

This package depends on hardware encoding acceleration capabilities provided by [Vulkan video exensions](https://www.khronos.org/blog/an-introduction-to-vulkan-video) and works only on Linux with NVIDIA or AMD GPUs with Mesa drivers. For more information see the README of the [`vk-video`](https://crates.io/crates/vk-video) Rust package.
This package depends on hardware encoding acceleration capabilities provided by [Vulkan video exensions](https://www.khronos.org/blog/an-introduction-to-vulkan-video) and works only on Linux with NVIDIA or AMD GPUs with Mesa drivers. For more information see the README of the [`gpu-video`](https://crates.io/crates/gpu-video) Rust package.


## Copyright and License

Copyright 2025, [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_vk_video_plugin)
Copyright 2025, [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_gpu_video_plugin)

[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=membrane-github)](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_vk_video_plugin)
[![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=membrane-github)](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_gpu_video_plugin)

Licensed under the [Apache License, Version 2.0](LICENSE)
4 changes: 2 additions & 2 deletions lib/decoder.ex
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defmodule Membrane.VKVideo.Decoder do
defmodule Membrane.GPUVideo.Decoder do
@moduledoc """
Decoder of H.264 stream taking advantage of hardware acceleration provided
by Vulkan video extensions.
"""
use Membrane.Filter

alias Membrane.VKVideo.{DeviceServer, Native}
alias Membrane.GPUVideo.{DeviceServer, Native}

def_input_pad :input, accepted_format: %Membrane.H264{stream_structure: :annexb, alignment: :au}
def_output_pad :output, accepted_format: %Membrane.RawVideo{pixel_format: :NV12}
Expand Down
4 changes: 2 additions & 2 deletions lib/device_server.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.VKVideo.DeviceServer do
defmodule Membrane.GPUVideo.DeviceServer do
@moduledoc false
use GenServer
alias Membrane.VKVideo.Native
alias Membrane.GPUVideo.Native

@impl true
def init(_opts) do
Expand Down
4 changes: 2 additions & 2 deletions lib/encoder.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.VKVideo.Encoder do
defmodule Membrane.GPUVideo.Encoder do
@moduledoc """
H.264 encoder taking advantage of hardware acceleration provided
by Vulkan video extensions.
Expand All @@ -7,7 +7,7 @@ defmodule Membrane.VKVideo.Encoder do

require Membrane.Logger

alias Membrane.VKVideo.{DeviceServer, Native}
alias Membrane.GPUVideo.{DeviceServer, Native}

def_input_pad :input, accepted_format: %Membrane.RawVideo{pixel_format: :NV12}

Expand Down
2 changes: 1 addition & 1 deletion lib/encoder/constant_bitrate.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.VKVideo.Encoder.ConstantBitrate do
defmodule Membrane.GPUVideo.Encoder.ConstantBitrate do
@moduledoc """
Defines encoder setting for constant bitrate rate control algorithm.
The following fields need to be specified:
Expand Down
2 changes: 1 addition & 1 deletion lib/encoder/variable_bitrate.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.VKVideo.Encoder.VariableBitrate do
defmodule Membrane.GPUVideo.Encoder.VariableBitrate do
@moduledoc """
Defines encoder setting for variable bitrate rate control algorithm.

Expand Down
4 changes: 2 additions & 2 deletions lib/vk_video.ex → lib/gpu_video.ex
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
defmodule Membrane.VKVideo do
defmodule Membrane.GPUVideo do
@moduledoc false
use Application

alias Membrane.VKVideo.DeviceServer
alias Membrane.GPUVideo.DeviceServer

@impl true
def start(_start_type, _start_args) do
Expand Down
15 changes: 10 additions & 5 deletions lib/native.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
defmodule Membrane.VKVideo.Native do
defmodule Membrane.GPUVideo.Native do
@moduledoc false
use Rustler, otp_app: :membrane_vk_video_plugin, crate: :vkvideo
# gpu-video supports only platforms with Vulkan Video (Linux); skip compiling
# the NIF elsewhere so that docs, credo etc. can still run
use Rustler,
otp_app: :membrane_gpu_video_plugin,
crate: :gpuvideo,
skip_compilation?: :os.type() != {:unix, :linux}

@type t :: reference()
@type raw_frame :: %{
Expand Down Expand Up @@ -37,8 +42,8 @@ defmodule Membrane.VKVideo.Native do
:low_latency | :high_quality,
:encoder_default
| :disabled
| {:variable_bitrate, Membrane.VKVideo.Encoder.VariableBitrate.t()}
| {:constant_bitrate, Membrane.VKVideo.Encoder.ConstantBitrate.t()}
| {:variable_bitrate, Membrane.GPUVideo.Encoder.VariableBitrate.t()}
| {:constant_bitrate, Membrane.GPUVideo.Encoder.ConstantBitrate.t()}
) :: t() | no_return()
def new_encoder(_device, _width, _height, _framerate, _tune, _rate_control),
do: :erlang.nif_error(:nif_not_loaded)
Expand All @@ -52,7 +57,7 @@ defmodule Membrane.VKVideo.Native do

@spec new_transcoder(
t(),
[Membrane.VKVideo.Transcoder.OutputSpec.t()],
[Membrane.GPUVideo.Transcoder.OutputSpec.t()],
{non_neg_integer(), pos_integer()}
) ::
t() | no_return()
Expand Down
12 changes: 6 additions & 6 deletions lib/transcoder.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.VKVideo.Transcoder do
defmodule Membrane.GPUVideo.Transcoder do
@moduledoc """
H.264 hardware transcoder using Vulkan Video extensions.

Expand All @@ -16,7 +16,7 @@ defmodule Membrane.VKVideo.Transcoder do
spec = [
child(:source, source)
|> child(:parser, %Membrane.H264.Parser{...})
|> child(:transcoder, Membrane.VKVideo.Transcoder),
|> child(:transcoder, Membrane.GPUVideo.Transcoder),
get_child(:transcoder)
|> via_out(Pad.ref(:output, 0), options: [width: 1280, height: 720])
|> child(:sink_hd, sink_hd),
Expand All @@ -27,7 +27,7 @@ defmodule Membrane.VKVideo.Transcoder do
"""

use Membrane.Filter
alias Membrane.VKVideo.{DeviceServer, Native, Transcoder.OutputSpec}
alias Membrane.GPUVideo.{DeviceServer, Native, Transcoder.OutputSpec}

def_options approx_framerate: [
spec: {non_neg_integer(), pos_integer()} | nil,
Expand Down Expand Up @@ -66,11 +66,11 @@ defmodule Membrane.VKVideo.Transcoder do
spec:
:encoder_default
| :disabled
| {:variable_bitrate, Membrane.VKVideo.Encoder.VariableBitrate.t()}
| {:constant_bitrate, Membrane.VKVideo.Encoder.ConstantBitrate.t()},
| {:variable_bitrate, Membrane.GPUVideo.Encoder.VariableBitrate.t()}
| {:constant_bitrate, Membrane.GPUVideo.Encoder.ConstantBitrate.t()},
default: :encoder_default,
description: """
Rate control mode for the output stream. See `Membrane.VKVideo.Encoder` for
Rate control mode for the output stream. See `Membrane.GPUVideo.Encoder` for
available options.
"""
],
Expand Down
4 changes: 2 additions & 2 deletions lib/transcoder/output_spec.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Membrane.VKVideo.Transcoder.OutputSpec do
defmodule Membrane.GPUVideo.Transcoder.OutputSpec do
@moduledoc false

alias Membrane.VKVideo.Encoder
alias Membrane.GPUVideo.Encoder

@type t :: %__MODULE__{
width: non_neg_integer(),
Expand Down
18 changes: 9 additions & 9 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule Membrane.VKVideo.Mixfile do
defmodule Membrane.GPUVideo.Mixfile do
use Mix.Project

@version "0.2.2"
@github_url "https://github.com/membraneframework/membrane_vk_video_plugin"
@version "0.2.3"
@github_url "https://github.com/membraneframework/membrane_gpu_video_plugin"

def project do
[
app: :membrane_vk_video_plugin,
app: :membrane_gpu_video_plugin,
version: @version,
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
Expand All @@ -15,11 +15,11 @@ defmodule Membrane.VKVideo.Mixfile do
dialyzer: dialyzer(),

# hex
description: "vk video plugin for Membrane Framework",
description: "GPU video plugin for Membrane Framework",
package: package(),

# docs
name: "Membrane vk video plugin",
name: "Membrane GPU video plugin",
source_url: @github_url,
docs: docs(),
homepage_url: "https://membrane.stream",
Expand All @@ -30,7 +30,7 @@ defmodule Membrane.VKVideo.Mixfile do
def application do
[
extra_applications: [],
mod: {Membrane.VKVideo, []}
mod: {Membrane.GPUVideo, []}
]
end

Expand All @@ -44,7 +44,7 @@ defmodule Membrane.VKVideo.Mixfile do
{:membrane_raw_video_format, "~> 0.4.2"},
{:membrane_h26x_plugin, "~> 0.10.5", only: :test},
{:membrane_file_plugin, "~> 0.17.2", only: :test},
{:rustler, "~> 0.37.1"},
{:rustler, "~> 0.38.0"},
{:ex_doc, ">= 0.40.0", only: :dev, runtime: false},
{:dialyxir, ">= 0.0.0", only: :dev, runtime: false},
{:credo, ">= 0.0.0", only: :dev, runtime: false}
Expand Down Expand Up @@ -81,7 +81,7 @@ defmodule Membrane.VKVideo.Mixfile do
main: "readme",
extras: ["README.md", "LICENSE"],
source_ref: "v#{@version}",
nest_modules_by_prefix: [Membrane.VKVideo]
nest_modules_by_prefix: [Membrane.GPUVideo]
]
end

Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"numbers": {:hex, :numbers, "5.2.5", "47189ba1c0e634f851a76281a2bb7be1914c48498eb1289d16cd50b6c713b436", [:mix], [{:coerce, "~> 1.0.2", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 3.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "724563c5b9ed1adccea08b2938215a026aa4344d7506e6b9c75f60d8e2fc9463"},
"qex": {:hex, :qex, "0.5.2", "a0c861a2de2380314c23ef592349824ca9016c5845380667ff1d9a22a8796f9b", [:mix], [], "hexpm", "6fb81bf3ae354a9abb471b9561538ea3e8540125d803b00f45cbccff52f00496"},
"ratio": {:hex, :ratio, "4.0.1", "3044166f2fc6890aa53d3aef0c336f84b2bebb889dc57d5f95cc540daa1912f8", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "c60cbb3ccdff9ffa56e7d6d1654b5c70d9f90f4d753ab3a43a6bf40855b881ce"},
"rustler": {:hex, :rustler, "0.37.3", "5f4e6634d43b26f0a69834dd1d3ed4e1710b022a053bf4a670220c9540c92602", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "a6872c6f53dcf00486d1e7f9e046e20e01bf1654bdacc4193016c2e8002b32a2"},
"rustler": {:hex, :rustler, "0.38.0", "7a8906998ff0d28e3021c0a73264abcda719bda344b2e58307c6805b0f87c9b4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "704c03c1bf66be12b031c5a389347b91c81c5cb819a24b068b0de36fe4a5652a"},
"telemetry": {:hex, :telemetry, "1.4.2", "a0cb522801dffb1c49fe6e30561badffc7b6d0e180db1300df759faa22062855", [:rebar3], [], "hexpm", "928f6495066506077862c0d1646609eed891a4326bee3126ba54b60af61febb1"},
}
Loading
Loading