Note that there are some explanatory texts on larger screens.

plurals
  1. POCalculating Display Aspect Ratio for Anamorphic Video
    primarykey
    data
    text
    <p>It appears that the Google TV/Android 3.2 API doesn't have the ability to correctly report the Display size for video content.</p> <pre><code>int surfaceViewHeight = surfaceView.getHeight(); int surfaceViewWidth = surfaceView.getWidth(); float videoWidth = mediaPlayer.getVideoWidth(); float videoHeight = mediaPlayer.getVideoHeight(); float ratioWidth = surfaceViewWidth / videoWidth; float ratioHeight = surfaceViewHeight / videoHeight; float aspectRatio = videoWidth / videoHeight; </code></pre> <p>The probem appears to be the mediaPayer.getVideoWidth() and getVideoHeight calls. As they are always returning the physical storage size of the video content, and not for those containers that support it the actual Display size. I checked and there is no API available that gets the display size. You can get close by using an external source like Plex Media Server which correctly returns the aspect ratio, but unless Display size is returned, the ratioWidth and ratioHeight calculations are always going to be wrong.</p> <p>This really seems to affect the LG Google TVs as I'm getting most of the bug reports from those users of my app. Is there a way to get the actual display size recorded in the container if it exists?</p> <p>Update: Here is a general primar on Anamorphic Content from Handbrake.</p> <p><a href="https://trac.handbrake.fr/wiki/AnamorphicGuide" rel="nofollow">https://trac.handbrake.fr/wiki/AnamorphicGuide</a></p> <p>Basically if only the Physical Size of the video is ever returned and used to calculate aspect ratios, then the video displayed will always either looked squished or stretched. It may also always have black bars when it probably shouldn't. The codecs are supposed to return a Display width and height to inform video players how the content should be displayed so it looks correct on the TV.</p> <p>The MKV container format can report the correct information, in the EBML. It looks though that the Android api is only reporting the pixel width and pixel height. See the following java source (which could be a work around for MKVs).</p> <p><a href="http://matroska.svn.sourceforge.net/viewvc/matroska/trunk/JEBML/src/org/ebml/matroska/MatroskaFileTrack.java?revision=874&amp;view=markup" rel="nofollow">http://matroska.svn.sourceforge.net/viewvc/matroska/trunk/JEBML/src/org/ebml/matroska/MatroskaFileTrack.java?revision=874&amp;view=markup</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload