FAQ  •  Register  •  Login

[SOLVED] Sony Bravia - Aspect Ratio fixing

<<

zip

User avatar

Serviio developer / Site Admin

Posts: 16805

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: 4649

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: 4649

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: 16805

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: 4649

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: 1418

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: 4649

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: 4649

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
<<

Xmantium

User avatar

DLNA master

Posts: 1418

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Tue Jan 17, 2012 4:14 pm

Re: Sony Bravia - Aspect Ratio fixing

Thanks for this, will try it tonight.

Is there a Linux method?
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: 4649

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Tue Jan 17, 2012 7:43 pm

Re: Sony Bravia - Aspect Ratio fixing

Xmantium wrote:Is there a Linux method?

Yes probably, you have to install a "perl" package, then change the path of "c:\perl\bin". Perl script should be the same. I think.
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: 1418

Joined: Sat Jul 23, 2011 2:12 pm

Location: Manchester, UK

Post Wed Jan 18, 2012 12:27 pm

Re: Sony Bravia - Aspect Ratio fixing

This fix should be built in Serviio!
Like a custom bravia profile

I don't think Sony Bravia will fix it themselves on their tvs.
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: 4649

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Wed Jan 18, 2012 12:35 pm

Re: Sony Bravia - Aspect Ratio fixing

Xmantium wrote:I don't think Sony Bravia will fix it themselves on their tvs.

Don't think so too.
Xmantium wrote:This fix should be built in Serviio!
Like a custom bravia profile

Thanks,
This tips is interesting to customize ffmpeg options for testing purpose without need of serviio recompile (I do not know how to do this :D )
But its not perfect, you will probably have some issues (process not killed, online feeds, etc ).

But you are welcome to test on your side with different file resolutions (DAR, PAR,etc)

And hopefully in future version, Zip could include these ffmpeg options for Bravia TVs.
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
<<

koan00

Streaming enthusiast

Posts: 38

Joined: Mon Feb 20, 2012 7:25 pm

Post Tue Feb 28, 2012 2:47 pm

Re: Sony Bravia - Aspect Ratio fixing

My Sony KDL55NX720 has this issue too. Same video plays fine on my Samsung LN55C630.

Is there any word on serviio fixing this? (bug submitted, etc?)

Has anyone else tried the perl method mentioned here with success? I'll try the perl hack this weekend if I get some time.
<<

armthehomeless

Serviio newbie

Posts: 2

Joined: Wed Mar 07, 2012 10:23 am

Post Wed Mar 07, 2012 10:27 am

Re: Sony Bravia - Aspect Ratio fixing

I'm also keen to know if there's any update to this. I tried the Perl method and got a 'Cannot access server at this time' message.

This is a great media server! Loving it apart from the stupid Bravia AR issue. I wish they'd just fix it in a firmware update.
<<

Illico

User avatar

DLNA master

Posts: 4649

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Thu Mar 29, 2012 6:40 pm

Re: Sony Bravia - Aspect Ratio fixing

armthehomeless wrote:I'm also keen to know if there's any update to this. I tried the Perl method and got a 'Cannot access server at this time' message.

This is a great media server! Loving it apart from the stupid Bravia AR issue. I wish they'd just fix it in a firmware update.


Could you check the detailed logging file ?
Could you check that the ffmpeg path on the Perl script is good?
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
<<

augustf

Serviio newbie

Posts: 15

Joined: Fri Jul 27, 2012 11:22 pm

Post Sun Jul 29, 2012 12:45 am

Re: Sony Bravia - Aspect Ratio fixing

To address this issue on the transcoded AVI's on my server, I adapted the Perl script Illico so kindly provided for my Ubuntu 12.04 box:

  Code:
#!/usr/bin/perl
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 = "/usr/bin/ffmpeg-serviio $args";

open(LOGFILE, ">>/var/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);
}


I renamed my compiled ffmpeg to ffmpeg-serviio and named the Perl script /usr/bin/ffmpeg. Perhaps I misunderstood how this would work, but it didn't seem to have any effect on the files I have when played on my Sony KDL-46NX720, such as this one:
  Code:
ffmpeg version N-42368-gbf53863 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 26 2012 19:36:00 with gcc 4.6.3
  configuration: --enable-static --disable-shared --bindir=/tmp/ffmpeg --disable-ffplay --disable-ffserver --enable-pthreads --disable-mmx --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-librtmp --pkg-config=pkg-config
  libavutil      51. 64.100 / 51. 64.100
  libavcodec     54. 33.100 / 54. 33.100
  libavformat    54. 15.102 / 54. 15.102
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  1.100 /  3.  1.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'Penn & Teller; Bullshit! - (1-01) - Talking to the Dead.avi':
  Metadata:
    encoder         : Nandub v1.0rc2
  Duration: 00:26:05.79, start: 0.000000, bitrate: 1246 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 576x432 [SAR 1:1 DAR 4:3], 29.97 tbr, 29.97 tbn, 29.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16, 112 kb/s


I also tested this same video on my Sony BDP-S580, and that worked exactly correctly, which I expected as the format is natively supported there.
<<

Illico

User avatar

DLNA master

Posts: 4649

Joined: Fri Jul 23, 2010 8:08 am

Location: France

Post Sun Jul 29, 2012 7:33 am

Re: Sony Bravia - Aspect Ratio fixing

With the latest Serviio 1.0 this issue was solved.
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
<<

augustf

Serviio newbie

Posts: 15

Joined: Fri Jul 27, 2012 11:22 pm

Post Sun Jul 29, 2012 4:05 pm

Re: Sony Bravia - Aspect Ratio fixing

It may be that I'm misunderstanding the issue (i.e. there's some other issue causing this for my videos), but I'm currently using Serviio 1.0 and encountering the issue above. I noticed that in the changelog, "added possibility to force display aspect ratio during transcoding; ticket #179" is mentioned. Has this ability to force the aspect ratio been implemented in the Sony 2010 profile? Is there any other reason this issue might arise? As always, I'm happy to provide any needed output.
PreviousNext

Return to Sony

Who is online

Users browsing this forum: No registered users and 1 guest

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