How to use ffmpeg on a remote machine via ssh

I have three computers on the local network,

one start of ubuntu,
one runs openSuse
and my server works with Archlinux.

I managed to get ffmpeg to work fine on my server.

I would like to write a script that claims to install ffmpeg on the local computer, but will actually just use the ffmpeg server .

Example:

on openSuse, I would like to call:

ffmpeg -i file.avi out.flv

and then get the normal output, as you would expect,
but I want it to use ffmpeg in archlinux.

any advice on how I get this to work.
(preferably in Ruby)

EDIT: ssh

+2
2

ruby-fu, , , !

,

sudo yum install rubygems
sudo gem install net-ssh net-sftp highline echoe

( ),

#!/usr/bin/env ruby

require 'rubygems'
require 'net/ssh'
require 'net/sftp'
require 'highline/import'

file = ARGV[ 0 ]                  # filename from command line
prod = file + "-new"              # product filename (call it <file>-new)
rpath = "/tmp"                    # remote computer operating directory
rfile = "#{rpath}/#{file}"        # remote filename
rprod = "#{rpath}/#{prod}"        # remote product
cmd  = "mv #{rfile} #{rprod}"     # remote command, constructed

host = "-YOUR REMOTE HOST-"
user = "-YOUR REMOTE USERNAME-"
pass = ask("Password: ") { |q| q.echo = false }  # password from stdin

Net::SSH.start(host, user, :password => pass) do |ssh|
        ssh.sftp.connect do |sftp|
                # upload local 'file' to remote 'rfile'
                sftp.upload!(file, rfile)

                # run remote command 'cmd' to produce 'rprod'
                ssh.exec!(cmd)

                # download remote 'rprod' to local 'prod'
                sftp.download!(rprod, prod)
        end
end

,

dylan@home ~/tmp/ruby) ls
bar  remotefoo.rb*
dylan@home ~/tmp/ruby) ./remotefoo.rb bar
Password: 
dylan@home ~/tmp/ruby) ls
bar  bar-new  remotefoo.rb*
+2

, :

  • NFS , , ssh, . , .

  • NFS, ffmpeg , - realname ( script), , .

  • NFS, parse ffmpeg scp .

+2

Source: https://habr.com/ru/post/1708485/


All Articles