orangeman
Posts: 2
Joined: Mon Dec 17, 2012 1:44 pm

Changing video resolution on the fly?

Mon Dec 17, 2012 1:50 pm

Hi there,

I'm exploring whether or not the Raspberry Pi would make a good image generator for testing video signals. One key aspect to this role would be the ability to change the output signal resolution (and ideally refresh rate as well) on the fly, without having to reboot. For example, I might want to output a 1920x1080 60Hz signal, then switch to a 1280x1024 75Hz signal.

Is this possible? I know that I can change the output signal characteristics by altering the config.txt file, but as I understand things, this is only applicable on boot.

I'm open to command line options or programmatic options. What I'm not interested in is the ability to create a representation of a resolution which doesn't change the actual signal (e.g. I don't want to create a 'canvas' using some graphics library which is 1024x768, if this doesn't also change the signal itself).

Thanks,
Matthew

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5144
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Changing video resolution on the fly?

Mon Dec 17, 2012 2:04 pm

Yes, it is possible.
tvservice -m CEA
tvservice -m DMT
will list the available HDMI modes.

tvservice -e "GROUP MODE" will choose a specific resolution.
Eg. for 720p60

Code: Select all

tvservice -e "CEA 4"
Powering on HDMI with explicit settings (CEA mode 4)
tvservice -s
state 0x12001a [HDMI CEA (4) RGB lim 16:9], 1280x720 @ 60Hz, progressive
You will lose any overlays on the screen when switching mode. You can recreate the console with:

Code: Select all

