Page 1 of 1

Changing video resolution on the fly?

Posted: Mon Dec 17, 2012 1:50 pm
by orangeman
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

Re: Changing video resolution on the fly?

Posted: Mon Dec 17, 2012 2:04 pm
by dom
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)

Re: Changing video resolution on the fly?

Posted: Mon Dec 17, 2012 2:08 pm
by orangeman
Thank you so much for the informative and quick reply!

Matthew

Re: Changing video resolution on the fly?

Posted: Wed May 29, 2013 9:46 pm
by mogabe
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"

Re: Changing video resolution on the fly?

Posted: Fri May 31, 2013 11:46 am
by jaminja
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.

Re: Changing video resolution on the fly?

Posted: Tue Apr 29, 2014 11:49 pm
by leovai
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!

Re: Changing video resolution on the fly?

Posted: Wed Apr 30, 2014 4:58 am
by rpdom
Did you try the

Code: Select all

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

Re: Changing video resolution on the fly?

Posted: Thu Jul 30, 2015 1:28 pm
by Torben
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

Re: Changing video resolution on the fly?

Posted: Thu Jul 30, 2015 4:12 pm
by dom
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.

Re: Changing video resolution on the fly?

Posted: Fri Jul 31, 2015 7:30 am
by Torben
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.

Re: Changing video resolution on the fly?

Posted: Fri Jul 31, 2015 11:12 am
by dom
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)?

Re: Changing video resolution on the fly?

Posted: Mon Aug 03, 2015 6:21 am
by Torben
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).

Re: Changing video resolution on the fly?

Posted: Thu Sep 17, 2015 1:25 am
by fredfs
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?

Re: Changing video resolution on the fly?

Posted: Thu Sep 17, 2015 2:08 pm
by dom
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.

Re: Changing video resolution on the fly?

Posted: Thu Sep 17, 2015 2:51 pm
by fredfs
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!

Re: Changing video resolution on the fly?

Posted: Fri Sep 18, 2015 2:17 pm
by dividuum
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).

Re: Changing video resolution on the fly?

Posted: Tue Feb 21, 2017 11:45 am
by john.t
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

Re: Changing video resolution on the fly?

Posted: Tue Jun 19, 2018 10:59 am
by Trinath
How to change the video resolution on fly when using AV connection.