LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-04-2014, 03:27 PM   #1
tonj
Member
 
Registered: Sep 2008
Posts: 546

Rep: Reputation: 37
remote control over ssh


I'm trying to control vlc media player over ssh on another machine with a bash script. I'm a newbie with scripts and I'm using two machines, A and B
On machine B I can start a video playing with these commands:
Code:
[user@machine-B ~]$ screen -S vlc
then in the screen....
Code:
[user@machine-B ~]$ vlc -I rc video.ogg
video starts playing and if I type certain commands into machine-B (like play, stop seek etc) I can control the video.
then from machine A I can log in to the screen using remote ssh thus:
Code:
[root@machine-A ~]# sshpass -p <password> ssh -t user@machine-B screen -r vlc
but I need to create a bash script that sends commands into this screen from machine A, commands like stop, play seek etc. I've tried script entries like 'ech0 this-and-that' but it doesn't work. I've also tried xdotool commands but they don't work either. Can a bash script send commands into this screen from machine A? thanks for any help.

Last edited by tonj; 12-04-2014 at 03:33 PM.
 
Old 12-04-2014, 06:14 PM   #2
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Rep: Reputation: 50
Why do you want to use screen? It seems unnecessary and adds complexity.

if you use mplayer instead of vlc, you could use the -input file=<named_pipe> argument to spawn an mplayer that reads pause|play etc from the named_pipe file.

Quote:
# create the named FIFO. Only need to do this once
ssh user@machine-B "mkfifo named_pipe"
# spawn mplayer listening on pipe
ssh user@machine-B "mplayer -input file=named_pipe <video_file>" &
#pause
ssh user@machine-B "echo p >named_pipe"
 
Old 12-05-2014, 01:00 AM   #3
tonj
Member
 
Registered: Sep 2008
Posts: 546

Original Poster
Rep: Reputation: 37
thankyou for your response, it's taken me three days of hair pulling just top get vlc working by remote control (lol), I'm not sure if I can face a whole new project with mplayer. You're correct I perhaps don't need to do screen, I can make vlc play without it however once it's started playing I'm still stumped regarding a bash script that can send commands like play, pause, seek etc. If I get a brick wall with vlc I will try your mplayer suggestion.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Where to start with SSH for a newbie? remote control of a PC in France (from Germany) floppy_stuttgart Linux - Newbie 13 04-01-2014 03:20 AM
[SOLVED] how to install gui to Centos 6.3 via SSH w/remote control beefydog Linux - Newbie 5 02-12-2013 11:53 AM
LXer: remote control android, a reverse ssh tunnel LXer Syndicated Linux News 0 05-18-2010 10:50 AM
remote control, X over SSH RWBlue01 Linux - Server 7 08-16-2009 04:05 PM
remote control through ssh sycamorex Linux - General 10 11-23-2008 04:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration