Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Blast545 opened this issue Nov 29, 2024 · 4 comments
Open

Comments

@Blast545
Copy link

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 moq-gst#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 😄

@kixelated
Copy link
Owner

Hey @Blast545

Check out the contents of dev/pub. It invokes ffmpeg and you should be able to use the same flags.

@kixelated
Copy link
Owner

kixelated commented Nov 30, 2024

As for gstreamer, thanks for the attempt to update it. I think I'm going to merge it into the moq-rs repo proper so I'll actually keep it up to date.

I've been working on a plugin that doesn't involve fMP4 but it's stalled. Unfortunately, I can't seem to figure out their plugin architecture to do something more sophisticated.

@kixelated
Copy link
Owner

I crudely updated moq-gst to the latest API as part of moving it into this repo. It's a hack, but eh.

@Blast545
Copy link
Author

Blast545 commented Dec 2, 2024

Check out the contents of dev/pub. It invokes ffmpeg and you should be able to use the same flags.

Yeah, I attempted to use it and it worked alright for the mp4 example file. But with the camera it's not working, I think it's expecting some headers that are available in mp4 files but maybe when loading video from the camera with v4l2 that info is not automatically appended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants