Kodi Community Forum
Solved 4:3 HEVC Videos Are Stretched to 16:9 in Kodi 20.1 on Fire TV - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Video Support (https://forum.kodi.tv/forumdisplay.php?fid=264)
+--- Thread: Solved 4:3 HEVC Videos Are Stretched to 16:9 in Kodi 20.1 on Fire TV (/showthread.php?tid=373245)



4:3 HEVC Videos Are Stretched to 16:9 in Kodi 20.1 on Fire TV - mebia - 2023-05-22

I've found that 4:3 videos (specifically 1440x1080) are stretched to 16:9 by Kodi 20.1 for Android, when video Video settings > View mode is Normal.
Kodi 20.1 for Windows and Kodi 19.4 for Android do not exhibit this issue.
Changing video Video settings > View mode to Stretch 4:3 alleviates the issue but it's inconvenient to do this for every 4:3 video and it cannot be set as the default as doing so would negatively affect the viewing experience when watching 16:9 videos.
Is this a known issue? Is there a solution?

Thanks in advance.


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - b'sketti - 2023-05-22

Under Settings > Player > Videos > Playback is a setting Display 4:3 videos as where you can choose Normal.


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - mebia - 2023-05-22

(2023-05-22, 05:23)b'sketti Wrote: Under Settings > Player > Videos > Playback is a setting Display 4:3 videos as where you can choose Normal.

Thanks for the response. However, I checked this setting and it is already set to Normal.


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - Klojum - 2023-05-22

Does rotating through the zoom options have Kodi activate/find the correct aspect ratio?


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - mebia - 2023-05-24

(2023-05-22, 08:12)Klojum Wrote: Does rotating through the zoom options have Kodi activate/find the correct aspect ratio?
If I understand your meaning:
Cycling through Video settings > View mode does not cause Kodi to find the correct aspect ratio, upon returning to Normal.


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - mebia - 2023-05-24

Upon further inspection, I've discovered that not all 4:3 (1440x1080) videos exhibit this issue.
However, I can't find any difference between "good" and "bad" videos other than that the problematic videos were created with newer versions of ffmpeg and mkvmerge.
Since these problematic videos are properly displayed by Kodi for Windows and Plex for Android, I'm thinking this is a problem specific to the Android (Fire TV) player utilized by Kodi. Though I haven't a clue what it is about these videos that it doesn't like.

MediaInfo for a 4:3 video that is stretched to 16:9: 
https://paste.kodi.tv/aluvesukuk

MediaInfo for a 4:3 video that is respected: 
https://paste.kodi.tv/hugovazexo

Debug log from Kodi for Android, playing both of these videos:
https://paste.kodi.tv/ayibiyedew.kodi

Maybe someone can spot something that I missed.


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - izprtxqkft - 2023-05-24

you arent able to spot the difference because you are using a more generic info tool, mediainfo

when dealing with these sorts of things it is far better to use ffmpeg

luckily, the ffmpeg output for your files is included in your log

compare lines 320 and 468

note the file which is displaying as 4:3 has it's sar and dar set correctly - SAR 1:1 DAR 4:3

the one that is being stretched has no such information present, so kodi gets to decide what to do


the resolution of your video 1440x1080 uses rectangular pixels so mathematically it can actually achieve both 16:9 and 4:3 difference being 1.33... vs 1.77...

i found a better explanation of that here - http://www.frankschrader.us/pixel-aspect-ratio-video-resolution-of-1440x1080-considered-a-widescreen-format-169


and example commandline for ffmpeg to set the dar and sar - http://underpop.online.fr/f/ffmpeg/help/setdar_002c-setsar.htm.gz


its just because the file isnt coded properly


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - mebia - 2023-05-24

(2023-05-24, 07:13)jepsizofye Wrote: you arent able to spot the difference because you are using a more generic info tool, mediainfo

when dealing with these sorts of things it is far better to use ffmpeg

luckily, the ffmpeg output for your files is included in your log

compare lines 320 and 468

note the file which is displaying as 4:3 has it's sar and dar set correctly - SAR 1:1 DAR 4:3

the one that is being stretched has no such information present, so kodi gets to decide what to do


the resolution of your video 1440x1080 uses rectangular pixels so mathematically it can actually achieve both 16:9 and 4:3 difference being 1.33... vs 1.77...

i found a better explanation of that here - http://www.frankschrader.us/pixel-aspect-ratio-video-resolution-of-1440x1080-considered-a-widescreen-format-169


and example commandline for ffmpeg to set the dar and sar - http://underpop.online.fr/f/ffmpeg/help/setdar_002c-setsar.htm.gz


its just because the file isnt coded properly
Thank you very much for uncovering the issue and providing those links.
ffmpeg must have changed its behavior semi-recently as I haven't explicitly specified SAR and DAR in the past.

I suppose I can't fault Kodi for the inconsistent behavior, in the absence of proper coding.
Though it's interesting that other players preserve the aspect ratio implied by the resolution while Kodi for Android defaults to stretching.


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - izprtxqkft - 2023-05-24

i would agree its interesting but then thats probably why the metdata was introduced in the first place, in order to tell players what it should be instead of letting it decide for itself and making a wrong decision


RE: 4:3 Videos Are Stretched to 16:9 in Kodi 20.1 for Android - mebia - 2023-05-25

Upon further investigation, I've discovered that this is an HEVC-specific issue as an H264 without DAR is not stretched.
As well, this is a Fire TV-specific issue as my Shield does not exhibit the same problem.


RE: 4:3 HEVC Videos Are Stretched to 16:9 in Kodi 20.1 on Fire TV - CodyLane - 2023-10-08

Hoping it might be helpful to others - as I was referred to this thread and couldn't make sense of any of it ;)

Here's the code to batch edit the 4:3 files so that Kodi will play nice with them - 

code:
for i in *.mp4; do ffmpeg -i "$i" -aspect 480:360 -c copy "${i%}.mp4"; done

You sadly do end up with the double .mp4 extension - but that's easily enough dealt with using some nifty program with a handy GUI outside scary coder terminal world ;)


RE: 4:3 HEVC Videos Are Stretched to 16:9 in Kodi 20.1 on Fire TV - izprtxqkft - 2023-10-08

code:
mkdir newfiles
for i in *.mp4; do ffmpeg -i "$i" -aspect 480:360 -c copy "newfiles/${i%}"; done
mv newfiles/*.mp4 .


no extra extensions to remove


RE: 4:3 HEVC Videos Are Stretched to 16:9 in Kodi 20.1 on Fire TV - CodyLane - 2023-10-08

Thank you - on this aspect ratio, is that indicating pixels - or would this work just as well? 

code:
mkdir newfiles
for i in *.mp4; do ffmpeg -i "$i" -aspect 4:3 -c copy "newfiles/${i%}"; done
mv newfiles/*.mp4 .

And please ignore my idiocy - I'm just a kid in a sandbox - fascinated as to how the gurus are all so easily building their amazing castles - and I'm just all covered in mud ;)