1

If I start a process with xterm like this (where omxplayer is the process xterm is starting):

xterm -fullscreen -fg black -bg black -e omxplayer -o hdmi -r %f

Is it possible for me to write to xterm's standard input via a different process to control the omxplayer? If so, how?

(I'm pretty unfamiliar with linux terminology so please excuse if I'm stating this incorrectly.)

Update

As per @strugee's comment, I'm not aiming to write to xterm's standard input, but rather I'm aiming to write to omxplayer's standard input.

  • note: you wouldn't be writing to your xterm's stdin. you'd either be writing to the stdin of the shell running inside the xterm, or you'd be writing to omxplayer's stdin. – strugee Nov 10 '13 at 16:15
  • 1
    thanks strugee, I've updated my question to reflect your point. I have to have a bit of a think about all this to get my head around what I'm actually trying to achieve here. – DaveDev Nov 10 '13 at 16:21
  • absolutely! I don't want to explain it all in a comment, but you might want to ask a new question about the difference between xterm's stdin and the shell inside the xterm's stdin, if it doesn't make sense already. – strugee Nov 10 '13 at 16:27
  • omxplayer isn't controlled from stdin. It has a threaded, event based interface, meaning it takes control of keyboard input as the foreground process. That's why you don't need to hit return, etc, you just hit a key. Controlling stuff like that remotely is complicated (in fact, controlling it remotely may not be possible at all). – goldilocks Nov 10 '13 at 16:47
  • Okay, in fact I may be wrong about that -- you can do this by putting the terminal into "raw" mode and polling stdin. So that could be how it happens, in which case writing to stdin should work. – goldilocks Nov 10 '13 at 17:01
1

Way of running screen pseudo tty

There you need to run your command in an intermediary tty manager.

screen -d -m omxplayer -o hdmi -r %f

than

xterm -fullscreen -fg grey -bg black -e screen -R

This let you detach and reconnect your screen anytime you want: hit Ctrl+a, than d for detach from screen session and screen -R in any terminal console to reconnect.

Have a look at man screen for more infos.

-1

In order write to omxplayer's standard input you can do this:

echo 'hello'> /proc/$(pidof omxplayer)/fd/1

Update

My previous advice was poorly documented and wrong, I apologize for it.

This link contains pointers to some projects that attempt to control omxplayer by other means, but they often need to run it directly, without xterm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.