-1

I am using Arch Linux arm on a Raspberry Pi model B to create a small streaming solution, where the Pi is permanently connected to a TV.

Using the 'livestreamer' package, I can stream videos and pipe them to 'omxplayer'

This is the command I run in bash:

$ livestreamer https://www.youtube.com/watch?v=7EKkAy-PfN4 best -np "omxplayer -b -o hdmi"

The 'best' argument specifies to stream the video in best quality. '-np' creates a named pipe to the video player. This is necessary as simply using '-p' for a non-named pipe does not work. The '"omxplayer -b -o hdmi"' specifies to use omxplayer to play the video stream, to black the background of the video so the terminal does not show and to use hdmi for the audio output.

The problem I am having is that when the stream is completed, the terminal is left in a state where I am unable to see the commands I type but I can still execute them. The terminal resembles the state which is normally found when entering a password where the typed character cannot be seen.

This only occurs when the stream ends and the program ends itself. If the program is interrupted by the keyboard with Ctrl-C then the terminal remains normal.

Using omxplayer on its own does not cause this problem.

Please help?

Edit: This problem occur in both normal usage with keyboard connected to Pi AND over SSH.

jai_
  • 49
  • 1
  • 8
  • Using 'stty sane' allows for the typed commands to be seen again thanks to the answer by @Emil Kakkau, however, why is the issue caused in the first place and can it be prevented? – jai_ Jan 13 '15 at 12:08
  • Run `ls -l /proc/$$/fd/ > tmpFile` before you run `stty sane` as `Emil` suggested to see where your file descriptors were pointing previously (by using `cat tmpFile` after you can see output). Note that the shell prompt is displayed by default to file descriptor 2, not 1. – Reinstate Monica Please Jan 13 '15 at 12:38

1 Answers1

2

try to switch on the tty using

stty echo

you can try in another shell turning echo off and on again, like

stty -echo // aftewards type something you should not see anything
stty echo // this must be a kind of blind typing
Marc Bredt
  • 905
  • 5
  • 13
  • Thanks for your response. Looking at the 'stty' man page, I used the command 'stty sane'. This does seem to fix the problem and I am very grateful for your solution. However, do you have any idea why this occurs in the first place? This seems like treating the symptom but not the cause. – jai_ Jan 13 '15 at 12:04
  • perhaps descriptor handling or processing in livestreamer. have you tried another streaming tool and see if that causes this error too? – Marc Bredt Jan 13 '15 at 12:13
  • I am currently unaware of any other live streaming solutions that can be run via command line on the Raspberry Pi. One of the reasons I do use livestreamer is due to the large support it has for many online streaming urls and formats: https://livestreamer.readthedocs.org/en/latest/plugin_matrix.html Including twitch.tv, youtube.com and crunchyroll.com – jai_ Jan 13 '15 at 12:19
  • i think it belongs to livestreamer. perhaps due to project size resetting tty state has been left out. producing such errors is explained at http://askubuntu.com/questions/171449/shell-does-not-show-typed-in-commands-reset-works-but-what-happened. perhaps running eval or backticking sub commands will fix this, like explained above. hope this helps. greets – Marc Bredt Jan 13 '15 at 12:27