Skip to content

[Request] Working example of video streamed from camera instead of a file #243

@Blast545

Description

@Blast545

Good afternoon!

I took some time to check the examples in your repo and I was able to replicate them locally using the scripts available in /dev/pub, /dev/relay and the subscriber available in the moq-js repo.

For my use case, I wanted to stream camera from a raspberry pi and stream it in my local web-browser. As a minimum viable example, I tried to do this in my linux pc following both the ffmpeg route as the gstreamer one. I found problems in both scenarios.

Attempts with ffmpeg

  1. It is not listed which encoders / decoders are supported anywhere in your repo. It seems to me only files that start with a ftyp+moov header?
		let _ftyp = mp4_atom::Ftyp::read_from(input).await?;
		let moov = Moov::read_from(input).await?;

I didn't try with different mp4 files, but different encoding flags of the camera stream without luck. As a user without a lot of knowledge of encodings/decoders, it was difficult for me to add a quick fix/patch for this.

  1. I also tried encoding the output of ffmpeg as flv, but this one fails silently.
ffmpeg -hide_banner -v quiet \
    -f v4l2 -i /dev/video0 \
    -f flv \
	- | cargo run --bin moq-karp -- --server "${SERVER}" --room "${ROOM}" --tls-disable-verify -v --broadcast "${BROADCAST}" "$@" publish

My closest attempt (I think?) was using this setup:

ffmpeg -hide_banner \
    -f v4l2 -i /dev/video0 -v quiet -g 50 \
	-f mp4 -c:v libx264 -preset fast -crf 23 -movflags +faststart+frag_keyframe+empty_moov \
	- | cargo run --bin moq-karp -- --server "${SERVER}" --room "${ROOM}" --tls-disable-verify -v --broadcast "${BROADCAST}" "$@" publish

Attempts with gstreamer

  1. I don't know why, but in my local version of gstreamer I didn't have the isofmp4mux plugin. It's listed as part of the good plugins, but I didn't have it and didn't spend much too on it. I might take a closer look later if that helps.

  2. I took some time to update moq-gst Add support newer transfork api gstreamer#12 to work with latest version of this repo, and maybe after it works it should be easier to get it done via this way? Hopefully yes.

I'd be happy help you with some dev time if you give me some tips about what has to be done, about the classes organizations and if you think it makes sense to stream camera feeds using moq.

PS: thanks a lot for the --tls-disable-verify flag in your scripts 😄

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