FAQ  •  Register  •  Login

[SOLVED] Sony Bravia - Aspect Ratio fixing

<<

sloebric

Serviio newbie

Posts: 6

Joined: Sun Aug 21, 2011 6:01 pm

Post Fri Sep 02, 2011 9:19 pm

Re: Sony Bravia - Aspect Ratio fixing

Illico wrote:On latest ffmpeg 0.8 changelog, I see :
- mpeg2 aspect ratio detection fixed
Don't know what this...any idea?


Downloaded ffmpeg via Git and compiled. Aspect ratio problem on some has gone away (namely 16:9 content). Anything else gets stretched. I worked around Serviio's (current) inability to pass custom options by renaming ffmpeg to something else and creating a new "ffmpeg" script (see below) that calls the original ffmpeg binary after some manipulation. At a minimum it allows me to remap my AC3 streams from track 2 to track 1 (works great, btw). I'm trying to force the aspect ratio using "setdar" and "-aspect" commands, but they're ignored somehow. I use this same exact script for MediaTomb and it works. Is there something at the DLNA protocol level that munges this? I've looked at the protocol exchange between TV and server using MT & Serviio, but don't see anything different.

#!/bin/bash

INPUT="$2"

DAR=`ffprobe -show_streams "${INPUT}" | grep -m 1 'display_aspect_ratio' | awk -F= '{ print $2 }'`
#SAR=`ffprobe -show_streams "${INPUT}" | grep -m 1 'sample_aspect_ratio' | awk -F= '{ print $2 }'`
#FPS=`ffprobe -show_streams "${INPUT}" | grep -m 1 'avg_frame_rate' | awk -F= '{ print $2 }'`
AC3_TRACK=`ffprobe -show_streams "${INPUT}" | grep ac3 -B10 | grep 'index=' | awk -F= '{ print $2 }'`
ASPECT_1=`echo $DAR | awk -F: '{ print $1 }'`
ASPECT_2=`echo $DAR | awk -F: '{ print $2 }'`
ASPECT_R=$(($ASPECT_1 / $ASPECT_2))

if [ $DAR != '' ]; then
ASPECT="-vf setdar=${DAR}";
else
ASPECT="-vf setdar=16:9";
fi

if [ ! $AC3_TRACK ]; then
AC3_TRACK=1;
fi

OPTS="${@//0:1/0:$AC3_TRACK $ASPECT}";

echo $OPTS > /tmp/serviio.txt
echo $AC3_TRACK >> /tmp/serviio.txt
echo $ASPECT_1 >> /tmp/serviio.txt
echo $ASPECT_2 >> /tmp/serviio.txt
echo $ASPECT_R >> /tmp/serviio.txt
echo $ASPECT_M >> /tmp/serviio.txt

ffmpeg.exe "${@//0:1/0:$AC3_TRACK $ASPECT}"
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sat Sep 03, 2011 11:34 am

Re: Sony Bravia - Aspect Ratio fixing

nothing on the DLNA level should interfere. How does the resulting video look when played on VLC?

Also, Illico, can you confirm your script from this topic are the way to go or should this simpler command be enough? I'm aiming at getting the padding on top/bottom, not zooming.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Sun Sep 04, 2011 9:46 am

Re: Sony Bravia - Aspect Ratio fixing

zip wrote:Also, Illico, can you confirm your script from this topic are the way to go or should this simpler command be enough? I'm aiming at getting the padding on top/bottom, not zooming.


Sorry, I don't really get time, but what I could say:
- In fact for <720 resolution, you have to play with DAR (setdar) for Sony TV to display movie without black bar, and without stretching. We also known that Sony ZOOM option could be a workaround.
- I also known that Sony bravia TV lost some pixels in left/right side with MPEG2 streaming when resolution < 720

- So, I found out that the Sony Bravia TV doesn't deal with non-HD stuff properly! so I need to expand/upscale to a HD : 1280x720 resolution.
I think this is how Mezzmo deals with <720 video: always transcode to 1280x720 resolution (with -s 1280x720)...I know this is not very good for CPU usage, and its not a solution for source file with DAR different from 4:3 or 16:9.
For now,
"-vf "scale=1280:1280/dar/sar","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3" ffmpeg option for <=720 resolution with DAR >= 16:9
or
"-vf "scale=720*dar*sar:720","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3" when DAR < 16:9 is a good deal
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

sloebric

Serviio newbie

Posts: 6

Joined: Sun Aug 21, 2011 6:01 pm

Post Sun Sep 04, 2011 8:54 pm

