Random screen rotation on Raspberry PI 4

demolice

n3wb
Joined
Oct 3, 2019
Messages
6
Reaction score
2
Location
Czech Republic
Hello
I am using Raspbery 4B for viewing RTSP streams from multiple cameras at once. I am using 2 connected TVs to HDMI ports and displaying stream using omxplayer. On each TV is grid of 2x2 cameras. Problem is, second monitor (connected to HDMI1) keeps randomly rotates its whole screen upside down a then back to normal. It does not even stay rotated same time. On one Raspberry it stays rotated for couple of second and on another it keeps switching every 2-3 seconds. Streams from cameras runs fine

My camera types are:
  • DS-2CD2T43G0-I5
  • DS-2CD1643G0-I

I am not sure if the problem is in camera stream or wrong Pi configuration. I tried use another Raspberry, change settings Raspberry and on cameras (and reseting to default settings) without luck. Change Tv to another (event with different model and manufacturer) does not help. Screen always rotates on monitor on HDMI1, HDMI0 does not rotate.

I am using Raspbian Buster 10 Lite (without GUI, terminal only) kernel version 4.19.97-v71+, instaled from NOOBs.
I am using this commands to run omxplayer in window with specific location

Code:
screen -dmS STREAM1 sh -c 'omxplayer --live --refresh --nodeinterlace --display 2 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 20 --win "0 0 960 540" rtsp:/login:passwd@192.168.0.100:554/Streaming/Channels/102/'
screen -dmS STREAM2 sh -c 'omxplayer --live --refresh --nodeinterlace --display 2 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 25 --win "960 0 1920 540" rtsp:/login:passwd@192.168.0.101:554/Streaming/Channels/102/'
screen -dmS STREAM3 sh -c 'omxplayer --live --refresh --nodeinterlace --display 2 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 25 --win "0 540 960 1080" rtsp:/login:passwd@192.168.0.102:554/Streaming/Channels/102/'
screen -dmS STREAM4 sh -c 'omxplayer --live --refresh --nodeinterlace --display 2 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 25 --win "960 540 1920 1080" rtsp:/login:passwd@192.168.0.103:554/Streaming/Channels/102/'
screen -dmS STREAM5 sh -c 'omxplayer --live --refresh --nodeinterlace --display 7 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 25 --win "0 0 960 540" rtsp:/login:passwd@192.168.0.104:554/Streaming/Channels/102/'
screen -dmS STREAM6 sh -c 'omxplayer --live --refresh --nodeinterlace --display 7 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 25 --win "960 0 1920 540" rtsp:/login:passwd@192.168.0.105:554/Streaming/Channels/102/'
screen -dmS STREAM7 sh -c 'omxplayer --live --refresh --nodeinterlace --display 7 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 25 --win "0 540 960 1080" rtsp:/login:passwd@192.168.0.106:554/Streaming/Channels/102/'
screen -dmS STREAM8 sh -c 'omxplayer --live --refresh --nodeinterlace --display 7 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 20 --win "960 540 1920 1080" rtsp:/admin:Liebherr1100@192.168.0.107:554/Streaming/Channels/202/'
Here is my /boot/config.txt

Code:
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=82

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=off

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

# NOOBS Auto-generated Settings:
gpu_mem=512
#hdmi_enable_4kp60=1
hdmi_ignore_edid=0xa5000080
hdmi_ignore_cec=1
hdmi_pixel_encoding=2
hdmi_force_mode=1
hdmi_mode and hdmi_group is set from Raspberry running GUI with same model of TV (also 2 monitor connected to Rasperry using HDMI) based on command tvservice -s which returns
Code:
pi@obrazovka0:~ $ sudo tvservice -s
state 0xa [HDMI CUSTOM RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
but on Raspberries with cameras it fails to detect TV

Code:
pi@obrazovka3:~ $ sudo tvservice -s
tvservice-client: Failed to connect to TV service: -1
state 0x0 [TV is off], 3069491816x4287062190 @ 0.00Hz, progressive
Any help is appreciated. Thank you
 

demolice

n3wb
Joined
Oct 3, 2019
Messages
6
Reaction score
2
Location
Czech Republic
I think find solution for my problem.
Now I use commands like this to spawn omxplayer

Code:
omxplayer --live --nohdmiclocksync --display 2 --orientation 0 --aspect-mode stretch --video_fifo 5 --video_queue 5  --aidx -1 --fps 20 --win "0 0 960 540" rtsp:/login:passwd@192.168.0.100:554/Streaming/Channels/102/'
I guess the problem was that pi tried to put refresh rate that monitor did not support?
 

Nick6

n3wb
Joined
May 15, 2020
Messages
18
Reaction score
2
Location
EU
Hi demolice
I'm using omxplayer as well on RPi's and also tried Raspbian Buster Lite but couldn't manage to get omxplayer start automatically.
Can you please elaborate on how you achieved this and how you start multiple instances of omxplayer?
TIA
Nick
 

demolice

n3wb
Joined
Oct 3, 2019
Messages
6
Reaction score
2
Location
Czech Republic
Hi demolice
I'm using omxplayer as well on RPi's and also tried Raspbian Buster Lite but couldn't manage to get omxplayer start automatically.
Can you please elaborate on how you achieved this and how you start multiple instances of omxplayer?
TIA
Nick
Hi
I am using my own python script to spawn omxplayer proces. Something like

Python:
playercmnd = ["/usr/bin/omxplayer", "--live", "--nohdmiclocksync", "--display", "2", "--video_fifo", "5", "--video_queue", "5",  "--aidx", "-1", "--fps", "30", "--win", "0 0 960 540", "rtsp:/login:passwd@192.168.0.100:554/Streaming/Channels/102/"]
subprocess.Popen(playercmnd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
Note: this is part of my python3 script which is far from perfect, but it works. If you would be interested i could post it somewhere

Also you can look at this project (Rpisurv)
SvenVD/rpisurv
 
Top