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

How do I output the srt stream? #60

Open
RLutsch opened this issue Mar 9, 2023 · 6 comments
Open

How do I output the srt stream? #60

RLutsch opened this issue Mar 9, 2023 · 6 comments

Comments

@RLutsch
Copy link

RLutsch commented Mar 9, 2023

I can start the server and stream video to it and log the bytes but how do I get the stream to something like go-ffmpeg to convert and restream? or even just save to disk?

@gissleh
Copy link

gissleh commented Mar 9, 2023

Saving it to disk could be done in the same way you'd copy from any other io.Reader: open a file and use that writer to save the bytes to file. Using io.CopyBuffer with a buffer of length >= SRT chunk size could simplify the process.

As for go-ffmpeg, I cannot find a library by that name. ffmpeg-go seems to lack a way to take in a io.Reader or offer an io.Writer, so maybe a named pipe could do the trick here? If your use case is to take in one SRT stream and outputting it without any custom behavior, you could get away with building ffmpeg with libsrt enabled and use your Go application to manage these running ffmpeg instances.

@RLutsch
Copy link
Author

RLutsch commented Mar 9, 2023

thanks for the quick response and yes it's ffmpeg-go. guessing my two options would either be to relay the stream to an srt port that I can read using ffmpeg or alternatively write to stdout and use the pipe: method then?

@RLutsch
Copy link
Author

RLutsch commented Mar 10, 2023

Is it possible to publish the srt stream to localhost?

Then I could simply ffmpeg -i srt://localhost:1234 and get the stream I need to transform and send

@gissleh
Copy link

gissleh commented Mar 10, 2023

You could use this library to open a listener, and write to every client that it accepts, and then it should work in ffmpeg with the address in your comment.

I don't think I understand your use case, though, or if you are at the stage of your work where the issue you have is with this Go binding. You should start with a manual setup that uses srt-live-transmit and/or ffmpeg to do what you want, then start work on automating it with Go.

@RLutsch
Copy link
Author

RLutsch commented Mar 10, 2023

I have to send an srt stream h.265 to rtmp for distribution in h.264.

Currently I can trasnmit to srtgo listener and send the srt stream but struggling to input the stream to ffmpeg to do the transcoding to h.265 and send to rtmp endpoint. with another service the stream gets published to localhost and ffmpeg can receive input from localhost. hope that makes sense

@gissleh
Copy link

gissleh commented Mar 10, 2023

What is failing when you try to input the stream to ffmpeg, and does it work if you do srt-live-transmit srt://localhost:1234 file://con | ffmpeg -i -...?

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