Re: Sony Bravia - Aspect Ratio fixing

Illico wrote:
zip wrote:Also, Illico, can you confirm your script from this topic are the way to go or should this simpler command be enough? I'm aiming at getting the padding on top/bottom, not zooming.


Sorry, I don't really get time, but what I could say:
- In fact for <720 resolution, you have to play with DAR (setdar) for Sony TV to display movie without black bar, and without stretching. We also known that Sony ZOOM option could be a workaround.
- I also known that Sony bravia TV lost some pixels in left/right side with MPEG2 streaming when resolution < 720

- So, I found out that the Sony Bravia TV doesn't deal with non-HD stuff properly! so I need to expand/upscale to a HD : 1280x720 resolution.
I think this is how Mezzmo deals with <720 video: always transcode to 1280x720 resolution (with -s 1280x720)...I know this is not very good for CPU usage, and its not a solution for source file with DAR different from 4:3 or 16:9.
For now, "-vf "scale=1280:1280/dar/sar","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3" ffmpeg option for <=720 resolution with DAR >= 16:9 is a good deal


VLC plays video in the correct aspect ratio.

One more thing, the output from "ffmpeg -i <filename>" during the metadata search and whatnot is different than previous versions of ffmpeg. This causes the addition of new videos to the database to fail. See below. Wouldn't it be better to use ffprobe anyways and use one the XML-ish options (e.g. -show_streams)?

Old FFMPEG

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/Movies/PG13+/Priest.m4v':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : HandBrake 0.9.5 2011010300
Duration: 01:28:25.98, start: 0.000000, bitrate: 1260 kb/s
Stream #0.0(und): Video: h264, yuv420p, 720x352 [PAR 2816:2403 DAR 640:267], 641 kb/s, PAR 49456:36045 DAR 2248:801, 23.98 fps, 90k tbr, 90k tbn, 180k tbc
Stream #0.1(eng): Audio: ac3, 48000 Hz, 2 channels, s16, 448 kb/s
Stream #0.2(eng): Audio: aac, 48000 Hz, stereo, s16, 164 kb/s
At least one output file must be specified

NEW FFMPEG

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/Movies/PG13+/Priest.m4v':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2011-09-03 17:22:01
encoder : HandBrake 0.9.5 2011010300
Duration: 01:28:25.98, start: 0.000000, bitrate: 1260 kb/s
Stream #0.0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x352 [SAR 2816:2403 DAR 640:267], 641 kb/s, 23.98 fps, 90k tbr, 90k tbn, 180k tbc
Metadata:
creation_time : 2011-09-03 17:22:01
Stream #0.1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 6 channels, s16, 448 kb/s
Metadata:
creation_time : 2011-09-03 17:22:01
Stream #0.2(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 164 kb/s
Metadata:
creation_time : 2011-09-03 17:22:01
At least one output file must be specified
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Wed Nov 23, 2011 8:57 pm

Re: Sony Bravia - Aspect Ratio fixing

Some sample information with default Serviio/ffmpeg transcoding options:
Samples_avi.PNG
Samples_avi.PNG (26.42 KiB) Viewed 22112 times

After Display Aspect Ratio correction (without upscaling):
With DAR > 16:9 ==> -vf "pad=iw:iw/16*9:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
With DAR < 16:9 ==> -vf "pad=ih*16/9:ih:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
Samples_avi_dar_correction.PNG
Samples_avi_dar_correction.PNG (23.12 KiB) Viewed 22112 times



After another Display Ratio correction (with upscaling):
With DAR > 16:9 ==> -vf "scale=1280:1280/dar/sar","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
With DAR < 16:9 ==> -vf "scale=720*dar*sar:720","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
Samples_avi_dar_correction2.PNG
Samples_avi_dar_correction2.PNG (23.25 KiB) Viewed 22111 times

for the 1920 sample, used -vf "scale=1920:1920/dar/sar","pad=1920:1080:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

DrSeymour

Serviio newbie

Posts: 3

Joined: Fri Nov 25, 2011 2:42 am

Post Fri Nov 25, 2011 1:27 pm

Re: Sony Bravia - Aspect Ratio fixing

Illico wrote:_Updated 15/11/11_
I'm working on ffmpeg option to use for Sony Bravia TV Aspect Ratio fixing.
1) This is the best solution
...
ffmpeg option to use with AVI files <720 height resolution
With DAR > = 16:9
"-vf "scale=1280:1280/dar/sar","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
With DAR < 16:9
"-vf "scale=720*dar*sar:720","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
...
2) An alternative
...
With DAR > = 16:9
-vf "pad=iw:iw/16*9:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
With DAR < 16:9
-vf "pad=ih*16/9:ih:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"
.


