Kodi Community Forum

Full Version: Video stretched on Phillips TV after update
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11
(2020-01-23, 13:20)cerarp Wrote: [ -> ]If you have an image I can use to build Kodi for Android

It's all on github.  There is a guide https://github.com/xbmc/xbmc/blob/master...Android.md on what you need package-wise and how to cross-compile on Ubuntu for android.  You can just install Ubuntu 16.04 in a VM and then follow the guide.
(2020-01-23, 13:31)black_eagle Wrote: [ -> ]
(2020-01-23, 13:20)cerarp Wrote: [ -> ]If you have an image I can use to build Kodi for Android

It's all on github.  There is a guide https://github.com/xbmc/xbmc/blob/master...Android.md on what you need package-wise and how to cross-compile on Ubuntu for android.  You can just install Ubuntu 16.04 in a VM and then follow the guide. 
I have seen the guide but as I mentioned I have close to zero experience with Linux thus I expect to run into problems if I try to set this up myself. I will try and see.
(2020-01-07, 15:27)000gui Wrote: [ -> ]Hello, I am a big fan of Kodi. I was using it on an android box with my old tv and it was working fine.

Now that I have a new Philips android tv, I have installed Kodi directly on my tv which is much more responsive than my old android box. Like you guys, I have encountered some ratio issue.
 
(2019-04-06, 17:57)fritsch Wrote: [ -> ]The best way to workaround broken firmware is patching the native player instead of fixing the root cause ... that logic makes no sense.
I am not sure that this is Philips firmware issue as you are suggesting. For me all other apps don't have any ratio issue (Netflix, YouTube, MxPlayer...). And I would be very surprised that Google has implemented in YouTube a workaround just for the Philips tv. As Google is making the standard with their OS, they are more like to implement their apps as per the standard. Also, it would mean that all the other apps have implemented a work around for the Philips tv. Not impossible but fill very unlikely.

I have also another issue with Kodi that might be related to the same problem: the display is not properly recognized. In the information in Kodi, the display is described as 1920x1080 60Hz whereas it is a 4K display. In the display setting in Kodi I have only one possibility 1920x1080 60Hz, nothing else, no 4K, no 24Hz, no 50Hz… When I play a 4K video, the display is set to 1920x1080 60Hz (can be seen while switching aspect ratio with the z key). Also, even if in the settings “Adjust display refresh rate to match video” is turn on, the refresh rate always remains 60Hz.

In YouTube, when playing a 4K even if the biterate is not so good, I can tell that is displayed in 4k.

Maybe the hardware is not properly identified in Kodi and that is why we have those issues with the aspect ratio, the resolution and the refresh rate.

What is your point of view? Any other clues? 
When I first received the TV update and encountered this problem I tried VLC aswell, which had the same problem.
I have managed to setup a build system and started investigating the issue.
It is however not going well. I have checked and compared every possible reason for this issue I could think of and still could not find the difference between the Philips TV and any other Android device.
I have checked window positions, window scaling, mediacodec settings, surface creation size, ...
The only conclusion I came up with is that Philips somehow intervenes in the drawing to the surface (or possibly replaces it ... still investigating this) and draws the black bars on it.
Even weirder, zooming in at first stretches the bars together with the video (they are smaller at first due to kodi setting margins based on the video size), but after they reach the edge of the screen they stay there even when zooming in more.

VLC definitely has the same issue, but commercial apps strangely do not or do not provide a zoom function to check it. Plex definitely got around the issue as they have a zoom function and it covers the whole screen.

I have two lines of communication open to try to get an answer or at least a hint from Philips and I will also try to get any info from Plex if they will be willing to share.
(2020-02-02, 00:38)cerarp Wrote: [ -> ]I have managed to setup a build system and started investigating the issue.
It is however not going well. I have checked and compared every possible reason for this issue I could think of and still could not find the difference between the Philips TV and any other Android device.
I have checked window positions, window scaling, mediacodec settings, surface creation size, ...
The only conclusion I came up with is that Philips somehow intervenes in the drawing to the surface (or possibly replaces it ... still investigating this) and draws the black bars on it.
Even weirder, zooming in at first stretches the bars together with the video (they are smaller at first due to kodi setting margins based on the video size), but after they reach the edge of the screen they stay there even when zooming in more.

VLC definitely has the same issue, but commercial apps strangely do not or do not provide a zoom function to check it. Plex definitely got around the issue as they have a zoom function and it covers the whole screen.

