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

feat: add moq-sub to subscribe to media from moq relays #133

Closed
wants to merge 5 commits into from

Conversation

Frando
Copy link
Contributor

@Frando Frando commented Feb 9, 2024

This adds a simple moq-sub tool which allows to connect to a moq relay and subscribe to a broadcast. It expects the format as published by moq-pub, and will then dump the first video and first audio track to stdout. By piping moq-sub into e.g. ffplay you can play media from a moq relay.

Also includes a dev/sub script that works without further arguments when using dev/relay and dev/pub.

Also added an optional AUDIO=1 env var to dev/pub to not skip audio tracks.

Copy link
Owner

@kixelated kixelated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @Frando these are well done

while let Some(fragment) = segment.fragment().await? {
trace!("segment={} fragment={}", segment.sequence, fragment.sequence);
let buf = Self::recv_fragment(fragment).await?;
out.lock().await.write_all(&buf).await?;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine although we will need to handle this better eventually. MoQ is meant to be lossy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The segments are already received in parallel. Your suggestion would be to also receive fragments in parallel?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the fragments need to be written in order for playback to work. We either need separate files for each segment (like HLS/DASH), or drop the previous segment on each new segment. The current code will interleave fragments from different segments which won't playback.

@Frando
Copy link
Contributor Author

Frando commented Mar 8, 2024

Feel free to merge this and my other PR :) I am not working on these further for the time being.

@kixelated
Copy link
Owner

Working on updating this to the new API.

@englishm englishm mentioned this pull request Jun 17, 2024
@kixelated kixelated closed this Aug 6, 2024
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

Successfully merging this pull request may close these issues.

2 participants