Hi, thank you very much for this product, it works beautifully for me - the only trouble was with the aspect ratio as I see much work has been done to fix. It took me a while to figure out where to put the ffmpeg options, am I right that you edit the file 'bin\ServiioService.exe.vmoptions' and add the line:

-Dffmpeg.location="C:\Program Files\Serviio\lib\ffmpeg.exe" -vf "scale=1280:1280/dar/sar", ... etc.

That works for me but is that correct or are these options meant to go elsewhere? Sorry for the newbie question but I searched the faq, wiki, many other forum posts etc.


Secondly, I think I have figured out a solution regardless of whether DAR is >16:9 or <16:9. I have formatted as per your solution:

1) -vf "scale=min(1280\,720*dar*sar):min(720\,1280/dar/sar)","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"

2) -vf "pad=max(iw\,ih*16/9):max(ih\,iw/16*9):(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"

So option 1 upscales to 1280*720 and pads either top/bottom or left/right correctly, or option 2 just adds the correct padding to bring to 16:9, either top/bottom or left/right, without the HD-upscale cpu overhead.

Hope that is helpful and once again thank you for a great product.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Fri Nov 25, 2011 1:28 pm

Re: Sony Bravia - Aspect Ratio fixing

THis is just a discussion on what has to be implemented in future Serviio versions for this to work. You won't be able to pass any custom parameters to FFmpeg as of now.
<<

DrSeymour

Serviio newbie

Posts: 3

Joined: Fri Nov 25, 2011 2:42 am

Post Fri Nov 25, 2011 1:53 pm

Re: Sony Bravia - Aspect Ratio fixing

zip wrote:THis is just a discussion on what has to be implemented in future Serviio versions for this to work. You won't be able to pass any custom parameters to FFmpeg as of now.


Oh I see! Makes sense now, why I couldn't figure out where to put those options.

Though I should point out, as I wrote above, I edited the "ServiioService.exe.vmoptions" file and added the options, re-started the Service, and now I do get the correct aspect ratio on my Bravia KDL-32V5500. - (regardless of the aspect ratio of the original file e.g. 4:3 or 2.25:1 etc.)

I have gone with option 2 so the exact line I added is as follows:

-Dffmpeg.location=C:\Apps\Video\Serviio\lib\ffmpeg.exe -vf "pad=max(iw\,ih*16/9):max(ih\,iw/16*9):(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"

Sorry I don't mean to derail the thread but that does work for me.
Last edited by DrSeymour on Fri Nov 25, 2011 2:43 pm, edited 1 time in total.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Fri Nov 25, 2011 2:07 pm

Re: Sony Bravia - Aspect Ratio fixing

ah ok, cool. It might give Illico some help in pinning this down.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Fri Nov 25, 2011 4:37 pm

Re: Sony Bravia - Aspect Ratio fixing

zip wrote:ah ok, cool. It might give Illico some help in pinning this down.

:o Why did not think of that SOONER ?
I will also try your max(A;B)
Many Thanks, DrSeymour
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Fri Nov 25, 2011 4:53 pm

Re: Sony Bravia - Aspect Ratio fixing

I wasn't aware it's possible, as usually the parameters need to be in certain order for ffmpeg to work.
<<

DrSeymour

Serviio newbie

Posts: 3

Joined: Fri Nov 25, 2011 2:42 am

Post Fri Nov 25, 2011 10:21 pm

Re: Sony Bravia - Aspect Ratio fixing

zip wrote:I wasn't aware it's possible, as usually the parameters need to be in certain order for ffmpeg to work.


Yes I'm not sure if adding the line to 'ServiioService.exe.vmoptions' as I've done, over-writes any of your proper ffmpeg settings as written in your readme.txt file i.e. :

FFmpeg
============================
...
*Windows* build has been configured as:
./configure --enable-static --disable-shared --disable-ffplay --disable-ffserver --enable-memalign-hack \
--enable-libmp3lame --enable-librtmp --arch=x86 --enable-runtime-cpudetect --enable-pthreads \
--extra-ldflags=-L/static/lib --extra-cflags=-I/static/include --extra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm'


The quality of the output looks good to me, and cpu load seems the same as before (except when implementing the 1280x720 upscale option) but I couldn't tell if any of those settings above have been affected.

Also something I've noticed is that while aspect ratio is now fixed for anything I stream from my pc's hard drive, it does not seem to work for Youtube streams set up via the 'online sources' / groovy script.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Sat Nov 26, 2011 4:42 pm

