Skip to content

Severe datamoshing #8

@arduino-man

Description

@arduino-man

When running the following code on a Raspberry Pi 4 with the CSI camera module 3, the saved file contains severe datamoshing.
Is there a known way to mitigate?

defmodule Rpicam.Pipeline do
  use Membrane.Pipeline
  
  @impl true
  def handle_init(_ctx, _opts) do
    spec =   
      child(:source, %Membrane.Rpicam.Source{
        camera_open_delay: 1000,
        framerate: {50, 1},
        width: 1920, 
        height: 1080, 
        timeout: 30000})
      |> child(:sink, %Membrane.File.Sink{location: "/data/output.h264"})

    {[spec: spec], %{}}
  end

  @impl true
  def handle_element_end_of_stream(:sink, _pad, _ctx, state) do
    {[terminate: :normal], state}
  end

  @impl true
  def handle_element_end_of_stream(_child, _pad, _ctx, state) do
    {[], state}
  end
end

# Start and monitor the pipeline
{:ok, _supervisor_pid, pipeline_pid} = Membrane.Pipeline.start_link(Rpicam.Pipeline)
ref = Process.monitor(pipeline_pid)

# Wait for the pipeline to finish
receive do
  {:DOWN, ^ref, :process, _pipeline_pid, _reason} ->
    :ok
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions