Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Discuss media renderers like Xbox 360, TVs, smartphones, etc.
Post Reply
Paradox
Posts: 140
Joined: Tue Dec 17, 2013 5:50 am

Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Post by Paradox » Mon Apr 03, 2017 7:11 am

FIRST.... WARNING follow any of this wrong and you may have to reinstall UMS, this tinkering is not for new users or those that have any doubt what they are doing when following the directions. Failing to read carefully will result in failure

So a little history first some devices have never displayed the Aspect ratio of a movie correctly or as a work around would slightly crop the sides of the picture (mainly due to DLNA on some devices not obeying resolution rules) or they would horribly stretch the image.

For those not sure what im on about here is a basic example (Ive taken these images for example purposes from a user named Illico on the serviio forums, if staff here or the user himself do not want them used ill be happy to replace them when i have time, staff can remove this bit of the post if they deem fit but his work is a very good example FULL 100% CREDIT TO ILLICO).

NOTE:
Sony-BraviaEX.conf users ive done the work for you see the attached and bottom of the post


This is how an image from a video should look...

Image

If your device has problems it will typically do one of 2 things and display the image either stretched like this (ignore the red lines/border on the image for now im coming to them and concentrate on how the image is stretched... the balls on the fireplace look more oval and the girl suddenly has a fatter, wider head)

Image

This could be solved on many TVs to a degree including Sonys by basically zooming the image (this is what FFMeg basically does on problem devices to a degree and what happens if you use the zoom/aspect controls on your TV) The result is the pictures aspect looks fine but remember those red lines/border above, well thats what it crops off from the image) so the image then looks like this....

Image

Note how the aspect is correct (fireplace balls are round and the girls head no longer fat/wide) The problem of course is you have now lost a fair percentage of the image on the left and right hand sides... NOTE how some of the fireplace mantle at the top is now out of frame.


For non fussy users this has never really been a massive issue, some may have never even noticed, but it would drive me absolutely nuts, for older movies where opening/ending credits would span the whole screen you would lose half a letter or more on the sides, movies reliant on close up shots or focusing on a fixed image you would also miss what was fully going on, you get the idea.

On some devices you could solve it easily by using Mencoder in UniversalMediaServer instead of FFMpeg (or vice versa) for the transcoding (works a treat on my Sony Bravia KDL40EX403 which uses the SonyEX.conf renderer). BUT ive always wanted to get UMS to work perfectly with Mencoder and FFMpeg.


The solution
1. FIND out which renderer conf file your device uses, this will be displayed either on the main status screen when you open UMS or listed within the logs on the logs tab, perhaps even both.
2. Find and rename that renderer "conf" file in the renderers folder your device uses and rename it from xxxx.conf to xxxx.conf.bak (where xxxx is the device renderers name)
3. Open that file you have renamed into a text editor like notepad++ and remove/delete any entries including anything after the "=" sign that have...

Code: Select all

KeepAspectRatio =
KeepAspectRatioTranscoding =
OverrideFFmpegVideoFilter =
CustomMencoderOptions =
^^^ If you do not remove those the rest of this will not work.

4 Now INSERT the following commands, (leave them if already in there) do this in the same general area as you removed any commands from, do not insert them at the very top (thats renderer info) or at the very bottom of the file (Thats for info about file/media types)

Code: Select all

AccurateDLNAOrgPN = true
MuxNonMod4Resolution = true
DLNALocalizationRequired = true
in addition to those you then need these that do most of the magic...

Code: Select all

OverrideFFmpegVideoFilter = pad=max(iw*1.01\\,ih*1.01*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2, setdar=4/3
CustomMencoderOptions = -vf softskip,expand=::::1:16/9:2,scale=1283:720 -lavcopts aspect=16/9
5 Save this file with the same name as the file you opened only without the .bak on the end of it (see it ends in .conf), if needed copy it into your renderers folder. Doing things this way mean you will have a backup file of the original (IE the original you renamed to have .bak on the end) If this tweaking then makes things worse you can delete the new conf and rename the bak file back to what it was. This saves having to reinstall if things dont work. OR it will if you have read this far and followed.

6 IMPORTANT.... Play back a file and ensure zoom/aspect picture settings on your sony are set to +1 or FULL Pixel.... To do this...........
Start playing a file
Press the options button on your remote
Go to the top and picture options
Select screen
Adjust until it reads +1 or Full Pixel (depending on model it will show one or the other, some sonys may have both options, in that case select Full Pixel)
OTHER devices you will have to find the option on your TV, it will either generally be be under screen settings, aspect or similar.

Further notes
If you only have stretched/crop issues with FFMpeg just try the OverrideFFmpegVideoFilter = line if you have issues with just Mencoder enter just the CustomMencoderOptions = line, if you have had problems when using both FFMpeg and Mencoder try them both. Some device it may still not work perfectly for, but for SONY devices this should solve the issue 100% once and for all.

For anyone using a device that makes use of the Sony-BraviaEX.conf file attached is a copy of my Sony-BraviaEX.conf which now gives 100% as far as ive been able to test anyways over the past couple of days correct Aspect ratio and NO cropping and works for using both Mencoder and FFMpeg.......... I have NOT tested with subtitles, i do not use the subtitle feature in UMS so if that does not work and you really need subs you will have to experiment further.... Im happy with things as is and a picture displayed PERFECTLY! It took a hell of a lot of FFMpeg experimenting to finally get rid of crop issues.

Sony users feedback especially appreciated. Especially those that use the Sony-BraviaEX.conf renderer.

Enjoy :)
Attachments
Sony-BraviaEX.conf
(2.7 KiB) Downloaded 183 times

Nadahar
Posts: 1401
Joined: Tue Jun 09, 2015 5:57 pm