Re: Sony Bravia - Aspect Ratio fixing

I added this on ServiioService.exe.vmoptions:
-Dffmpeg.location=C:\Serviio\lib\ffmpeg.exe -vf "pad=max(iw\,ih*16/9):max(ih\,iw/16*9):(ow-iw)/2:(oh-ih)/2:blue","setdar=4:3"
(blue is for debug purpose to see when the padding is added, must be set to black)

- Filter is used only when transcoding into mpeg2video is used (see profile definition), still have some pixel lost in left/right side, but its a BIG step for Sony Bravia users !!
- Filter is not used with remux (vcodec copy) or in native format. So resulting aspect ratio could be bad (depends on source aspect ratio).

Zip, I think you could add this option for Sony Bravia profiles.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

pizzaguy541

Serviio lover

Posts: 89

Joined: Sun Jan 02, 2011 10:01 am

Location: United States

Post Sun Nov 27, 2011 12:24 pm

Re: Sony Bravia - Aspect Ratio fixing

Good job on the testing Illico.

Are you saying that the Sony Bravia profile needs every file transcoded to mpeg2video in order for this to work?
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Sun Nov 27, 2011 1:23 pm

Re: Sony Bravia - Aspect Ratio fixing

pizzaguy541 wrote:...Are you saying that the Sony Bravia profile needs every file transcoded to mpeg2video in order for this to work?

If source aspect ratio is not standard, yes, every bad file must be transcoded with filter to mpeg2video to works properly.
But in the fact, lots of my AVC source files are correct, so I prefer not transcode and keep video codec.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Nov 27, 2011 2:46 pm

Re: Sony Bravia - Aspect Ratio fixing

I thought the wrong aspect ratio is there only for files that are being transcoded, e.g. AVI. So I would not invoke transcoding just because file has wrong PAR, but only fix the transcoding command that is used.
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Sun Nov 27, 2011 5:30 pm

Re: Sony Bravia - Aspect Ratio fixing

zip wrote:So I would not invoke transcoding just because file has wrong PAR, but only fix the transcoding command that is used.

That's what I want too for next release.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

Xmantium

User avatar

DLNA master

Posts: 1396

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Mon Jan 16, 2012 8:19 pm

Re: Sony Bravia - Aspect Ratio fixing

I cant get it to work, i added this on ServiioService.exe.vmoptions:
-Dffmpeg.location=C:\Program Files\Serviio\lib\ffmpeg.exe -vf "pad=max(iw\,ih*16/9):max(ih\,iw/16*9):(ow-iw)/2:(oh-ih)/2:blue","setdar=4:3"

Also is there a linux version to do this?

i get the following error
  Code:
2012-01-13 20:10:32,811 WARN  [ProcessExecutor] Process cmd has a return code of 1! This is a possible error.
2012-01-13 20:10:40,300 ERROR [ResourceTransportRequestHandler] Error while processing resource, sending back 500 error. Message: Transcoded file 'C:\Windows\TEMP\Serviio\transcoding-temp-2-MPEG2TS.stf' cannot be found, FFmpeg execution probably failed
java.io.IOException: Transcoded file 'C:\Windows\TEMP\Serviio\transcoding-temp-2-MPEG2TS.stf' cannot be found, FFmpeg execution probably failed
   at org.serviio.delivery.resource.transcode.FileBasedTranscodingDeliveryStrategy.createInputStream(FileBasedTranscodingDeliveryStrategy.java:45)
   at org.serviio.delivery.resource.transcode.AbstractTranscodingDeliveryEngine.retrieveTranscodedResource(AbstractTranscodingDeliveryEngine.java:129)
   at org.serviio.delivery.resource.AbstractDeliveryEngine.deliver(AbstractDeliveryEngine.java:96)
   at org.serviio.delivery.MediaResourceRetrievalStrategy.retrieveResource(MediaResourceRetrievalStrategy.java:121)
   at org.serviio.upnp.webserver.ResourceTransportRequestHandler.handleRequest(ResourceTransportRequestHandler.java:116)
   at org.serviio.upnp.webserver.AbstractRequestHandler.handle(AbstractRequestHandler.java:54)
   at org.apache.http.protocol.HttpService.doService(HttpService.java:293)
   at org.serviio.upnp.webserver.ServiioHttpService.doService(ServiioHttpService.java:58)
   at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:212)
   at org.serviio.upnp.webserver.WebServer$WorkerThread.run(WebServer.java:187)
