I've plugged my SLP2 card into my StereoPi2, and used the web admin to configure the board to output a video stream of HDMI 1920x1080@60p (CEA 16:9 mode 16)
The display I'm using is a 2560x1440 screen sourced off of Amazon: https://www.amazon.com/gp/product/B0826YHTLM
The problem that I am having is that the stream from the pi is being rotated 90 degrees from the screen orientation, then stacked and output twice and two fractional times on the screen:
Is there a way to get the StereoPi to output a 2560x1440 stream, or to pass additional information to the screen regarding how the video should be rotated and scaled?
Customization of HDMI output modes on SLP image
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
- Realizator
- Site Admin
- Posts: 900
- Joined: Tue Apr 16, 2019 9:23 am
- Contact:
Re: Customization of HDMI output modes on SLP image
Hi glowingskull,
Wow, you have a tricky task.
To say briefly, not all HDMI screens are supported by Raspberry Pi OS out-of-the-box. In some cases, you should manually set the correct scxreen resolution and mode inside the config.txt file. You can take a look at the official documentation from Raspberry Pi Foundation.
Most HDMI screens for Raspberry Pi have a list of settings to put in this configuration file. For example, we got a similar issue with the 90-degree rotated image and settings for the 5" AMOLED screen. You can find the details in this article on our blog.
To fix your issue, you need the setting for the Raspberry Pi. It does not matter which board you are using - Raspberry Pi 4 or StereoPi with CM4. They have the same settings.
p.s. I see some strange note in your screen description on Amazon: "Only Support Dedicated video card, need GTX960 Graphics"... We decided to keep the current design as-is for this batch.
Wow, you have a tricky task.
To say briefly, not all HDMI screens are supported by Raspberry Pi OS out-of-the-box. In some cases, you should manually set the correct scxreen resolution and mode inside the config.txt file. You can take a look at the official documentation from Raspberry Pi Foundation.
Most HDMI screens for Raspberry Pi have a list of settings to put in this configuration file. For example, we got a similar issue with the 90-degree rotated image and settings for the 5" AMOLED screen. You can find the details in this article on our blog.
To fix your issue, you need the setting for the Raspberry Pi. It does not matter which board you are using - Raspberry Pi 4 or StereoPi with CM4. They have the same settings.
p.s. I see some strange note in your screen description on Amazon: "Only Support Dedicated video card, need GTX960 Graphics"... We decided to keep the current design as-is for this batch.
Eugene a.k.a. Realizator
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
Re: Customization of HDMI output modes on SLP image
The display_rotate parameter noted in this blog post doesn't seem to work; I've tried it on a couple of different monitors and settings versions and the signal has been displayed the same on both this screen and on a standard desktop monitor. So I'll keep playing with the other options in that file.
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
Re: Customization of HDMI output modes on SLP image
The stereopi.local web console doesn't work for this; it's too resource-constrained. I had to ssh in with:
The screen I have is https://www.edid.tv/edid/1135/ which has a few more pixels than the one used on your blog post.
I was able to get an EDID dump from the monitor, so following https://www.raspberrypi.com/documentati ... eo-options I think I should move the edid.dat to /boot and set hdmi_edid_file=1 in /boot/config.txt
Code: Select all
username: root
password: root
I was able to get an EDID dump from the monitor, so following https://www.raspberrypi.com/documentati ... eo-options I think I should move the edid.dat to /boot and set hdmi_edid_file=1 in /boot/config.txt
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
Re: Customization of HDMI output modes on SLP image
Okay, so doing that got a different set of options available in the dropdowns, but none of the modes there are actually functional. Even powercycling the screen between mode switches doesn't get me anything other than black screen.
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
Re: Customization of HDMI output modes on SLP image
https://learn.adafruit.com/using-weird- ... thing-else and the EDID dump at https://www.edid.tv/edid/1135/ got me the contents I needed:
Thankfully, I didn't need to provide a nonstandard aspect ratio or calculate an hdmi_timings line, though the Adafruit guide looks like it would have walked me through that.
Next up: getting the stereopi's video output to rotate to match the screen's output, so it isn't heavily letterboxed strip in the middle of the screen.
Code: Select all
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=87
hdmi_cvt=1440 2560 50
Next up: getting the stereopi's video output to rotate to match the screen's output, so it isn't heavily letterboxed strip in the middle of the screen.
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
Re: Customization of HDMI output modes on SLP image
I was following the instructions in https://stereopi.com/blog/diy-vr-headse ... y-just-135 to try to get the rotated display output. Notably, this command:
That command as specified gives me an output on the screen, but it contains heavy green padding and the video doesn't update past the initial image.
If I update the command to match my screen dimensions, the command doesn't run:
A command seen elsewhere on this forum did display video on top of the terminal that appears onscreen when you stop the scripts.
Therefore, I decreased the vertical height of the video output. It works at 897px tall, but not 898px
So I suspect it's got something to do with the shape and size of the video output?
Any ideas, @Realizator?
Code: Select all
./raspivid -3d tb -w 720 -h 1280 -fs -t 10000
If I update the command to match my screen dimensions, the command doesn't run:
Code: Select all
root@stereopi:/opt/Cosmostreamer-NG# ./bin/raspivid -3d tb -w 1440 -h 2460 -fs -t 10000
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
Code: Select all
./bin/raspivid -3d tb -w 1280 -h 480 -fs -t 10000
Code: Select all
root@stereopi:/opt/Cosmostreamer-NG# ./bin/raspivid -3d tb -w 1440 -h 898 -fs -t 10000
mmal: mmal_vc_port_enable: failed to enable port vc.ril.video_encode:in:0(I420): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.ril.video_encode:in:0(I420))0x983c0 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
mmal: main: Failed to connect camera video port to encoder input
mmal: Out of resources (other than memory)
mmal: Failed to run camera app. Please check for firmware updates
root@stereopi:/opt/Cosmostreamer-NG# ./bin/raspivid -3d tb -w 1440 -h 897 -fs -t 10000
Any ideas, @Realizator?
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
Re: Customization of HDMI output modes on SLP image
What I'd really like to do is customize what shows on the attached HDMI screen at boot.
I found the setting in the web admin Menu > Camera Settings > Camera > 3d Mode > TB, which got the video into the desired top/bottom configuration. There's an option in Menu > Camera Settings > Video > Resolution to change the output stream, and that does sometimes change the aspect ratio of what displays on the screen, but there doesn't seem to be a way to manually set the video resolution that's output to the admin. I dug around in the code and found no way to control that.
appears to activate the screen by running , which is a wrapper around the ELF .
This seems like a much less useful set of arguments compared to raspivid in the same directory. What does Cosmostreamer do that raspivid doesn't? Is Cosmostreamer necessary for the web frontend? Dose Cosmostreamer have user-configurable video sizes?
I found the setting in the web admin Menu > Camera Settings > Camera > 3d Mode > TB, which got the video into the desired top/bottom configuration. There's an option in Menu > Camera Settings > Video > Resolution to change the output stream, and that does sometimes change the aspect ratio of what displays on the screen, but there doesn't seem to be a way to manually set the video resolution that's output to the admin. I dug around in the code and found no way to control that.
Code: Select all
/opt/Cosmostreamer-NG/run.sh
Code: Select all
/opt/Cosmostreamer-NG/bin/display.sh
Code: Select all
/opt/Cosmostreamer-NG/bin/display
Code: Select all
root@stereopi:/opt/Cosmostreamer-NG/bin# ./display --help --verbose
Display for Cosmostreamer NG
Usage:
--type | -t <type> - camera app type
--hf - flip horizontaly
--vf - flip verticaly
-a | --aspect - keep aspect ratio
-s | --smooth - smooth video
-d | --dual - use both HDMI outputs (for RPI4)
-v | --verbose - show debug
-h | --help - show this help
-
- Posts: 13
- Joined: Wed Oct 20, 2021 12:29 am
Re: Customization of HDMI output modes on SLP image
At the advice of someone in #raspberrypi on libera.chat, I tried a different monitor. I didn't change any settings in `/boot/config.txt`, so the pi's portrait video output was horribly distorted to fit my monitor's landscape shape. That was expected.
In order, from top to bottom:
1. kill the usual cosmostreamer setup
2. try running at a lower resolution: no problem
3. try running at the desired resolution: the macroblocks/second error
I upgrade the firmware to the latest version earlier this week.
My questions:
- Why is the macroblocks/second upgrade message appearing if I had already specified on the command line that the H264 level was 4.2?
- How do I calculate the number of macroblocks/second and optimize for a lower number?
- What is the EINVAL about? Which argument is invalid? How do I make that argument valid once more?
Code: Select all
root@stereopi:~# cd /opt/Cosmostreamer-NG/
root@stereopi:/opt/Cosmostreamer-NG# ./stop.sh
/tmp/ffmpeg-transcode: No such file or directory
root@stereopi:/opt/Cosmostreamer-NG# bin/raspivid -fs -3d tb --level 4.2 -w 1000 -h 2000 -fps 30 -md 7 -b 100000 --flush
root@stereopi:/opt/Cosmostreamer-NG# bin/raspivid -fs -3d tb --level 4.2 -w 1440 -h 2460 -fps 20 -md 7 -b 100000 --flush
Too many macroblocks/s: Increasing H264 Level to 4.2
mmal: mmal_vc_port_enable: failed to enable port vc.ril.video_encode:in:0(I420): EINVAL
mmal: mmal_port_enable: failed to enable connected port (vc.ril.video_encode:in:0(I420))0x2d63c0 (EINVAL)
mmal: mmal_connection_enable: output port couldn't be enabled
mmal: main: Failed to connect camera video port to encoder input
mmal: Argument is invalid
mmal: Failed to run camera app. Please check for firmware updates
1. kill the usual cosmostreamer setup
2. try running at a lower resolution: no problem
3. try running at the desired resolution: the macroblocks/second error
I upgrade the firmware to the latest version earlier this week.
My questions:
- Why is the macroblocks/second upgrade message appearing if I had already specified on the command line that the H264 level was 4.2?
- How do I calculate the number of macroblocks/second and optimize for a lower number?
- What is the EINVAL about? Which argument is invalid? How do I make that argument valid once more?
- Realizator
- Site Admin
- Posts: 900
- Joined: Tue Apr 16, 2019 9:23 am
- Contact:
Re: Customization of HDMI output modes on SLP image
Hi glowingskull ,
Raspberry Pi's H264 encoder has a limit for the resolution it can encode (~1920x1080). Macroblock is internal term used in H264 encoding. WHen you are trying to set higher resolution, MMAL is trying to increase the H264 encoding level to 4.2 (to support more macroblocks) but fails.
I.e. you are faced with the hardware limits of the RPi's video encoder.
Raspberry Pi's H264 encoder has a limit for the resolution it can encode (~1920x1080). Macroblock is internal term used in H264 encoding. WHen you are trying to set higher resolution, MMAL is trying to increase the H264 encoding level to 4.2 (to support more macroblocks) but fails.
I.e. you are faced with the hardware limits of the RPi's video encoder.
Eugene a.k.a. Realizator