-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvp8_to_h264.exs
31 lines (26 loc) · 955 Bytes
/
vp8_to_h264.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Mix.install([
:membrane_file_plugin,
:membrane_ivf_plugin,
{:membrane_transcoder_plugin, path: __DIR__ |> Path.join("..") |> Path.expand()}
])
defmodule Example do
alias Membrane.RCPipeline
require Membrane.RCPipeline, as: RCPipeline
import Membrane.ChildrenSpec
def convert(input_file, output_file) do
pipeline = RCPipeline.start_link!()
spec =
child(%Membrane.File.Source{
location: input_file
})
|> child(:deserializer, Membrane.IVF.Deserializer)
|> child(:transcoder, %Membrane.Transcoder{output_stream_format: Membrane.H264})
|> child(:sink, %Membrane.File.Sink{location: output_file})
RCPipeline.subscribe(pipeline, _any)
RCPipeline.exec_actions(pipeline, spec: spec)
RCPipeline.await_end_of_stream(pipeline, :sink)
RCPipeline.terminate(pipeline)
end
end
File.mkdir("tmp")
Example.convert(Path.join("./test/fixtures", "video.ivf"), Path.join("./tmp", "video.h264"))