16

Any local terminal text (login prompt, etc) is showing through areas of the screen that are not covered by video (i.e. the black bars on the top and bottom) when I use a remote terminal to play video with omxplayer. If I wait 10-15 minutes, the local terminal goes totally black due to inactivity which fixes the problem, but that's kind of a lame workaround.

I'm thinking that using omxplayer locally would sidestep the problem, but I can't verify since my RPi hates all of my keyboards. I also don't want to play video that way long-term.

How can I black out the local terminal so it doesn't show through when using a remote terminal to play videos over HDMI?

Ghanima
  • 15,855
  • 15
  • 61
  • 119
Wisteso
  • 295
  • 1
  • 2
  • 8

6 Answers6

10
sudo sh -c "TERM=linux setterm -foreground black >/dev/tty0"
sudo sh -c "TERM=linux setterm -clear all >/dev/tty0"

This will change the font color to black, than clears the screen.

Or in a single line:

sudo sh -c "TERM=linux setterm -foreground black -clear all >/dev/tty0"

And set it back to normal:

sudo sh -c "TERM=linux setterm -foreground white -clear all >/dev/tty0"
mcpgza
  • 116
  • 1
  • 3
  • That's a pretty good solution. It still leaves a blinking cursor in the upper left corner though. – Wisteso Oct 20 '12 at 20:17
  • run sudo sh -c "TERM=linux setterm -foreground black >/dev/tty0" before the above command :) – mcpgza Oct 20 '12 at 20:42
  • that did the trick. I'm concerned about it messing with the terminal when not playing movies (like when shutting down), but that can be a different battle. – Wisteso Oct 21 '12 at 02:26
  • Please update the answer to include the full solution. – Alex Chamberlain Oct 21 '12 at 08:28
  • i try this solution on my raspberry but only clear goes ok foreground is executed but the font color doesn't change... –  Dec 17 '12 at 16:23
  • 1
    I added this to /etc/rc.local so that it is executed automatically on boot – NimsDotNet Apr 08 '14 at 18:28
8

omxplayer now has an option to set the background to black.

omxplayer -b

It works both on the terminal and in X. This feature should be in the current version available in raspbian.

Tristan
  • 81
  • 1
  • 1
4

The -r (--refresh) option to omxplayer clears the screen when it resets the video resolution and whatnot.

-r / --refresh                 adjust framerate/resolution to video

An alias could be useful here:

alias omxplayer='omxplayer -r -o hdmi '

Which will then always refresh (clear) the screen and send audio to the hdmi output. And yes, the trailing space in the alias is intentional as it allows further tab-completion to occur. (Very useful!)

As for the blinky cursor, I rarely (!) ever use a keyboard with my pi's, always logging in remotely (I've built an SD card maker, preconfiguring things), so I added the following into /etc/rc.local:

# turn off console blanking
setterm -blank 0 -cursor off

/etc/rc.local is run as root during boot and this turns off the console blanking which tries to be helpful when no (physical) keyboard activity is sensed, and also turns off the cursor.

Since resetting the video often restores the blinky cursor, I have a script I run to send commands to the console (tty1 actually):

#!/bin/bash
#
# send 'setterm' commands to /dev/tty1 (physical console)
setterm $* | sudo tee /dev/tty1 > /dev/null

So anytime the cursor reappears, I type:

tty1 -cursor off

and it's gone! Of course, you'll need to set up your user with sudo privileges, at least for the tee command. (look up /etc/sudoers and /etc/sudoers.d) The script could be edited to always turn off the cursor if one wished.

Or just go mad with a combination of these:

alias omxplayer='tty1 -cursor off; omxplayer -r -o hdmi '

Which would ensure the cursor is off, then start omxplayer. Play with it!

lornix
  • 1,066
  • 8
  • 13
0
set PS1=""
setterm -cursor off
clear

And voila, you're screen is black, even after omsplayers stops.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
shured
  • 1
  • 1
0

Here is what I do (in a script):

setterm -cursor off;
clear;
omxplayer -o hdmi "video file.mkv" | echo "";
setterm -cursor on;

If you do use a script to call omxplayer, you might want to add

complete -F _longopt watch

to your .bashrc (or similar for whatever terminal you use) so you get filename tab-completion.

Raphael
  • 556
  • 1
  • 6
  • 15
  • I sense a C/C++/Java/PERL programmer here... You only need the trailing semicolons if you're stringing all those commands on one line. Of course, I AM a C/C++/Java/PERL/etc programmer, so I do this by habit too. – lornix Jul 22 '13 at 04:16
0

I configure my Raspberry Pi to boot straight into the pi user, then in ~/.profile I add the following line:

setterm -foreground black -clear all && sleep 600

This works because the Pi will go to DPMS blank mode after 10 minutes anyway, and this just ensures that you see a blank screen "behind" omxplayer till then.

Anselan
  • 101
  • 1