I have two lines of communication open to try to get an answer or at least a hint from Philips and I will also try to get any info from Plex if they will be willing to share.
Thanks for sharing this info. Do you have any status update? I am eager to see if you will be able to resolve this issue. Thanks...
(2020-02-07, 16:08)Stile35 Wrote: [ -> ]
(2020-02-02, 00:38)cerarp Wrote: [ -> ]I have managed to setup a build system and started investigating the issue.
It is however not going well. I have checked and compared every possible reason for this issue I could think of and still could not find the difference between the Philips TV and any other Android device.
I have checked window positions, window scaling, mediacodec settings, surface creation size, ...
The only conclusion I came up with is that Philips somehow intervenes in the drawing to the surface (or possibly replaces it ... still investigating this) and draws the black bars on it.
Even weirder, zooming in at first stretches the bars together with the video (they are smaller at first due to kodi setting margins based on the video size), but after they reach the edge of the screen they stay there even when zooming in more.

VLC definitely has the same issue, but commercial apps strangely do not or do not provide a zoom function to check it. Plex definitely got around the issue as they have a zoom function and it covers the whole screen.

I have two lines of communication open to try to get an answer or at least a hint from Philips and I will also try to get any info from Plex if they will be willing to share.
Thanks for sharing this info. Do you have any status update? I am eager to see if you will be able to resolve this issue. Thanks... 
Still trying to get to the right person at Philips that could help resolve this. It's slow going. Will report any progress.
Good news.

Found the problem and fixed it.
Now I have to figure out how to create a pull request on github and read the kodi guidelines for doing so.

For any other developer facing this issue here is the solution:

Philips Android 9 MediaCodec implementation requires that on MediaFormat used to configure the codec you set not only the KEY_WIDTH and KEY_HEIGHT but also the KEY_MAX_WIDTH and KEY_MAX_HEIGHT parameters.
(2020-02-09, 20:02)cerarp Wrote: [ -> ]Good news.

Found the problem and fixed it.
Now I have to figure out how to create a pull request on github and read the kodi guidelines for doing so.

For any other developer facing this issue here is the solution:

Philips Android 9 MediaCodec implementation requires that on MediaFormat used to configure the codec you set not only the KEY_WIDTH and KEY_HEIGHT but also the KEY_MAX_WIDTH and KEY_MAX_HEIGHT parameters.

Waoh! Impressive.

Which values did you set them to? The video width / height itself?
Code:
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
index 105b5db865..a7ca4758a1 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
@@ -1150,6 +1150,8 @@ bool CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec(void)
   AMediaFormat_setString(mediaformat, AMEDIAFORMAT_KEY_MIME, m_mime.c_str());
   AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_WIDTH, m_hints.width);
   AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_HEIGHT, m_hints.height);
+  AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_MAX_WIDTH, m_hints.width);
+  AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_MAX_HEIGHT, m_hints.height);
   AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, 0);

^^ if this is enough I can PR it for you.
(2020-02-09, 20:31)fritsch Wrote: [ -> ]
Code:
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
index 105b5db865..a7ca4758a1 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
@@ -1150,6 +1150,8 @@ bool CDVDVideoCodecAndroidMediaCodec::ConfigureMediaCodec(void)
   AMediaFormat_setString(mediaformat, AMEDIAFORMAT_KEY_MIME, m_mime.c_str());
   AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_WIDTH, m_hints.width);
   AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_HEIGHT, m_hints.height);
+  AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_MAX_WIDTH, m_hints.width);
+  AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_MAX_HEIGHT, m_hints.height);
   AMediaFormat_setInt32(mediaformat, AMEDIAFORMAT_KEY_MAX_INPUT_SIZE, 0);

^^ if this is enough I can PR it for you. 

Yes that's all that is required. Thank you.
PR is here: https://github.com/xbmc/xbmc/pull/17353
It will result in a testbuild, that you can download from Jenkins. This is Matrix-Based for now. If it works for you a backport to Leia will be considered. I hope there are no side-effects for other devices.
I have tested on Philips TPM191E (xxPUS73x4) - Android 9, Sumsung Galaxy Tab A Android 8.1, Sumsung Galaxy S9 Android 9. No issues.

I also have an older Philips TV with Android 5.1 but I could not install it from a USB drive (the dreaded "App not installed error"). I don't have the time to figure this out now and I can't connect it to a computer to do an adb install (adb over network not enabled on it).

This change should not affect any device negatively since google's own ExoPlayer sets these values. That's how I found the solution.
Perfect. I will push it now and backport it towards 18.6 - thx very much.
Great job, excellent!!! It was faster than I was expected. I am happy to test it on my device. Which version and from where to download corrected version? Thanks.
@fritsch 

Am i correct in assuming that this is the proper test build to try:
https://jenkins.kodi.tv/job/Android-ARM/16751/
Pages: 1 2 3 4 5 6 7 8 9 10 11