Changing video resolution on the fly?

5 posts
by orangeman » 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).

Posts: 2
Joined: Mon Dec 17, 2012 1:44 pm
by dom » 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)
Posts: 3858
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by orangeman » Mon Dec 17, 2012 2:08 pm
Thank you so much for the informative and quick reply!

Posts: 2
Joined: Mon Dec 17, 2012 1:44 pm
by mogabe » 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"
Posts: 14
Joined: Wed Dec 12, 2012 11:30 am
by jaminja » 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.
Posts: 1
Joined: Fri May 31, 2013 11:32 am