Screen blanking and cvlc

i run cvlc from the console in background(&) and it works fine. but there’s a problem: screen blanking doesn’t work . even setterm --blank force doesn’t work. without running cvlc it works as expected. no reaction to --no-disable-screensaver. what could be the problem and how to fix it?

ps: i don’t need a desktop, i need a monitor for a remote camera. the fact that vlc(cvlc) works from the console is great and completely suits me, but i need the screen to turn off after a timeout and turn on when i tell it to

other players behave the same way. it happens in raspbian too. how i can get around this?

the monitor doesn’t turn off even after “echo off > /sys/class/drm/card0-HDMI-A-1/status” (but it does turn off after closing cvlc). this is a serious contender for the miss universe title :\

This file is ready-only, the correct one would be
/sys/class/drm/card0-HDMI-A-1/dpms but this will also not work, because the dpms will not work while cvlc or other video app is running.

You can try

vcgencmd display_power

Or if you monitor supports cec:

# off
echo "standby 0" | cec-client -s

# on
echo "on 0" | cec-client -s

i think i’ve tried everything and it either doesn’t work or it works after cvlc(not only cvlc, others behave the same way. there’s a much deeper problem here) is closed. what you suggested doesn’t work(in theory, the hdmi-d-sub adapter blocks this, but i won’t buy a modern monitor for camera only. besides, i’m 99% sure that it won’t work even without obstacles on the cable). that is, it is possible to play videos in the console, but it is absolutely useless(it’s even impossible to switch to another terminal)

but for the sake of science need to try with a different monitor :smiley:

Hm ok I asked AI, because I have not more ideas :skull_and_crossbones::

The uncomfortable truth (no sugarcoating)

Linux console + KMS video playback is fundamentally incompatible with display power management and multiterminal use.

There is no workaround that:

  • keeps video playing
  • allows DPMS
  • allows VT switching
  • works with VGA adapters

What actually works (realistic options)

:white_check_mark: Option A — accept “single-purpose appliance”

  • one VT
  • one player
  • no blanking
  • no switching
    This is how console KMS video is meant to be used.

:white_check_mark: Option B — stop video → blank → resume

Only workable software approach.

Example logic:

kill -STOP cvlc
vcgencmd display_power 0
# later
vcgencmd display_power 1
kill -CONT cvlc

Works only if:

  • HDMI (not VGA)
  • firmware supports it
  • player tolerates pause

:white_check_mark: Option C — external power control (most reliable)

Since VGA ignores DPMS anyway:

  • HDMI/VGA switch
  • relay
  • smart plug
  • monitor power button via GPIO

This is exactly how industrial camera displays are built.


:white_check_mark: Option D — minimal X11 (yes, really)

I know you don’t want a desktop, but:

  • X11 with:
    • no window manager
    • one fullscreen window
  • gives you:
    • DPMS
    • input handling
    • VT switching
    • screensavers

Overhead is minimal (~30–40 MB RAM).

Ironically, this is more correct than console video.

yes, i was looking in side of option D, but since i don’t use linux at all(i use obsd, and only for the router, and of course without a gui), i haven’t been able to implement it in practice yet :frowning:

I tried the X11-way but i can not acticate DPMS, I don’t know why. I use HDMI, no DVI adapter, the driver is modesetting with KMS, but still no luck.
Maybe fullscreen VLC is blocking DPMS?

yes, it’s clearly a vlc issue here, since dpms stops working when vlc is running(otherwise dpms would either always work or always not work), but vlc’s support say that these are raspbian problems, not theirs. maybe they’re right, because if you let fascists rape your wife, then that’s definitely your problem(there is the same problem with other players), not the fascists

can you tell me if there’s a reliable way to launch a gui(any)? i understand that everything is broken(even the official image for the “pi imager” is broken :D) here, and not just the graphical mode, but i managed to launch xfce once. but i can’t do anymore, and i don’t remember what i did that time. i want to try option D in the opposite direction, cutting piece by piece until the kiosk mode remains. it’s difficult to do it in the forward direction because i don’t understand whether i’m doing something wrong or whether the problem is with the broken system. i’d do this on a slightly less broken raspbian(the wayland installation is broken there, but at least xorg is being installed), but their fascist restrictions on root use create no less problems for my mental state than the broken graphical mode here :\

if an xserver has been installed, you should be able to run startx from CLI

IDK, I think it’s intended that a fullscreen app takes control over the display completely.

I already tried with xserver but it never started with DPMS enabled. IDK if a full desktop environment is necessary, maybe a window manager would be enough? i will try that later with openbox.

