[APP][2014.12.08] TVHZ

Search This thread

Chainfire

Moderator Emeritus / Senior Recognized Developer
Oct 2, 2007
11,445
87,805
www.chainfire.eu
This app allows you to switch the hertz of your display. This is a tool for advanced users, please read this entire description. Hopefully this app will be obsolete sooner rather than later.

If you have a compatible TV or monitor, you may want to view specific content on a different hz. Apps can actually switch the hz used by your device. This feature is new to Android, and thus very few apps support it yet, which is the main reason an app like this one can come in handy.

Unfortunately, at the time of this writing, even if developers added this functionality to their apps (devs: check preferredRefreshRate in WindowManager.LayoutParams), it may not work right or at all. There are several issues with Google's current implementation, as it exists on the Nexus Player, firmware LRX21V:

- The available modes appear to only be detected on Android TV boot. This means your TV or receiver needs to be turned on and switched to the correct input before booting the Android TV device, or not all the modes your TV supports will be recognized.

- Switching hz may break audio. This app provides an option to fix that, but that does require your device to be rooted. Note that this may be both Android TV device as well TV dependent - your setup may not display this issue.

- Switching hz may randomly reboot the device

- The Android API lies. It'll happily report the current refresh rate to be X hz while it is actually Y hz, which may cause timing issues for video apps that actually take refresh rate into account.

- There is no hz override in display settings

So, until these things are fixed Google-side - and it would actually start to make sense for developers to include the functionality in their apps - at least you can play around with this.

Note that 'forcing' a certain hz might be wording it too strong. Android is still free to ignore the setting, and if an app really wanted to, it could override it as well.

Disclaimer: works for me, provided as-is, this app has no support, the situation describe above may change at any time

Why?

I was looking at committing this feature into xbmc/kodi, so I built a quick proof-of-concept app first, as I has not used the API before. During testing I quickly noted that the API doesn't work reliably enough yet to be part of that project.

Download

Google Play (this link is pending Play cache update and Play team approval)
 

Attachments

  • TVHZ-v1.01.apk
    362.2 KB · Views: 4,741
  • screenshot.png
    screenshot.png
    84.9 KB · Views: 5,917
Last edited:

scorpeeon

Senior Member
Jan 15, 2011
307
38
Gonna be a bit off-topic here, sorry about that.
I don't have a Nexus Player, but changing the external display's refresh rate was one of the features I wanted for a long time, it was the last missing thing to have a nice, smooth movie playback experience in an app like xbmc/kodi.
How device-dependent is this app? Can I use it on a N5 for instance? (or a Chromecast?) It has power to pretty much play any video file, it has an 1080p display and can send 1080p through hdmi, so a ~24 hz refresh rate for movies is all that's missing.
It's nice to see Android itself supporting this (even if it currently broken as you say).

What about the external display's modes or the external display's resolution, can they also be changed? The other problem for a good movie experience is with devices not having an exact 1080p display (like the N7 2013). Since the external display is always mirrored (and not extended), the device's 1920*1200 image will be shrunk to the TV's 1920*1080 screen leaving black bars on the sides which really sucks. I've seen some root-required hacks for the N7 2013 to force a standard 1080p resolution, but that's not a real solution... It would be nice to have these sorted out, because until that, even a Raspberry Pi provides a way superior movie-experience than pretty much any Android-powered stuff...
 

the_mentor

Senior Member
Jul 11, 2010
221
59
What about 120Hz TVs?
I dont see 120Hz in the selection is that because of some limitation?
 

Chainfire

Moderator Emeritus / Senior Recognized Developer
Oct 2, 2007
11,445
87,805
www.chainfire.eu
Gonna be a bit off-topic here, sorry about that.
I don't have a Nexus Player, but changing the external display's refresh rate was one of the features I wanted for a long time, it was the last missing thing to have a nice, smooth movie playback experience in an app like xbmc/kodi.
How device-dependent is this app? Can I use it on a N5 for instance? (or a Chromecast?) It has power to pretty much play any video file, it has an 1080p display and can send 1080p through hdmi, so a ~24 hz refresh rate for movies is all that's missing.
It's nice to see Android itself supporting this (even if it currently broken as you say).

What about the external display's modes or the external display's resolution, can they also be changed? The other problem for a good movie experience is with devices not having an exact 1080p display (like the N7 2013). Since the external display is always mirrored (and not extended), the device's 1920*1200 image will be shrunk to the TV's 1920*1080 screen leaving black bars on the sides which really sucks. I've seen some root-required hacks for the N7 2013 to force a standard 1080p resolution, but that's not a real solution... It would be nice to have these sorted out, because until that, even a Raspberry Pi provides a way superior movie-experience than pretty much any Android-powered stuff...