fbset -depth 8 && fbset -depth 16
You may also want to change the resolution to match the new screen mode (check fbset's command line options)

orangeman
Posts: 2
Joined: Mon Dec 17, 2012 1:44 pm

Re: Changing video resolution on the fly?

Mon Dec 17, 2012 2:08 pm

Thank you so much for the informative and quick reply!

Matthew

mogabe
Posts: 14
Joined: Wed Dec 12, 2012 11:30 am

Re: Changing video resolution on the fly?

Wed May 29, 2013 9:46 pm

I want my raspberry pi to automatically set the highest supported resolution. *Is there a better way than to parse commands?:

Code: Select all

tvservice -m CEA
tvservice -m DMT
And then setting the resolution with:

Code: Select all

tvservice -e "GROUP MODE"

jaminja
Posts: 1
Joined: Fri May 31, 2013 11:32 am

Re: Changing video resolution on the fly?

Fri May 31, 2013 11:46 am

Have you tried using

Code: Select all

tvservice -p
This will power on HDMI with preferred settings. If your screen if reporting its edid information correctly, then the native resolution of the screen should be the preferred mode.

leovai
Posts: 1
Joined: Wed Mar 19, 2014 7:39 pm

Re: Changing video resolution on the fly?

Tue Apr 29, 2014 11:49 pm

Hello,

I tried "tvservice -e "CEA 5" (It's supposed to accept this resolution after read EDID of TV), but screen goes to black, at TV menu i can it see that it recognize 1080 timming, but i can't see any picture.
After reboot PI image appears.

Sombody has same case? or how to fix?

Thank's!

User avatar
rpdom
Posts: 12737
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: Changing video resolution on the fly?

Wed Apr 30, 2014 4:58 am

Did you try the

Code: Select all

fbset -depth 8 && fbset -depth 16
after setting the resolution?

Torben
Posts: 20
Joined: Tue Apr 22, 2014 9:59 am

Re: Changing video resolution on the fly?

Thu Jul 30, 2015 1:28 pm

rpdom wrote:Did you try the

Code: Select all

fbset -depth 8 && fbset -depth 16
after setting the resolution?
I tried this but the monitor still stays black...

Edit:

Maybe important: I'm connected over SSH to the Raspberry Pi

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5144
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Changing video resolution on the fly?

Thu Jul 30, 2015 4:12 pm

Torben wrote: I tried this but the monitor still stays black...

Edit:

Maybe important: I'm connected over SSH to the Raspberry Pi
You may need to provoke a change, or it may be blanked.
Normally pressing a key on keyboard wake it up.
From ssh you may have to launch something that writes to fb.

Torben
Posts: 20
Joined: Tue Apr 22, 2014 9:59 am

Re: Changing video resolution on the fly?

Fri Jul 31, 2015 7:30 am

dom wrote:
You may need to provoke a change, or it may be blanked.
Normally pressing a key on keyboard wake it up.
From ssh you may have to launch something that writes to fb.
I'm already running a programm that writes to the framebuffer. Even if I trigger a new video output after changing the hdmi settings, the monitor stays blank. Since the programm does not throw an exception I assume that my mapping of the framebuffer still is working.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5144
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Changing video resolution on the fly?

Fri Jul 31, 2015 11:12 am

Torben wrote: I'm already running a programm that writes to the framebuffer. Even if I trigger a new video output after changing the hdmi settings, the monitor stays blank. Since the programm does not throw an exception I assume that my mapping of the framebuffer still is working.
Can you connect a keyboard and press a key to ensure the display is not blanked (due to inactivity)?

Torben
Posts: 20
Joined: Tue Apr 22, 2014 9:59 am

Re: Changing video resolution on the fly?

Mon Aug 03, 2015 6:21 am

dom wrote: Can you connect a keyboard and press a key to ensure the display is not blanked (due to inactivity)?
Even with the keyboard there is no change. I've also tried different DMT and CEA modes to ensure that the monitor is not a problem, but the results were always the same.

I'm currently running the latest Raspbian firmware (2015-05-15).

fredfs
Posts: 57
Joined: Sun Jun 07, 2015 12:22 am

Re: Changing video resolution on the fly?

Thu Sep 17, 2015 1:25 am

What happens with my HDMI mode is set to 720p and I play a 1080p video?
Do I get real 1080p?
If not, who is converting the resolution?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5144
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Changing video resolution on the fly?

Thu Sep 17, 2015 2:08 pm

fredfs wrote:What happens with my HDMI mode is set to 720p and I play a 1080p video?
Do I get real 1080p?
If not, who is converting the resolution?
Well that's a software choice so it may depend on the software you are running.
Kodi for example will change the refresh rate, but won't change the resolution.
So 1080p video is decoded and the Hardware Video Scaler on GPU will resize it to 720p before outputting to HDMI.

fredfs
Posts: 57
Joined: Sun Jun 07, 2015 12:22 am

Re: Changing video resolution on the fly?

Thu Sep 17, 2015 2:51 pm

Nice.. I ask this because I have set my hdmi to 720p (group 1 / mode 4).
Then I start playing a mix on 1080p (and other resolution) videos with omxplayer, they all play fine (inside the window).
But loading an overlay logo with raspidmx's pngview (https://github.com/AndrewFromMelbourne/ ... er/pngview)

The image, a full 1920x1080 pixels image, translucid, with a logo on the corner,
goes beyond borders (remember I am set HDMI to 720p)....
So I was wondering the this picture was still 1080p signal to the TV, wich does not makes sense since the HVS should limit is to 720p?

Well it has been a lot of experiments,
beyond this tipic, I have been creating a video presentation tool, with overlay logo, and some info text (using hello_font), but I am always facing a limit of layers (I cannot load 2 overlay pngs and fonts, with video, at the same time).
Guess I must generate all my overlay images and fonts by the same software, inside the same layer?

Thanks a lot!

User avatar
dividuum
Posts: 108
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Changing video resolution on the fly?

Fri Sep 18, 2015 2:17 pm

So I was wondering the this picture was still 1080p signal to the TV, wich does not makes sense since the HVS should limit is to 720p?
The HVS doesn't limit layers to the physical size of the screen. You can place your layers outside the visible area. Just experiment a bit with the --win option of omxplayer. If you want to downscale a layer, you have to set its size to the physical size of the screen.
Guess I must generate all my overlay images and fonts by the same software, inside the same layer?
Not necessarily, although it might make sense: The HVS can turn out to be too slow if you add too many layers in either the same program or different programs. In that case the video signal might get lost (See https://github.com/raspberrypi/firmware/issues/407). So it's probably a good idea to add as few layers as possible. One way to do this is to use an OpenGL layer and render everything except the video in there. Then your program basically ends up consisting of only 2 layers. Or you might even render the video inside OpenGL as well resulting in only a single layer for everything. That's how I do it in my tool info-beamer (https://info-beamer.com/pi).
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

john.t
Posts: 28
Joined: Fri Sep 23, 2016 10:56 am

Re: Changing video resolution on the fly?

Tue Feb 21, 2017 11:45 am

dom wrote:Yes, it is possible.
tvservice -m CEA
tvservice -m DMT
will list the available HDMI modes.

tvservice -e "GROUP MODE" will choose a specific resolution.
Eg. for 720p60

Code: Select all

tvservice -e "CEA 4"
Powering on HDMI with explicit settings (CEA mode 4)
tvservice -s
state 0x12001a [HDMI CEA (4) RGB lim 16:9], 1280x720 @ 60Hz, progressive
You will lose any overlays on the screen when switching mode. You can recreate the console with:

Code: Select all

fbset -depth 8 && fbset -depth 16
You may also want to change the resolution to match the new screen mode (check fbset's command line options)
do you have to type the word DMT or CEA and then the number for this to work?i tried tvservice -e CEA or DMT and then a number of a mode and nothing happens

Trinath
Posts: 16
Joined: Thu Apr 12, 2018 9:38 am

Re: Changing video resolution on the fly?

Tue Jun 19, 2018 10:59 am

How to change the video resolution on fly when using AV connection.

Return to “Graphics programming”

Who is online

Users browsing this forum: No registered users and 3 guests