Aspect Ratio Problem With 1.50.3 and Sony Bravia

Post Reply
rcglaser
Posts: 1
Joined: Tue May 08, 2012 1:19 am

Re: Aspect Ratio Problem With 1.50.3 and Sony Bravia

Post by rcglaser »

I've faced the same problem as you, and for months had to stick to version 1.14.3. But after a lot of googling and playing around with FFMPEG parameters and WMS' transcoding profiles, I just found how to solve the problem.

First, some explanation on why the "-vf aspect=4:3"stopped working. WMS 1.50.x uses a new version of FFMPEG, and in this new version a lot of parameters and filters have been renamed, and one of them was the "aspect" filter which was renamed to "setdar". But, simply changing the old string to "-vf setdar=4:3" in the transcoding profile doesn't work, as there are other filters set by the profile in the FFMPEG chain that overwrite it.

After reading about similar problems with other FFMPEG based products and analyzing the solutions they've found, I came to the following command that would generate a video my Bravia would render with the correct aspect ratio:

Code: Select all

-probesize 7000000 -analyzeduration 10000000 -i "G:\Videos\movie.avi" -f dvd -vf "scale=1280:-1","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3" -vhook "wmssubt.dll G:\Videos\movie.srt,Arial Narrow,36,0,16777215,0,4,0,0,0,1280,720,23.976,0,0,0,por,0,1,0,14" -vcodec mpeg2video -b:v 25000000 -aspect 4:3 -copyts -pix_fmt yuv420p -threads 2 -acodec ac3 -ab 448000 -ar 48000 -ac 6 -vstreamid 1 -astreamid 2.
From there I created a new transcoding profile (which I named "Movies (Bravia)") and played with it's script until it could generate that command. The resulting PascalScript is the following:

Code: Select all

const
  csFFMpegVideoParams1 = ' -f dvd -vf "scale=1280:-1","pad=1280:720:(ow-iw)/2:(oh-ih)/2:black","setdar=4:3"';
  csFFMpegVideoParams2 = ' -vcodec mpeg2video -b:v 25000000 -aspect 4:3 -copyts -pix_fmt yuv420p';
  csFFMpegAudioParams = ' -acodec ac3 -ab 448000 -ar 48000 -ac 6';

function GetMultiThreadSupported(const aVideoCodec: string): Boolean;
begin
  if SameText(aVideoCodec, 'WMV') then
    Result := False
  else
    Result := True
end;

var
  iAudioStreamNo: Integer;
  sParams, sAudioStreamID: string;
begin
    iAudioStreamNo := mpAudioStreamNo;

    sParams := WmsTranscodingInputParams;
    sParams := sParams + csFFMPegVideoParams1;
    sParams := sParams + WmsTranscodingSubTitleParams(1280, 720, 1280, 720, 0, 0);
    sParams := sParams + csFFMPegVideoParams2;
    if (cfgTranscodingThreadCount > 1) and GetMultiThreadSupported(cfgTranscodingVideoCodec) then
        sParams := sParams + ' -threads ' + IntToStr(cfgTranscodingThreadCount);

    sParams := sParams + csFFMpegAudioParams;
    sParams := sParams + WmsTranscodingMapParams(iAudioStreamNo);

    TranscodingParams := sParams;
end.
The resulting video always has a 1280x720 resolution, which the Bravia TV correctly renders when the DAR is declared as 4:3. One important thing to notice is that this profile will upscale the input video if it has a horizontal resolution with less than 1280 pixels, so it may use more CPU than other profiles. Another important thing to notice is that this profile should only be used with videos with a horizontal resolution less or equal to 1280 pixels and a with vertical resolution less or equal do 720 pixels.

When I have more time I'll try to improve this script/profile. And if anyone has any suggestions, please post them here.

Hope this solution works for you too.

Best regards

Richard
Post Reply