Skip to content

Aspect ratio, display modes, refresh rates

CourvilleSoftware edited this page Jun 11, 2020 · 9 revisions

Some history

Archos video player and thus nova, has been designed to not compromise the video aspect ratio. Two image format were initially proposed when playing a video: original and full screen. Original corresponds to non stretched zoom of the video to fill one of the two dimensions of the screen without any cropping. Full screen corresponds to a non stretched zoom of the video to fill the entire screen dimension sometimes inducing cropping.

Recall the basics

Before going any further, if you experience a distortion of the aspect ratio, please check that your TV setting itself does not distort the image, i.e. that you selected on your TV setting an image format "original" or 16:9 if your TV is 16:9.

Let's recall some basics: aspect ratio is the ratio of the video width in number of pixels by its height in number of pixels. Common aspect ratios for a video file are 16:9, 4:3, 21:9.

Display modes

NVP has now 3 display modes:

  • original: the video is scaled to its maximum to be viewed in full on the screen. This can result in black vertical or horizontal bars. This mode is intended to preserve a correct aspect ratio.
  • full screen: the video is scaled to fill the entire screen (no black bars) resulting in some portion of the video not being displayed. This mode is intended to preserve a correct aspect ratio.
  • stretched: the video is stretched to fill the entire screen and visible in full resulting potentially in a non correct aspect ratio. It has been chosen not to implement this mode in Archos and Nova video players.

In order to compute the surface size to display the video that might be larger than the screen size (SurfaceController.java), the program relies on the resolution probed by ffmpeg and not MediaCodec. Indeed, though enforced by CTS testing, some non certified Android TV boxes might have MediaCodec sometimes output bad resolution (e.g. some Rockchip implementations) resulting in incorrect aspect ratio.

It is worth noting that recent Android 9 Philips Android TV (e.g. 65PUS7304) behaves strangely and rely on a bad implementation. These TV hardware codec add black top and bottom bars systematically such that a 1920x800 video looks compressed vertically (ends up with a video height of 592=800*800/1080). In order to have a correct aspect ratio on this TV one should surprisingly use the stretched mode. The horridious stretched mode introduced is meant to enable Philips TV users with a solution to get a correct aspect ratio. Bad implementations leads to bad compromises. [UPDATE] a correct workaround to this issue has been implemented removing the need for stretched mode.

Another peculiar behavior is experienced on the Mi laser projector in full screen mode which results in always in a stretched image displayed. The current interpretation is that the MediaCodec refuses to scale the image on a resolution higher than the screen size resulting in this unfortunate effect. This issue is not present on the MiBoxS though also based on amlogic CPU.

Investigations are tracked here: https://github.com/nova-video-player/aos-AVP/issues/258

Refresh rates and frame rates

Video files are usually encoded with a fixed frame per second rate (fps) and in order to limit judder, it is best to adjust the refresh rate of the display to match an integer multiple of the frame rate of the video. If you do not do it you will experience some stutter when watching videos corresponding in dropping frames to realign the difference between the refresh rate and the frame rate. In order to avoid this problem, some displays are proposing various refresh rates e.g. 23.976Hz , 24Hz, 25Hz, 29.97Hz, 30Hz, 50Hz, 59.94Hz, 60Hz and NVP has a setting option to dynamically adjust the display refresh rate to the video frame rate (or minimize the difference). Multiple refresh rates are almost always proposed when connecting an Android TV box to a TV via HDMI. Note that surprisingly this is not possible on many Android TV TV sets like for instance Sony which only proposes one 60Hz refresh rate... One can check the available refresh rates setting DBG=true in Player.java and looking at D Player : Display supported mode logs when playing a video.

And finally disable any motion interpolation setting on your TV as advised by the film industry cf. https://www.change.org/p/hdtv-manufacturers-please-stop-making-smooth-motion-the-default-setting-on-all-hdtvs

Minimizing judder adapting screen refresh rate to video framerate

Nova minimizes the judder by adapting screen refresh rate to video framerate by minimizing the following metric: min(refresh%fps,|refresh%fps-fps|)/refresh

The following spreadsheet is available to play around with the resulting algorithm: https://docs.google.com/spreadsheets/d/126OQhsoCWJ6_c_eZd3KSqXVmAMxK3EusvdTvD1iyuoc/edit?usp=sharing

This selection is performed in Player.java