there is another problem with “option D”: in x11, i was able to display on the screen only through fbdev. the same xterm started and displayed(but no input works). cvlc refuses to work like this. an attempt to use values from 99-v3d.conf did not give the desired result- xterm starts, but does not display on the screen. i’m very bad in this and tired. on desktop with raspbian trixie and wayland, vlc for 1080p h264 consumes about 30% cpu(somewhere at 50% the picture starts to tear)- this is much better than the shit i had after numerous automatic raspbian upgrades, i can live with it somehow. of course, it is very sad that it is not possible to make a simple solution for a simple task

Hm I only installed xinit and xserver, then ssh’d into the machine, created a .xinit and started also xserver via ssh on tty2. I also had to create a normal user bc VLC doesn’t like it to get executed by root. The only thing which did not work was DPMS. Maybe we need a “full” xserver stack with a window manager? Xserver was never startet with DPMS extension in my tests.

But I wonder what you main use case is. You don’t like to see the last frame of the video when the playback stops and the video gets “stuck” on the last frame? Or why do you want to switch off the screen?
If you just want a black screen, you could just play a one-frame-video after the video before, which is made of just one black frame :smiley:

Here is some workaround without openbox, just xserver and cvlc:
.xinitrc of the vlc user:

#!/bin/sh
xsetroot -solid black
cvlc --fullscreen --play-and-exit /home/vlcuser/test.mp4
exec xterm -geometry 1x1+9999+9999 -e bash

and then the vlcuser executes following on console:

startx -- :0 vt2

The display stays black, but does not shut down

the problem with running vlc as root is solved with sed -i ‘s/geteuid/getppid/’ /usr/bin/vlc .
i don’t understand what i’m doing wrong. i install xserver-xorg and xinit. if i start X now(manually or via autologin), nothing works. even if i install x11 and lxqt(or lxde, or xfce) via dietpi-software, nothing works– just a black screen. some additional steps are required(i lost which ones) for this to work. so, it’s broken out of the box.
yes, dpms doesn’t work on dietpi because it’s blocked via a file(there’s probably some grand design behind this). i don’t remember what it’s called, but its template is .*dpms.*.conf, and it’s located somewhere inside either /etc/X11/ or /etc/xdg/. moreover, it is better not to delete this file, but to change “Disable” inside to “Enable”, since the file will be created again.
the scenario is obvious: the monitor shows the picture only when(in fact, the picture is always sent, regardless of the monitor status, and vlc constantly displays it, but it doesn’t matter) when a motion event comes from the camera(netcat is responsible for this(as a web server. it is assumed that users of chinese HiWatch cameras will buy an hardware server and connect the camera to it, but i decided that this was too cool for me :D) and grep), and does not light up the room, and does not waste energy when nothing is happening. the camera sends events while there is movement present and this can happen at high speed, the default bundle of swayidle and wlopm for wayland cannot withstand such a scenario, so i have to kill and launch swayidle at the same speed. in general, everything is very simple, it couldn’t be simpler

ps: without x11, only in the console, it can make easier- via gpm(for respond to mouse movement(i have a remote connected to usb)) and ydotool, and through ydotool emulate a key press(even one that doesn’t physically exist)- then we won’t need to force the screen to turn on(setterm and dpms will do it automatically)

here’s something else i just noticed. it turns out that turning off the screen doesn’t work even in x11 if cvlc is running(it ignores the --no-disable-screensaver option). but in the console, cvlc is the one that runs

Yes, thanks for the hint!
I didn’t know there is /etc/X11/xorg.conf.d/98-dietpi-disable-dpms-conf
I deleted it and now DPMS is working.

DPMS (Display Power Management Signaling):
  Standby: 600    Suspend: 900    Off: 1200
  DPMS is Enabled
  Monitor is On

What do you mean by that?
It doesn’t execute what you specify in your .xinitrc?


OK so for your usecase DPMS will never work when VLC is playing a stream. Most video players will block DPMS and there is nothing youcan do about it.
I tried it, even with a motion stream. VLC just don’t give a f**k, even when DPMS shows the monitor as off.

But it’s working with mpv!
I run now everything as root.
.xinitrc:

mpv --vo=x11 --hwdec=vl2m2m --profile=low-latency --fullscreen --no-audio --no-stop-screensaver http://localhost:8081/

And on the console I just execute as root:

startx

I tried also drm as output but it was too laggy, but runs smooth with x11.
I can now also switch off the display with xset dpms force off, while it’s streaming!

BTW I use 1280x960 with 5fps and the RPi3 CPU usage is around 1.00

I guess you can control that via event script in motion.