2012-01-13 20:11:33,454 WARN  [ProcessExecutor] Process cmd has a return code of 1! This is a possible error.
2012-01-13 20:11:40,947 ERROR [ResourceTransportRequestHandler] Error while processing resource, sending back 500 error. Message: Transcoded file 'C:\Windows\TEMP\Serviio\transcoding-temp-6-MPEG2TS.stf' cannot be found, FFmpeg execution probably failed
java.io.IOException: Transcoded file 'C:\Windows\TEMP\Serviio\transcoding-temp-6-MPEG2TS.stf' cannot be found, FFmpeg execution probably failed
   at org.serviio.delivery.resource.transcode.FileBasedTranscodingDeliveryStrategy.createInputStream(FileBasedTranscodingDeliveryStrategy.java:45)
   at org.serviio.delivery.resource.transcode.AbstractTranscodingDeliveryEngine.retrieveTranscodedResource(AbstractTranscodingDeliveryEngine.java:129)
   at org.serviio.delivery.resource.AbstractDeliveryEngine.deliver(AbstractDeliveryEngine.java:96)
   at org.serviio.delivery.MediaResourceRetrievalStrategy.retrieveResource(MediaResourceRetrievalStrategy.java:121)
   at org.serviio.upnp.webserver.ResourceTransportRequestHandler.handleRequest(ResourceTransportRequestHandler.java:116)
   at org.serviio.upnp.webserver.AbstractRequestHandler.handle(AbstractRequestHandler.java:54)
   at org.apache.http.protocol.HttpService.doService(HttpService.java:293)
   at org.serviio.upnp.webserver.ServiioHttpService.doService(ServiioHttpService.java:58)
   at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:212)
   at org.serviio.upnp.webserver.WebServer$WorkerThread.run(WebServer.java:187)
Sony Bravia 2010 52NX803 - Sony PS3 - Xbox 360
Serviio running on QNAP NAS 639 Pro - 1.6 Intel Dual Core - 2GB RAM and QNAP NAS 121 - 2Ghz ARM Marvell - 1GB RAM
Console using ServiiDroid for Android, ServiiMetro and ServiiWP for Windows Phone and WebUI for iOS
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jan 17, 2012 8:16 am

Re: Sony Bravia - Aspect Ratio fixing

Yes, with latest ffmpeg version, command option order are important and this workaround failed.
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
<<

Illico

User avatar

DLNA master

Posts: 4646

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jan 17, 2012 8:31 am

Re: Sony Bravia - Aspect Ratio fixing

Now I'm using this tips from digitalhack : viewtopic.php?f=7&t=4711&p=32529#p32490

- On windows, install ActivePerl (for example in C:\Perl\)

- Edit "ServiioService.exe.vmoptions" file and change the Dffmpeg.location variable to use a ffmpeg wrapper in perl script, like this:
(use your own Serviio install path)
  Code:
-Xmx384m
-Dffmpeg.location="C:/Perl/bin/perl.exe C:/Serviio/Script/serviio-ffmpeg.pl"


- Create a perl script for example on "C:/Serviio/Script/serviio-ffmpeg.pl" folder path, contains the following code:
  Code:
use strict;

my $args = '';

foreach my $arg (@ARGV) {
  $args = $args . "\"$arg\" ";
}

if ($args =~ /^(.*)\s\"mpeg2video\"\s(.*)$/) {
  $args = $1 . ' "mpeg2video" "-vf" "pad=max(iw\,ih*16/9):max(ih\,iw/16*9):(ow-iw)/2:(oh-ih)/2:blue,setdar=4:3" ' . $2;
}

my $cmd = "\"C:\\Program Files (x86)\\Serviio\\lib\\ffmpeg.exe\" $args";

open(LOGFILE, ">>C:\\Program Files (x86)\\Serviio\\log\\ffmpeg-wrapper.log");

if (system($cmd) != 0) {
  print LOGFILE scalar localtime . " Failed: " . $cmd . " with $?\n";
  close (LOGFILE);
  die "Failed\n";
  } else {
  print LOGFILE scalar localtime . " Success: " . $cmd . "\n";
  close (LOGFILE);
}


--> if mpeg2video video transcoding is used, perl script insert padding options
Illico
Sony 2010 KDL-46EX501 | BDP-S373 | SMP-N100 | Windows 8-i7 | Network DD HD-CE1.5TLU2 | Livebox2-UHD86 | ServiiDroid | ServiiGo | BubbleUPnP
Serviio beta tester - Moderator
PreviousNext

Return to Sony

Who is online

Users browsing this forum: No registered users and 13 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.