First, this app is written only with the main display in mind. As such, it won't work for external displays as it seems you are after. It won't work on an N5 or N7 either as this incarnation of the app only has a TV interface. It won't run on a Chromecast, because that doesn't actually run Android apps. Also, I'm pretty sure the main screens of the N5 and N7 only support 60hz.

That being said, and I have never tried this myself (I really should get a mini-HDMI cable to I can play with this stuff), so take this with a big grain of salt, but from what I've seen and read, the scaling and mirroring you mention is app-based. The Android API does provide mechanisms to display content in the full resolution of the external display (since API 17), but the app requires (potentially a lot of) extra code to do this. The mirroring (and thus auto-scaling) is merely the default thing Android does when an app does not override that behavior. Quickly checking the API docs, it also appears to be possible to adjust the hz of the secondary display in the same way (since API 21). However, again, the currently active app is the one who must control this.

TVHZ uses a trick to get around the restriction of having to be the currently active app. It does not appear this trick can be used the same way to control the hz of an external screen, through the regular API. This does not necessarily mean it isn't possible (without root), it just means more investigation would be required to know for sure.

Will this work on the ADT-1?

I have not tried.
 

Chainfire

Moderator Emeritus / Senior Recognized Developer
Oct 2, 2007
11,445
87,805
www.chainfire.eu
What about 120Hz TVs?
I dont see 120Hz in the selection is that because of some limitation?

No. 120hz is display panel refresh rate, not an input refresh rate. Don't worry about it :)

With stuff like this the rule is pretty much, if you don't know why you would change it and what you would change it to, you're probably best off with the default (unless someone specifically tells you otherwise).
 

chrisnewton

Senior Member
Feb 5, 2012
339
5
First, this app is written only with the main display in mind. As such, it won't work for external displays as it seems you are after. It won't work on an N5 or N7 either as this incarnation of the app only has a TV interface. It won't run on a Chromecast, because that doesn't actually run Android apps. Also, I'm pretty sure the main screens of the N5 and N7 only support 60hz.

That being said, and I have never tried this myself (I really should get a mini-HDMI cable to I can play with this stuff), so take this with a big grain of salt, but from what I've seen and read, the scaling and mirroring you mention is app-based. The Android API does provide mechanisms to display content in the full resolution of the external display (since API 17), but the app requires (potentially a lot of) extra code to do this. The mirroring (and thus auto-scaling) is merely the default thing Android does when an app does not override that behavior. Quickly checking the API docs, it also appears to be possible to adjust the hz of the secondary display in the same way (since API 21). However, again, the currently active app is the one who must control this.

TVHZ uses a trick to get around the restriction of having to be the currently active app. It does not appear this trick can be used the same way to control the hz of an external screen, through the regular API. This does not necessarily mean it isn't possible (without root), it just means more investigation would be required to know for sure.



I have not tried.

This is amazing.. Will it work on a ouya do you think?
 

defconoi

Senior Member
Oct 31, 2008
3,183
6,077
SCHUYLKILL HAVEN
www.android-unleashed.com
This app allows you to switch the hertz of your display. This is a tool for advanced users, please read this entire description. Hopefully this app will be obsolete sooner rather than later.

If you have a compatible TV or monitor, you may want to view specific content on a different hz. Apps can actually switch the hz used by your device. This feature is new to Android, and thus very few apps support it yet, which is the main reason an app like this one can come in handy.

Unfortunately, at the time of this writing, even if developers added this functionality to their apps (devs: check preferredRefreshRate in WindowManager.LayoutParams), it may not work right or at all. There are several issues with Google's current implementation, as it exists on the Nexus Player, firmware LRX21V:

- The available modes appear to only be detected on Android TV boot. This means your TV or receiver needs to be turned on and switched to the correct input before booting the Android TV device, or not all the modes your TV supports will be recognized.

- Switching hz may break audio. This app provides an option to fix that, but that does require your device to be rooted. Note that this may be both Android TV device as well TV dependent - your setup may not display this issue.

- Switching hz may randomly reboot the device

- The Android API lies. It'll happily report the current refresh rate to be X hz while it is actually Y hz, which may cause timing issues for video apps that actually take refresh rate into account.

- There is no hz override in display settings

So, until these things are fixed Google-side - and it would actually start to make sense for developers to include the functionality in their apps - at least you can play around with this.