Re: Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Post by Nadahar » Mon Apr 03, 2017 12:44 pm

Great post Paradox :)

I'd just like to mention that there's no need to reinstall UMS if any of the renderer configuration files are "lost" or edited byond repair. The latest version of those that ship with UMS can always be found here: https://github.com/UniversalMediaServer ... /renderers

Also, to make editing easier - there's no need to delete lines to disable them. Simply putting an # on the start of a line disables it. That makes it easier to reverse changes if needed, and you can also write "notes" to yourself or others in the file by starting the line with an #.

Paradox
Posts: 140
Joined: Tue Dec 17, 2013 5:50 am

Re: Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Post by Paradox » Mon Apr 03, 2017 10:59 pm

Nadahar wrote:Great post Paradox :)

I'd just like to mention that there's no need to reinstall UMS if any of the renderer configuration files are "lost" or edited byond repair. The latest version of those that ship with UMS can always be found here: https://github.com/UniversalMediaServer ... /renderers

Also, to make editing easier - there's no need to delete lines to disable them. Simply putting an # on the start of a line disables it. That makes it easier to reverse changes if needed, and you can also write "notes" to yourself or others in the file by starting the line with an #.
You are of course correct, people can indeed just use '#' to comment out lines rather than remove them. I was going to mention that method but did not want people doing what i once stupidly did and comment out the UpnpDetailsSearch = setting at the top by mistake. :lol: You may laugh but if you are tidying things up as you work (IE removing blank lines etc) its easily done. I swear i stared at the config for hours trying to figure out what i had done before i finally realised and then slapped myself :D

Good news about the renderers all being available on github separate, i had never noticed that before. Very smart decision by you guys to put them on there. As you say that will help anyone who gets over eager and screws up their .conf file when editing. Will no doubt help people :)

Paradox
Posts: 140
Joined: Tue Dec 17, 2013 5:50 am

Re: Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Post by Paradox » Sun Apr 09, 2017 12:28 pm

Update...

Replace the OverrideFFmpegVideoFilter previously mentioned with this...

Code: Select all

OverrideFFmpegVideoFilter = pad=max(iw*1.01\\,ih*1.01*(16/9)):ow/(16/9):(ow-iw)/16:(oh-ih)/16, setdar=4/3
The altered "(ow-iw)/16:(oh-ih)/16" part of the above code allows older divx and xvid codec encoded videos to scale properly, will also work better for newer xvid codecs that require resolutions are a multiple of 4 (NOT 2). Will also in addition allow x264 using older profiles that required resolutions to be a multiple of 4 or more.

This flaw is also in the code "Keepaspectratiotranscoding" many profiles/renderers are using which scales to multiples of 2.... Staff should change that if reading ;) (Popular xvid files like/prefer multiples of 4).

Will also work for rarely used codecs that require a multiple of 8 or 16 for video resolution (older WMV, x264 in avi container and a few others ive came across in testing). Without it or with the prior /2 settings you would get either a small black bar on one side or top/bottom of the video with affected codecs and HD resolutions. Its is/was hardly noticeable but is there.

Further help to test this after applying..............

See the attached for an updated "Sony-BraviaEX.conf" a LINK to a video to test aspect ratio. Basically when playing the video pay attention to the top, bottom and sides you should be able to read the message "Outside white line indicates No overscan" all around the edge of your screen you should see a white line about 1 pixel in width. If you can then congrats everything works perfect.

Once again enjoy :D
Attachments
videodownload.txt
(132 Bytes) Downloaded 151 times
Sony-BraviaEX.conf
(2.8 KiB) Downloaded 169 times


djbarney
Posts: 6
Joined: Mon Feb 10, 2014 4:56 am

Re: Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Post by djbarney » Mon Nov 27, 2017 7:13 am

Hi, I tried this as a temporary fix for my Sagemcom device while a patch is being worked on. However it does not seem to work for this device. Everything just gets shifted to the left a little. I have videos extracted from DVD using Handbrake that cuts off the black bars from top and bottom. With UMS I wish I'd just left them on as I don't think that much space is actually saved. But other players do handle it. For example there's a well known Android video player that scales the image properly (I forget the name ATM).

Paradox
Posts: 140
Joined: Tue Dec 17, 2013 5:50 am

Re: Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Post by Paradox » Sun Dec 23, 2018 5:47 am

djbarney wrote:
Mon Nov 27, 2017 7:13 am
Hi, I tried this as a temporary fix for my Sagemcom device while a patch is being worked on. However it does not seem to work for this device. Everything just gets shifted to the left a little. I have videos extracted from DVD using Handbrake that cuts off the black bars from top and bottom. With UMS I wish I'd just left them on as I don't think that much space is actually saved. But other players do handle it. For example there's a well known Android video player that scales the image properly (I forget the name ATM).
This solution will no longer work properly, i believe due to a change in FFMPEG version (though could be other code) reverting the line to the original or altering the 1.01 parts to 1.00 will fix things.

Puginhouseman
Posts: 1
Joined: Sun Jan 06, 2019 5:35 am

Re: Aspect and Crop issues on ALL SONY and potentially other devices possibly finally solved????

Post by Puginhouseman » Sun Jan 06, 2019 6:00 am

Hi everyone - this is an old thread but it offered me some guidance when I encountered the same or very similar problem.

I have two Bravia TV's in the house and when I could get media servers working (first was Serviio, then a Synology NAS), I always found that images did not fill the screen, largely defeating the object of getting the images there.

The "solution" based on the comments in this thread has been in the TV options settings.
After choosing (I think any) one of the pictures, from the Remote, select Options, then Playback Options, then Cropping, and select Face Zoom. It worked for me, enlarging the photo's to fill the screen (but perhaps not totally) and appears to apply to all photo's. Haven't tried it on video's yet.

Post Reply