itsok
Can't play videos recorded with `membrane_camera_capture_plugin`
I’m trying to use Membrane.CameraCapture to record a video from my computer camera.
When I clone the package repo and run the tests mix test --include manual, I can play the video the test records. Everything seems to work as expected.
But when I try to use the child specification defined in the test in a standalone example, I can’t play the output video.
To reproduce the problem, save the following code into a file example.exs.
example.exs
Mix.install([
{:membrane_camera_capture_plugin, "~> 0.4.0"},
{:membrane_h264_ffmpeg_plugin, "~> 0.21"},
{:membrane_file_plugin, "~> 0.10"},
{:membrane_ffmpeg_swscale_plugin, "~> 0.10"}
])
defmodule VideoRecorder do
use Membrane.Pipeline
@impl true
def handle_init(_ctx, _options) do
structure =
child(:source, Membrane.CameraCapture)
|> child(:converter, %Membrane.FFmpeg.SWScale.PixelFormatConverter{format: :I420})
|> child(:encoder, Membrane.H264.FFmpeg.Encoder)
|> child(:sink, %Membrane.File.Sink{location: "output.h264"})
{[spec: structure], %{}}
end
end
{:ok, _supervisor_pid, pipeline_pid} = Membrane.Pipeline.start_link(__MODULE__, [], name: VideoRecorder)
Process.sleep(2000)
VideoRecorder.terminate(pipeline_pid)
Then run the above file with elixir example.exs, and open the outputted video with ffplay output.h264.
Instead of seeing a video, I get the following warning…
[h264 @ 0x15b00a190] Format h264 detected only with low score of 1, misdetection possible!
[h264 @ 0x15b00a190] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Any ideas what I’m missing?
Most Liked
jerzywilczek
Membrane Core Team
I believe that you need to return the playback: :playing action from your handle_init after the spec action, like this:
{[spec: structure, playback: :playing], %{}}
1
Popular in Discussions
Other popular topics
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I'm a nov...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New







