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

Support for pushing MPEG-TS streams to external RTMP servers #42

Open
bezaleel22 opened this issue Apr 30, 2023 · 6 comments
Open

Support for pushing MPEG-TS streams to external RTMP servers #42

bezaleel22 opened this issue Apr 30, 2023 · 6 comments

Comments

@bezaleel22
Copy link

Description:
Hello! I am interested in using the rust-media-libs library for streaming MPEG-TS video content to an external RTMP server like YouTube. I have read through the documentation and searched through the examples, but I haven't found any clear instructions on how to do this.

Can you please provide guidance or an example on how to push a MPEG-TS stream to an external RTMP server using this library? It would be really helpful if you could add this functionality to the library as well.

Thank you for your hard work on this library and I appreciate any help you can provide.

Best regards,
Onojeta Brown

@KallDrexx
Copy link
Owner

Unless I'm misunderstanding something, MPEG-TS is a container format, not a media codec. RTMP only works with media in the FLV container format.

The first thing to be aware of is that the FLV container only supports h264 video and AAC audio (it technically supports other codecs but those are really old and not used anymore). So if your MPEG-TS media is in another codec, the media will have to be transcoded before the rml_rtmp crate comes into play.

If your mpeg-ts media is h264 and AAC, then your rust code needs to read the mpeg-ts data streams (making sure to read at clock speed based on the media timestamps). Each Mpeg-ts media segment then needs to have the raw video taken from it, along with timestamp information.

The raw media byte stream then needs to be packed into an FLV packet (you can see me do that in my media server, video example and audio example).

Once you have the media wrapped in an FLV packet, you then create you can take your ClientSession which is presumably already connected to the external RTMP server as a publisher, and call publish_video_data() or publish_audio_data() with those bytes. That will publish the media to the external server, which should be able to read it as expected.

@bezaleel22
Copy link
Author

bezaleel22 commented May 2, 2023

@KallDrexx Thank you so much for the detailed explanation, I'm a newby in video programming, I'm looking at building a basic app that pushes streams to YouTube RTMPS server like OBS. With your guidance, I would like to implement basic working example and show my code here to help others, Thanks for your quick response.

@ehuff700
Copy link

ehuff700 commented May 5, 2023

@onos9 did you make any progress here? I'm attempting to do something similar (trying to recreate an incredibly basic version of OBS in Rust essentially). Need some guidance.

@ROBERT-MCDOWELL
Copy link

@KallDrexx
I think people coming here think that rust-media-libs concern all kind of protocols and encoding...

@KallDrexx
Copy link
Owner

That was originally the intention, bu time and life has gotten in the way of it.

@ROBERT-MCDOWELL
Copy link

yup, as everyone trapped in this digital world we forgot the limited time we have on this Earth ;)

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

4 participants