RetroFed Forums
Your home away from modern life.
[solved] [ffmpeg/mpv] How to set up a stream over LAN?
Post Reply
AuthorMessage
printf("%s", name); piefed.blahaj.zone akunohana@piefed.blahaj.zone
Joined: 2026-03-30
(edited) Quote

Edit: I ended up piping ffmpeg into ssh to which through single quotes (or the -t switch, according to the manual) I gave the MPV command. I also needed to encode the streams, because either the layer one infrastructure couldn't handle the transmission or the receiving/playing computer couldn't decode fast enough (an old T480). Thank you @dgdft@lemmy.world ! The only thing I missed was that I had never actually ssh:ed into this particular computer, so the command got caught up in weird... "Situations" haha. Enabling public key authentication solved that. The final resulting command:

ffmpeg -f v4l2 -i [my video card] -f alsa -i [my sound card] -c:v libx264 -crf 18 -preset superfast -c:a flac -f nut pipe:1 | ssh -p [port] username@otherhost 'mpv [a buttload of options] -'  

I am watching VHS tapes with ffmpeg and piping it into MPV with ffmpeg -f v4l2 -i [my video card] -f alsa -i [my sound card] -c copy -f nut pipe:1 | mpv -. The reason I'm not just playing the video and audio stream off of my capture device is because I want to be able to adjust audio delay in real time with MPV hotkeys. This works well so far. Now, I want to grab the stream from another computer on my LAN. How do I do that? I've been thinking of sshfs, but I can't mount the capture card. Should I stream into a file on the server which I then mount on the client side with sshfs? If I did that, I'd have to delete the file that my command created every time I watched something, no?

28   Original
dgdft lemmy.world dgdft@lemmy.world
Joined: 2025-03-26
#2 · Quote Reply

Realistically, you'll probably want to encode the stream first to keep bandwidth sane, but I suspect you're looking for something like: ffmpeg -f v4l2 -i [my video card] -f alsa -i [my sound card] -c copy -f nut pipe:1 | ssh username@otherhost 'mpv -'.

16
printf("%s", name); piefed.blahaj.zone akunohana@piefed.blahaj.zone
Joined: 2026-03-30
#3 · Quote Reply

Realistically, you'll probably want to encode the stream first to keep bandwidth sane, but I suspect you're looking for something like: ffmpeg -f v4l2 -i [my video card] -f alsa -i [my sound card] -c copy -f nut pipe:1 | ssh username@otherhost 'mpv -'.

Sic! I had no idea you can pass commands to ssh like that! Thanks a lot! :)

11
Flyswat lemmy.dbzer0.com Flyswat@lemmy.dbzer0.com
Joined: 2023-08-16
#4 · Quote Reply

Maybe you should be looking into a proper RTSP video stream. I know VLC can act as a server.

3
TwilightKiddy scribe.disroot.org TwilightKiddy@scribe.disroot.org
Joined: 2026-07-27
#5 · (edited) Quote Reply

If you want another "unga-bunga" approach, you can use netcat:
On the player machine:

nc -l 1234 | mpv -

On the sender machine:

ffmpeg | nc 192.168.1.4 1234

Of course, you can use any unused port instead of 1234.

13
dihutenosa piefed.social dihutenosa@piefed.social
Joined: 2025-06-04
#6 · Quote Reply

ffmpeg can send video over RTMP or SRT protocols. ffplay can receive and play.

6
printf("%s", name); piefed.blahaj.zone akunohana@piefed.blahaj.zone
Joined: 2026-03-30
#7 · Quote Reply

If you want another "unga-bunga" approach, you can use netcat: On the player machine: nc -l 1234 | mpv - On the sender machine: ffmpeg | nc 192.168.1.4 1234 Of course, you can use any unused port instead of 1234.

I laughed my ass off. How did netcat enter the chat here. 😂 This is fantastic!!! Thank you!

8
eta feddit.org eta@feddit.org
Joined: 2024-07-02
#8 · Quote Reply

If you want another "unga-bunga" approach, you can use netcat: On the player machine: nc -l 1234 | mpv - On the sender machine: ffmpeg | nc 192.168.1.4 1234 Of course, you can use any unused port instead of 1234.

No! The standard for an arbitrary open port is 1234

3
Post Reply
Back to top