Question / Help Best way to record stream over local network.

Paul Vaden

New Member
TLDR: Is there a linux solution/package that just receives an RTMP stream and records it locally?

My company has several locations across the globe, and they need to share recordings of gameplay between them. I recently setup a local NGINX/RTMP server (using https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/) that allows them to stream to it using OBS and for others to watch that stream from remote locations and comment/discuss in real time. Due to the distance between studios we have to use a pretty low bitrate to allow real-time discussion of the stream. I then wrote a script that executed when the stream finished which ran ffmpeg to convert the recording to mp4, copy it to a central fileshare, and send email notification that it was done to allow people who weren't in the meeting to see it afterwards. This functionality then led to people using that server solely for recording clips to use in bug reports or in some cases marketing material.

I've since received a request to setup a separate server that would allow them to just use it for recording. They do not want to record locally to disk then copy that elsewhere (too many user steps), and I don't want them recording locally to a mapped drive/fileshare (too much latency between sites). What I propose is to have an NGINX/RTMP server at each site that they can stream to at a much higher bitrate, then use my script to convert/copy the video to a central fileshare (allowing TCP to handle the latency issue) and send the email notification. But since I won't be re-streaming to other users or services, I'm wondering if this will give the best quality and efficiency. Is there a different linux solution or package that just receives an RTMP stream and records it locally?

User Configuration: Windows 10 PCs with OBS Studio.
Server Configuration: Ubuntu 14.04 or 16.04, 8 core and 8 gigs of RAM
Video Requiremets: 1080P/60fps mp4 at the highest bitrate possible.
 

Fenrir

Forum Admin
Rather, should say the solution you're proposing is probably your best bet. nginx-rtmp allows local recording, as well as being able to act as a "passthrough" (using the push directive).
 

frol

New Member
I have searched for the solution to have the lowest latency streaming in a local network and while nginx-rtmp is nice and extendable, it is overkill for me since I only wanted a 1-1 connection from my laptop to the ARM box connected to my TV. It turned out that you can configure "Output" -> "Advanced" -> "Recording" to save the recording to the UDP location, e.g. `udp://192.168.1.100:9999` (to send it directly) or `udp://224.0.0.1:9999` (to multicast to the local network). Once you start the recording you can capture it with netcat or with media players:

ffplay -fflags nobuffer udp://@0.0.0.0:9999

mpv --no-cache udp://@0.0.0.0:9999
 

jackyOO7

New Member
@frol
Did you save it to the UDP location via the ffmpeg options or did you manage to do so directly?
I am basically trying to do the same, i.e. streaming the desktop via LAN connection with zero latency. I achieved ~60ms with a ffmpeg/mplayer solution, but since Windows 8 the ffmpeg desktop capture is severely crippled.

While searching for a solution I found OBS, which can capture fast enough, but I lose a lot of time on the streaming >120ms. If you were successful, could you maybe expand a little on your explanation above?
 
Top