by steelbrain on 10/4/24, 5:49 PM with 72 comments
I’m excited to show case a personal project. It has helped me quite a bit with my home lab, I hope it can help you with yours too! ffmpeg-over-ip has two components, a server and a client. You can run the server in an environment with access to a GPU and a locally installed version of ffmpeg, the client only needs network access to the server and no GPU or ffmpeg locally.
Both and client and the server need a shared filesystem for this to work (so the server can write output to it, and client can read from it). In my usecase, smb works well if your (GPU) server is a windows machine, nfs works really well for linux setups.
This utility can be useful in a number of scenarios:
- You find passing through a (v)GPU to your virtual machines complicated
- You want to use the same GPU for ffmpeg in multiple virtual machines
- Your server has a weak GPU so you want to use the GPU from your gaming machine
- Your GPU drivers in one OS are not as good as another (AMD RX6400 never worked for me in linux, but did so in windows)
I’ve posted some instructions in the Github package README, please let me know if they are unclear in any way and I’ll try to help!
Here's the link: https://github.com/steelbrain/ffmpeg-over-ip
by NavinF on 10/4/24, 9:45 PM
Oh oof. I thought removing that requirement would be the whole point of something named "FFmpeg-over-IP". Shared filesystem usually involves full trust between machines, bad network error handling, and setting things up by hand (different config on every distro)
by steelbrain on 10/4/24, 6:01 PM
> Note that if hardware acceleration is configured in the calling application, the exact same hardware acceleration modes must be available on all configured hosts, and, for fallback to work, the local host as well, or the ffmpeg commands will fail.
I wanted to mix and match windows and linux, and it was clear rffmpeg wasn't going to work for me.
One plus rffmpeg does have is that it supports multiple target hosts, so it's useful if you want some load balancing action. Although you could do the same with ffmpeg-over-ip, just selecting the servers dynamically but rffmpeg does make it easier out of the box.
by qwertox on 10/4/24, 9:38 PM
Because if so, the word transcoding does not appear neither in this Show HN nor in the GitHub README.
And I can't think of any other use for this than to perform hardware-assisted transcoding on a remote machine.
Apparently it has nothing to do with OpenGL or CUDA, which are the primary uses for a GPU. And ffmpeg itself has more use cases than just transcoding files.
by maxlin on 10/5/24, 7:41 AM
Wrote it in C# and it runs both on Windows and Linux. The original need for this actually was to accelerate encodes a system I run on a cloud VM needs when I have either my desktop or laptop available, who then work as encode slaves and pick up jobs, run them and send the output files back. If no slaves are available, the system falls back to local CPU encode. Later I ended up using this using a local Windows server machine as the "client" the slaves also connect to to ask for jobs (actually the system runs inside a Unity project in that case because C# is awesome).
Probably a bit of a rare problem I hit with this is that different NVENC generations generate different enough bitstreams that they can't be concatenated together. From my pool of machines I found out only my RTX 2070 and RTX 3080 Mobile are compatible. GTX 970 and Quadro P5000 that I had laying around both were incompatible with that pool and with each other.
Interestingly I found no similar software to the chunked encoding in my system, but am chalking it up on me not searching hard enough or these being integrated deep in to commercial/private systems. It would make sense that big players like YouTube have something like this in place, as reducing latency for individual upload transcodes finishing is beneficial instead of limiting their speed to a single hardware encoding / software encoding node. It's the same amount of processing that needs to be done in the end anyway, so might as well use 10 nodes to complete single jobs really quickly one after another
by jauntywundrkind on 10/4/24, 9:14 PM
Submission from 6 months ago, https://news.ycombinator.com/item?id=39929602 https://www.youtube.com/watch?v=0RvosCplkCc
by slt2021 on 10/4/24, 8:49 PM
I dont meant to discourage you, but it is possible to replace your entire repo with a simple bash alias:
alias ffmpeg-over-ip='ssh myserver "ffmpeg \"\$@\""'
by steelbrain on 10/4/24, 5:51 PM
If you are wondering why the binaries are so large, it's because they are packaged-up node.js binaries. I tried to learn a compile-to-native language to rewrite this in so you won't have to download such bloated binaries but didn't get far. I learned Swift and still have a WIP branch up for it[2]. I gave up after learning that there's no well maintained windows http server for swift.
I'm currently on my journey to learn Rust. So maybe one day when I do, you'll see the binary sizes drop.
[1]:https://github.com/steelbrain/ffmpeg-over-ip/releases/tag/v3... [2]:https://github.com/steelbrain/ffmpeg-over-ip/tree/swift-lang
by VWWHFSfQ on 10/4/24, 8:37 PM
by wwalexander on 10/5/24, 12:33 AM
by LeoPanthera on 10/4/24, 11:55 PM
I suppose ssh would be tricky if you're combining multiple input files.
by leshokunin on 10/4/24, 8:26 PM
by seltzered_ on 10/4/24, 11:34 PM
Thinking of https://tuxphones.com/howto-linux-as-second-wireless-display... -> https://gitlab.com/tuxphones/side-displays but for those running android or ios
by steelbrain on 10/4/24, 5:52 PM
by mdrzn on 10/5/24, 8:39 AM
I have a VPS on OVH which uses ffmpeg to convert mp3 files from 320kbps to 128kbps, it runs at 32x real speed on the server, but it could run 100x faster on my desktop pc. If there was an easy way to let the VPS "run" ffmpeg from my machine, that'd be great.
by mrkramer on 10/5/24, 9:56 AM
What would be great is FFmpeg in the cloud with GUI for easier use.
by Am4TIfIsER0ppos on 10/4/24, 9:51 PM
by ptspts on 10/4/24, 8:32 PM
How to use it? Do you have example commands?
How is video data transferred between the client and the server?
Would it be possible to connect with SSH to a Linux server, using SFTP with FUSE or Samba with port forwarding for file sharing? This way the server could be zero-configuration (except that ffmpeg has to be installed, but the executable can also be transferred over SSH).