Note that 'forcing' a certain hz might be wording it too strong. Android is still free to ignore the setting, and if an app really wanted to, it could override it as well.

Disclaimer: works for me, provided as-is, this app has no support, the situation describe above may change at any time

Why?

I was looking at committing this feature into xbmc/kodi, so I built a quick proof-of-concept app first, as I has not used the API before. During testing I quickly noted that the API doesn't work reliably enough yet to be part of that project.

Download

Google Play (this link is pending Play cache update and Play team approval)
Good job man, thanks for developing for the nexus player
 

Smultie

Senior Member
Apr 13, 2006
808
291
Absolutely awesome!
Hopefully this will work for the Amazon Fire TV in the future too!
 

dsfdfsdfs

Member
May 8, 2010
38
20
Tampere
I was looking at committing this feature into xbmc/kodi, so I built a quick proof-of-concept app first, as I has not used the API before. During testing I quickly noted that the API doesn't work reliably enough yet to be part of that project.

FYI, I've also dabbled with refresh rate switching with Kodi, very WIP code (i.e. full of commented trial-and-error code :) ) is at https://github.com/anssih/xbmc/commits/android/refreshrate_wip (2 commits).

I also noticed the audio breaking (haven't investigated further yet), but I didn't see any reboots occurring.

If I remember correctly, this did not work on ADT-1 last I tested.
 

Chainfire

Moderator Emeritus / Senior Recognized Developer
Oct 2, 2007
11,445
87,805
www.chainfire.eu
FYI, I've also dabbled with refresh rate switching with Kodi, very WIP code (i.e. full of commented trial-and-error code :) ) is at https://github.com/anssih/xbmc/commits/android/refreshrate_wip (2 commits).

I also noticed the audio breaking (haven't investigated further yet), but I didn't see any reboots occurring.

If I remember correctly, this did not work on ADT-1 last I tested.

The audio breakage occurs in device-specific code, so it may not happen on different devices. On the other hand, it may have been an oversight in the Android framework itself that many TVs will disconnect the audio channel as well when switching hz's - in essence completely severing the connection and building it up again.

Fixing the audio can be done by manually killing /system/bin/mediaserver (it is automatically restarted after a few seconds), or calling "stop media && start media". As a side effect this may actually crash apps using audio (or video) at that time, so actually doing this at the start of a video is not really an option - even if it didn't require root and wasn't device-specific.

The reboot is rare, but I've switched hz's a couple of hundred times now, and it does happen.

Glad to see someone else is looking at this though, if you put it in Kodi (when it actually works) that means I won't have to :)
 

dsfdfsdfs

Member
May 8, 2010
38
20
Tampere
The audio breakage occurs in device-specific code, so it may not happen on different devices. On the other hand, it may have been an oversight in the Android framework itself that many TVs will disconnect the audio channel as well when switching hz's - in essence completely severing the connection and building it up again.
Sorry, by "not working on ADT-1" I meant that the refresh rate switching wasn't working there.

Anyway, the HDMI audio stuff is one-way communication (except for EDID, which can't be "disconnected" in that sense), so there is no "disconnecting the audio channel" from the TV side.

Fixing the audio can be done by manually killing /system/bin/mediaserver (it is automatically restarted after a few seconds), or calling "stop media && start media". As a side effect this may actually crash apps using audio (or video) at that time, so actually doing this at the start of a video is not really an option - even if it didn't require root and wasn't device-specific.

The reboot is rare, but I've switched hz's a couple of hundred times now, and it does happen.

Glad to see someone else is looking at this though, if you put it in Kodi (when it actually works) that means I won't have to :)
Argh, and I was thinking the opposite here :) But yeah, I'll work on it as long as time permits.

Have you reported the audio/reboot issues to Google yet?
 

Chainfire

Moderator Emeritus / Senior Recognized Developer
Oct 2, 2007
11,445
87,805
www.chainfire.eu
Sorry, by "not working on ADT-1" I meant that the refresh rate switching wasn't working there.

I wasn't implying it might work on any specific device, just that at least the log spam from the audio issue come from a fugu-specific driver, a different driver may behave differently, or not if it's really a framework issue. Anyway, we're knee-deep in speculation here, it matters not.

Anyway, the HDMI audio stuff is one-way communication (except for EDID, which can't be "disconnected" in that sense), so there is no "disconnecting the audio channel" from the TV side.

I'll admit I know nothing about these things, but if the TV cuts all power to the port, wouldn't the device 'sense' that and possibly interpret that as a disconnect?

Argh, and I was thinking the opposite here :) But yeah, I'll work on it as long as time permits.

Maybe my test videos weren't great, but I didn't think things looked noticably better at 24hz than they did at 60hz. Though admittedly that may be related to the renderer not actually knowing the display is at 24hz. It was more of an experiment for me than that I truly need it - I have some other issues to figure out with my NP that have higher priority.

Have you reported the audio/reboot issues to Google yet?

Nope, because I have not had the time (or will) to produce a decent error report yet.
 
  • Like
Reactions: Magnesus

dsfdfsdfs

Member
May 8, 2010
38
20
Tampere
I'll admit I know nothing about these things, but if the TV cuts all power to the port, wouldn't the device 'sense' that and possibly interpret that as a disconnect?
Yeah, though I'd be somewhat surprised if that happens - if the source device sees a disconnect/reconnect, it may consider the to be a "new device" and do all sorts of enumeration... but anyway, as you said, pointless to speculate really :)

Maybe my test videos weren't great, but I didn't think things looked noticably better at 24hz than they did at 60hz. Though admittedly that may be related to the renderer not actually knowing the display is at 24hz. It was more of an experiment for me than that I truly need it - I have some other issues to figure out with my NP that have higher priority.
Yeah, I too have a hard time seeing the 24/60Hz difference with most videos - not immediately sure if renderer thinking it was 60Hz could cause visible issues, though. With 25/50p European TV footage the 50/60Hz difference is more pronounced.

Nope, because I have not had the time (or will) to produce a decent error report yet.
OK. I'll probably make one after I've had the time to gather some more data/info.
 

jmcguire525

Member
Feb 14, 2012
26
3
Update?

Can anyone update me on the current status of frame rate switching for android tv, specifically within Kodi? I'm hoping by the time the Shield console comes out I will be able to playback movies at 24hz.
 

jmcguire525

Member
Feb 14, 2012
26
3
anyone? I've searched around and haven't been able to find if this has been officially implemented in any apps.
 

dsfdfsdfs

Member
May 8, 2010
38
20
Tampere
This is now finally implemented in Kodi (version 15.0 Beta 2, on Google Play, formerly XBMC). It works in at least Nexus Player and Shield TV, but should work in any Android system that supports refresh rate switching. You need to enable automatic refresh rate switching in the Kodi video settings.

I wrote the support back in December, but the problems mentioned in this thread prevented putting it in officially until now. Those issues seem to have been resolved in the Android versions released since then.
 

Anders12321

Member
Nov 18, 2012
14
0
Works, somehow

The app does it job, although it seems to reset to 60Hz at reboot (even with the option set to keep at reboot).
Now, I agree, Google should set the output Hz to match the video stream at hand. Yes, it will be a short blackout, but so what!?.

Thanks for the app. I'm running it on the latest 6.0 available today. :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    This app allows you to switch the hertz of your display. This is a tool for advanced users, please read this entire description. Hopefully this app will be obsolete sooner rather than later.

    If you have a compatible TV or monitor, you may want to view specific content on a different hz. Apps can actually switch the hz used by your device. This feature is new to Android, and thus very few apps support it yet, which is the main reason an app like this one can come in handy.

    Unfortunately, at the time of this writing, even if developers added this functionality to their apps (devs: check preferredRefreshRate in WindowManager.LayoutParams), it may not work right or at all. There are several issues with Google's current implementation, as it exists on the Nexus Player, firmware LRX21V:

    - The available modes appear to only be detected on Android TV boot. This means your TV or receiver needs to be turned on and switched to the correct input before booting the Android TV device, or not all the modes your TV supports will be recognized.

    - Switching hz may break audio. This app provides an option to fix that, but that does require your device to be rooted. Note that this may be both Android TV device as well TV dependent - your setup may not display this issue.

    - Switching hz may randomly reboot the device

    - The Android API lies. It'll happily report the current refresh rate to be X hz while it is actually Y hz, which may cause timing issues for video apps that actually take refresh rate into account.

    - There is no hz override in display settings

    So, until these things are fixed Google-side - and it would actually start to make sense for developers to include the functionality in their apps - at least you can play around with this.

    Note that 'forcing' a certain hz might be wording it too strong. Android is still free to ignore the setting, and if an app really wanted to, it could override it as well.

    Disclaimer: works for me, provided as-is, this app has no support, the situation describe above may change at any time

    Why?

    I was looking at committing this feature into xbmc/kodi, so I built a quick proof-of-concept app first, as I has not used the API before. During testing I quickly noted that the API doesn't work reliably enough yet to be part of that project.

    Download

    Google Play (this link is pending Play cache update and Play team approval)
    3
    This is now finally implemented in Kodi (version 15.0 Beta 2, on Google Play, formerly XBMC). It works in at least Nexus Player and Shield TV, but should work in any Android system that supports refresh rate switching. You need to enable automatic refresh rate switching in the Kodi video settings.

    I wrote the support back in December, but the problems mentioned in this thread prevented putting it in officially until now. Those issues seem to have been resolved in the Android versions released since then.
    2
    Gonna be a bit off-topic here, sorry about that.
    I don't have a Nexus Player, but changing the external display's refresh rate was one of the features I wanted for a long time, it was the last missing thing to have a nice, smooth movie playback experience in an app like xbmc/kodi.
    How device-dependent is this app? Can I use it on a N5 for instance? (or a Chromecast?) It has power to pretty much play any video file, it has an 1080p display and can send 1080p through hdmi, so a ~24 hz refresh rate for movies is all that's missing.
    It's nice to see Android itself supporting this (even if it currently broken as you say).

    What about the external display's modes or the external display's resolution, can they also be changed? The other problem for a good movie experience is with devices not having an exact 1080p display (like the N7 2013). Since the external display is always mirrored (and not extended), the device's 1920*1200 image will be shrunk to the TV's 1920*1080 screen leaving black bars on the sides which really sucks. I've seen some root-required hacks for the N7 2013 to force a standard 1080p resolution, but that's not a real solution... It would be nice to have these sorted out, because until that, even a Raspberry Pi provides a way superior movie-experience than pretty much any Android-powered stuff...

    First, this app is written only with the main display in mind. As such, it won't work for external displays as it seems you are after. It won't work on an N5 or N7 either as this incarnation of the app only has a TV interface. It won't run on a Chromecast, because that doesn't actually run Android apps. Also, I'm pretty sure the main screens of the N5 and N7 only support 60hz.

    That being said, and I have never tried this myself (I really should get a mini-HDMI cable to I can play with this stuff), so take this with a big grain of salt, but from what I've seen and read, the scaling and mirroring you mention is app-based. The Android API does provide mechanisms to display content in the full resolution of the external display (since API 17), but the app requires (potentially a lot of) extra code to do this. The mirroring (and thus auto-scaling) is merely the default thing Android does when an app does not override that behavior. Quickly checking the API docs, it also appears to be possible to adjust the hz of the secondary display in the same way (since API 21). However, again, the currently active app is the one who must control this.

    TVHZ uses a trick to get around the restriction of having to be the currently active app. It does not appear this trick can be used the same way to control the hz of an external screen, through the regular API. This does not necessarily mean it isn't possible (without root), it just means more investigation would be required to know for sure.

    Will this work on the ADT-1?

    I have not tried.
    1
    Sorry, by "not working on ADT-1" I meant that the refresh rate switching wasn't working there.

    I wasn't implying it might work on any specific device, just that at least the log spam from the audio issue come from a fugu-specific driver, a different driver may behave differently, or not if it's really a framework issue. Anyway, we're knee-deep in speculation here, it matters not.

    Anyway, the HDMI audio stuff is one-way communication (except for EDID, which can't be "disconnected" in that sense), so there is no "disconnecting the audio channel" from the TV side.

    I'll admit I know nothing about these things, but if the TV cuts all power to the port, wouldn't the device 'sense' that and possibly interpret that as a disconnect?

    Argh, and I was thinking the opposite here :) But yeah, I'll work on it as long as time permits.

    Maybe my test videos weren't great, but I didn't think things looked noticably better at 24hz than they did at 60hz. Though admittedly that may be related to the renderer not actually knowing the display is at 24hz. It was more of an experiment for me than that I truly need it - I have some other issues to figure out with my NP that have higher priority.

    Have you reported the audio/reboot issues to Google yet?

    Nope, because I have not had the time (or will) to produce a decent error report yet.
    1
    So I've been happily using TVHZ on an Nvidia Shield 2017 (software version 5.2) for months now, because for some reason, the Shield doesn't list 1080p100 or 1080p120 resolutions for me in the video settings. However my TV (LG OLED65C7P) does have native EDID support for 1080p @ 100/120hz, which other devices detect no problem. However, immediately after software version 6.0 update this week, 100hz and 120hz are missing from TVHZ. I have a feeling Nvidia doesn't want to support those refresh rates for some reason, even though I had zero problems running at them.

    Is there any way to get those rates listed in TVHZ again?

    Some additional information: https://forums.geforce.com/default/topic/1015395/shield-tv/add-120hz-support/post/5190403/#5190403