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

Multiple clients on server-rpi?? #30

Open
markjerz opened this issue Dec 21, 2016 · 8 comments
Open

Multiple clients on server-rpi?? #30

markjerz opened this issue Dec 21, 2016 · 8 comments

Comments

@markjerz
Copy link

Subject says it all ... i've tried to wrap the start_feed function with a bool so as not to start the spawned process a second time but I don't get any output on the second client; the first continues to work fine.

Any ideas?

start_feed() {
        if (this.isFeedStarted) {
            return;
        }

        var readStream = this.get_feed();
        this.readStream = readStream;

        readStream = readStream.pipe(new Splitter(NALseparator));
        readStream.on("data", this.broadcast);
        this.isFeedStarted = true;
    }
@131
Copy link
Owner

131 commented Dec 23, 2016

Multiple listener should be "easily" achivable
But you'll need to separate the input feed from the broadcast stream (using a stack/queue)
I've an alternative implementation of the server that can bring this logic somewhere, 'ill post it someday.

@radojko
Copy link

radojko commented Feb 10, 2017

Can you post solution for multiple clients, I´m also looking for that option.

@pimterry
Copy link

+1 @131 can you post an example of this, or some more explanation of what you mean?

@adrhc
Copy link

adrhc commented Sep 6, 2017

@131
I'm interested too in a ws broadcast solution.

@adrhc
Copy link

adrhc commented Sep 6, 2017

hi, I'm trying to achive this using another web-socket server implementation (websocket-relay.js).

Basically I'm doing this:
camera -> ffmpeg (rawvideo) -> websocket-relay.js (the unchanged input) -> browser (h264-live-player's index.html changed accordingly).

I'm successfully using server-ffmpeg.js with this configuration:
var args = [
"-rtsp_transport", "tcp",
"-i", "rtsp://172.20.19.103/media/video1" ,
"-an",
'-c:v', 'copy',
'-f' ,'rawvideo',
'-'
];
and a SONY RTSP Server camera so I tried the same parameters with websocket-relay.js:
ffmpeg -rtsp_transport tcp -i "rtsp://172.20.19.103/media/video1" -pix_fmt yuv420p -an -c:v copy -f rawvideo http://127.0.0.1:8081/supersecret
but I see nothing in browser.

Any idea why?

adrhc pushed a commit to adrhc/h264-live-player that referenced this issue Sep 9, 2017
@pimterry
Copy link

@adrhc I'm not sure exactly why what you're doing isn't working, but you might be interested in https://github.com/pimterry/raspivid-stream. I wrote this up as a solution for the original issue here generally for the raspivid case. Like the code in this repo, it creates a stream of frames, but it ensures there's only one video streaming process, and keeps track of the overall stream state it has already seen, to let it create new streams for later consumers, who can then start watching from the current live stream too.

Code is here - it works by storing the initial SPS and PPS (configuration) frames sent when the raspivid process first starts streaming, and then keeping track of the latest IDR (full non-diff) frame as the videos plays. Whenever a client joins, that client is sent those original SPS & PPS frames, followed by the latest IDR frame, and then the rest of the stream from wherever it is currently. I'm not sure exactly how that maps to your situation, but it's a good solution for anybody pulling video from raspivid, and hopefully it's helpful!

@KevinNovak
Copy link

@131 Could you post your implementation of multiple listeners?

@Richardn2002
Copy link

Richardn2002 commented Mar 29, 2021

See here
I have written a script to enable multiple clients.
Repo set up.

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

7 participants