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
Last Post!
itsok
Popular in Discussions
Hi everyone,
I hesitated to post this here because I don’t want you to think I’m spamming, but I’ve been working on a Platform-as-a-Serv...
New
Following https://github.com/tbrand/which_is_the_fastest |>
https://raw.githubusercontent.com/tbrand/which_is_the_fastest/master/imgs...
New
Hello everyone!
A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
How does the two languages compare when it comes to server side application development? Any experiences or ideas? Thank you.
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
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
Other popular topics
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









