How to input a network file to ffmpeg
Solution 1
You can use sshfs
to make the remote files appear in a directory on the local machine.
You don't say what distro you're using on your client, but this is cribbed from the Ubuntu sshfs documentation:
- Install the
sshfs
package (aptitude install sshfs
) - Add your user to the
fuse
group (sudo gpasswd -a username fuse
) - Mount the filesystem using the
sshfs
command
To use sshfs
, make yourself a directory (we'll call this /mountpoint
), and do
sshfs -o idmap=user remote_user@remote_server:/remote/directory /mountpoint
The remote files will now appear in /mountpoint
, but are in fact still on the remote server. Any changes you make will be made remotely and not locally.
To unmount the directory, do
fusermount -u /mountpoint
Solution 2
If you have ssh access to the remote system, you could do something like
ssh server cat path/to/video | ffmpeg -i - [...]
The -
causes ffmpeg to read from stdin instead of a file.
Caveat, though, not all formats support pipes. See https://stackoverflow.com/questions/12999674/ffmpeg-which-file-formats-support-stdin-usage
Related videos on Youtube
saketrp
Updated on September 18, 2022Comments
-
saketrp almost 2 years
My problem is this. I have access to a server that hosts many video files, most of them are very large and not well compressed. I intend to make a reduced quality smaller size copy of these on my local machine for better access.
The problem is that the server does not have ftp access. I can scp the files to my machine and then use ffmpeg to reduce the size, but I'll run out of space if I copy all of the files locally.
I am looking for a way to directly input a network file to ffmpeg, that way I'll be able to write a script that will overnight get me all the videos in reduced size.
-
Olivier Dulac over 10 yearsYou should edit the question : As it stands, its a "XYProblem": asking to do Y, when you really want to do X. You really want to input a network file remotely, not "using scp" (It sounds like: "how can I shave my beard using a bycicle" : the real need is shaving the beard, not really using a bycicle ^^) Don't mix your need with the means to do so (so that you can find better means, using people's feedback!)
-
-
MikeW almost 5 yearsThe video device might not support the block size used by 'cat' - if you get an error, use 'nc' instead of 'cat' - see also stackoverflow.com/a/46362136/1755628