Skip to content

Commit

Permalink
Bump membrane core version to 1.0 for VideoCompositor SDK, flatten ex…
Browse files Browse the repository at this point in the history
…amples file structure (#144)

* Bump to core 1.0

* Flatten examples structure

* Move examples out of `lib` directory
  • Loading branch information
WojciechBarczynski authored Nov 27, 2023
1 parent 7525a2c commit 0bf28c4
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 64 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The package can be installed by adding `membrane_video_compositor_plugin` to you
```elixir
def deps do
[
{:membrane_video_compositor_plugin, "~> 0.5.4"}
{:membrane_video_compositor_plugin, "~> 0.6.0"}
]
end
```
Expand All @@ -32,19 +32,20 @@ Examples can be found in `examples` directory.

To run example run:

1. `mix deps.get`
2. `mix run examples/[example_name].exs`
1. `cd examples`
2. `mix deps.get`
3. `mix run [example_name].exs`

### Layout with shader example

Example presents dynamically added video arranged onto tiled layout and "twisted" with simple shader. Shaders can be used to create custom visual effects.
The example presents dynamically added video arranged onto a tiled layout and "twisted" with the simple shader. Shaders can be used to create custom visual effects.

### Transition example

Example presents dynamic transition of input videos. Transitions are used for smooth, dynamical animations.
The example presents dynamic transition of input videos. Transitions are used for smooth, dynamical animations.

### Dynamic outputs example

Example presents dynamic outputs linking.
The example presents dynamic outputs linking.
Multiple outputs are useful for live-streaming for multiple platforms (e.g. different layout for mobile devices), target resolutions
or any other case, when user want to process input videos in different ways.
or any other case, when user want to process input videos differently.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.VideoCompositor.Examples.DynamicOutputs.Pipeline do
defmodule DynamicOutputsPipeline do
@moduledoc false

use Membrane.Pipeline
Expand Down Expand Up @@ -193,3 +193,10 @@ defmodule Membrane.VideoCompositor.Examples.DynamicOutputs.Pipeline do
"output_group_#{output_id}"
end
end

Membrane.VideoCompositor.Examples.Utils.FFmpeg.generate_sample_video()

{:ok, _supervisor, _pid} =
Membrane.Pipeline.start_link(DynamicOutputsPipeline, %{sample_path: "samples/testsrc.h264"})

Process.sleep(:infinity)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.VideoCompositor.Examples.LayoutWithShader.Pipeline do
defmodule LayoutWithShaderPipeline do
@moduledoc false

use Membrane.Pipeline
Expand All @@ -11,6 +11,7 @@ defmodule Membrane.VideoCompositor.Examples.LayoutWithShader.Pipeline do
@output_width 1920
@output_height 1080
@output_id "output"
@shader_path "./example_shader.wgsl"

@impl true
def handle_init(_ctx, %{sample_path: sample_path}) do
Expand Down Expand Up @@ -199,7 +200,7 @@ defmodule Membrane.VideoCompositor.Examples.LayoutWithShader.Pipeline do
type: :register,
entity_type: :shader,
shader_id: "example_shader",
source: File.read!("./lib/layout_with_shader/example_shader.wgsl"),
source: File.read!(@shader_path),
constraints: [
%{
type: "input_count",
Expand All @@ -209,3 +210,10 @@ defmodule Membrane.VideoCompositor.Examples.LayoutWithShader.Pipeline do
}
end
end

Membrane.VideoCompositor.Examples.Utils.FFmpeg.generate_sample_video()

{:ok, _supervisor, _pid} =
Membrane.Pipeline.start_link(LayoutWithShaderPipeline, %{sample_path: "samples/testsrc.h264"})

Process.sleep(:infinity)
7 changes: 0 additions & 7 deletions examples/lib/dynamic_outputs.exs

This file was deleted.

7 changes: 0 additions & 7 deletions examples/lib/layout_with_shader.exs

This file was deleted.

7 changes: 0 additions & 7 deletions examples/lib/transition.exs

This file was deleted.

12 changes: 6 additions & 6 deletions examples/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ defmodule Membrane.VideoCompositor.Examples.Mixfile do
defp deps do
[
# Membrane
{:membrane_core, "~> 0.12.9"},
{:membrane_core, "~> 1.0"},
{:membrane_video_compositor_plugin, path: ".."},
# VC API requests
{:req, "~> 0.4.0"},
# Examples
{:membrane_file_plugin, "~> 0.15.0"},
{:membrane_realtimer_plugin, "~> 0.7.0"},
{:membrane_sdl_plugin, "~> 0.16.0"},
{:membrane_h264_plugin, "~> 0.7.3"},
{:membrane_h264_ffmpeg_plugin, "~> 0.29.0"},
{:membrane_file_plugin, "~> 0.16.0"},
{:membrane_realtimer_plugin, "~> 0.9.0"},
{:membrane_sdl_plugin, "~> 0.18.0"},
{:membrane_h264_plugin, "~> 0.9.0"},
{:membrane_h264_ffmpeg_plugin, "~> 0.31.0"},
# Dev
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:dialyxir, ">= 0.0.0", only: :dev, runtime: false},
Expand Down
Loading

0 comments on commit 0bf28c4

Please sign in to comment.