HermannSW
Posts: 676
Joined: Fri Jul 22, 2016 9:09 pm

What is raspivid preview coordinate system?

Mon May 21, 2018 12:12 pm

I used below bash scripts to place unicode Full Block character U+2588 into bottom right of HDMI monitor console:
https://www.fileformat.info/info/unicod ... /index.htm

Then I tried to place raspivid 640x480 preview window into bottom right corner of the console (from ssh session).

For 1024x768 console this command is needed:

Code: Select all

raspivid -md 7 -w 640 -h 480 -p 976,552,640,480 -t 0
976+640=1616
552+480=1032

Fore 1366x768 console this command is needed:

Code: Select all

raspivid -md 7 -w 640 -h 480 -p 1196,552,640,480 -t 0
1196+640=1836
552+480=1032

Is there an explanation for 1616x1032 / 1836x1032 corrdinate system for raspivid preview on 1024x768 / 1366x768 console?

Code: Select all

pi@raspberrypi3Bplus:~ $ cat 1024
#!/bin/bash
echo -n "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456█"
while (true)
do
sleep 1
done
pi@raspberrypi3Bplus:~ $ cat 1366
#!/bin/bash
echo -n "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789█"
while (true)
do
sleep 1
done
pi@raspberrypi3Bplus:~ $ 
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5139
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: What is raspivid preview coordinate system?

Mon May 21, 2018 12:52 pm

I'm very confused as to what you're trying to do/saying is wrong.

Code: Select all

tvservice -e "DMT 16 DVI"
to force 1024x768

Code: Select all

raspivid -md 7 -w 640 -h 480 -p 976,552,640,480 -t 0
gives me a preview image that is mainly off the screen, as shown with "vcgencmd dispmanx_list"

Code: Select all

pi@raspberrypi:~ $ vcgencmd dispmanx_list
display:2 format:YUV420 transform:0 layer:2 src:0,0,48,216 dst:976,552,48,216 cost:206 lbm:1024
visible region is 48x216 with the rest being cropped off.

Code: Select all

raspivid -md 1 -w 640 -h 480 -p 384,288,640,480 -t 0
gives me the complete preview window in the bottom right, as confirmed by vcgencmd again:

Code: Select all

pi@raspberrypi:~ $ vcgencmd dispmanx_list
display:2 format:YUV420 transform:0 layer:2 src:0,0,640,480 dst:384,288,640,480 cost:535 lbm:10240
Repeating with

Code: Select all

tvservice -e "DMT 81 DVI"
to force 1366x768.

Code: Select all

raspivid -md 7 -w 640 -h 480 -p 1196,552,640,480 -t 0
gives

Code: Select all

display:2 format:YUV420 transform:0 layer:2 src:0,0,170,216 dst:1196,552,170,216 cost:274 lbm:3072
for 170x216 visible.

Code: Select all

raspivid -md 7 -w 640 -h 480 -p 726,288,640,480 -t 0
gives me the full preview window

Code: Select all

display:2 format:YUV420 transform:0 layer:2 src:0,0,640,480 dst:726,288,640,480 cost:535 lbm:10240
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

HermannSW
Posts: 676
Joined: Fri Jul 22, 2016 9:09 pm

Re: What is raspivid preview coordinate system?

Mon May 21, 2018 7:34 pm

Hi,

> I'm very confused as to what you're trying to do
>
I was trying to make sense of the preview coordinate system.

> /saying is wrong.
>
I did use "fbset" to change framebuffer resolutions and got what I reported.
This is posting explaing how I got the 1366x768 mode:
viewtopic.php?f=66&t=214053#p1317956

I did again with fbset commands and took photos of the HDMI monitor, with raspivid command from you:

The first two photos show what I reported above:

Code: Select all

pi@raspberrypi3Bplus:~ $ fbset -fb /dev/fb0 1368x768-60
pi@raspberrypi3Bplus:~ $ raspivid -md 1 -w 640 -h 480 -p 384,288,640,480 -t 0
Image

Code: Select all

pi@raspberrypi3Bplus:~ $ fbset -fb /dev/fb0 1024x768-60
pi@raspberrypi3Bplus:~ $ raspivid -md 1 -w 640 -h 480 -p 384,288,640,480 -t 0
Image


Then I tried with "tvservice" command you used, 1st gives correct result (right bottom preview in 1024 central part of monitor), 2nd shows "Format nicht unterstützt" which is German for "format not supported":

Code: Select all

pi@raspberrypi3Bplus:~ $ tvservice -e "DMT 16 DVI"
Powering on HDMI with explicit settings (DMT mode 16)
pi@raspberrypi3Bplus:~ $ unblank
pi@raspberrypi3Bplus:~ $ raspivid -md 1 -w 640 -h 480 -p 384,288,640,480 -t 0
Image

Code: Select all

pi@raspberrypi3Bplus:~ $ tvservice -e "DMT 81 DVI"
Powering on HDMI with explicit settings (DMT mode 81)
pi@raspberrypi3Bplus:~ $ 
Image


So current summary is that 'tvservice -e "DMT 16 DVI"' works for 1024x768 console mode, and my monitor does not support DMT mode 81. And that changing console mode via fbset makes raspivid preview coordinate system become strange.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5139
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: What is raspivid preview coordinate system?

Mon May 21, 2018 8:41 pm

I'm not overly familiar with fbset, but almost certainly it is not changing the hdmi mode. It's only changing the resolution of an image buffer into which linux is rendering, and then the hardware will resize that for the selected hdmi mode.
Raspivid will always use the hdmi mode resolution.
To change the hdmi mode you need to be using tvservice. tvservice -s will always tell you the current mode.

The only reliable command for seeing what is actually being rendered including overlays is vcgencmd dispmanx_list.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

HermannSW
Posts: 676
Joined: Fri Jul 22, 2016 9:09 pm

Re: What is raspivid preview coordinate system?

Tue May 22, 2018 6:57 am

Thank you for pointing me to HDMI mode, I only had to undo all I did sofar in this thread
viewtopic.php?f=66&t=214053&p=1318439#p1318439
and just add two lines forcing DMT hdmi_mode 39 to get 1360x768.

With that setup your command correctly places the preview window into bottom right corner:

Code: Select all

raspivid -md 7 -w 640 -h 480 -p 720,288,640,480 -t 0
720+640=1360
288+480=768

In order to verify I executed below script "1360", and used 719/287 instead of 720/288:

Code: Select all

raspivid -md 7 -w 640 -h 480 -p 719,287,640,480 -t 0

And really exactly one pixel row at bottom and 1 pixel column at right of full block character becomes visible:
Image


This is the script used to verify:

Code: Select all

pi@raspberrypi3Bplus:~ $ cat 1360
#!/bin/bash
echo -n "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678█"
while (true)
do
sleep 1
done
pi@raspberrypi3Bplus:~ $ 
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

Return to “Camera board”

Who is online

Users browsing this forum: Baidu [Spider] and 10 guests