Page 1 of 2
DAR setting

Posted:
Thu Jan 03, 2013 9:08 am
by tombert
Hi,
I am playing with the DAR value because I have an old sony2010 and some files it stretches unnaturally. It seems that DAR woks only for mpeg files but not for mkv ... at least I do not see an effect.
I wonder why 16:9 is the only allowed value? From ffmpeg manual any floating point or x:y ratio should be possible. Any chances that this gets allowed in the profile? Or are there any reasons I am not aware of?
thx
Re: DAR setting

Posted:
Thu Jan 03, 2013 10:02 am
by zip
The only reason is that most TVs are 16:9.
It will only be invoked when you transcode, not when you remux.
Re: DAR setting

Posted:
Thu Jan 03, 2013 2:21 pm
by tombert
Force Video Transcoding is enabled. I think the Problem is more my 2y old Bravia. So I wanted to play with more DAR values.
Re: DAR setting

Posted:
Thu Jan 03, 2013 4:51 pm
by zip
froce video transcoding only means that if the source video codec is the same as the target on it'll still re-encode it, not just copy. You have to set targetVCodec for a file to be trancoded.
Re: DAR setting

Posted:
Thu Jan 03, 2013 5:22 pm
by tombert
I think I did so:
<Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="17000" targetACodec="ac3" aBitrate="192" DAR="16:9" forceInheritance="true" forceVTranscoding="true">
Re: DAR setting

Posted:
Thu Jan 03, 2013 5:25 pm
by zip
so if you check the log it should produce a 16:9 resolution video (with black bars) using the scale filter.
Re: DAR setting

Posted:
Thu Jan 03, 2013 6:18 pm
by tombert
Thats the command line in the log:
- Code:
ffmpeg -threads auto -i /../mnt/raid5/media/Videos/@.Series/My Vids/test.mpeg -y -copyts -c:v mpeg2video -b:v 17000k -maxrate:v 17000k -bufsize:v 17000k -r 25 -g 15 -c:a copy -map 0:0 -map 0:1 -sn -f mpegts /tmp/Serviio/transcoding-temp-3456-sony2010-ORIGINAL.stf
I also checked the stf file - no bars to see.
Also, the input file is already 16:9:
- Code:
Input #0, mpegts, from 'test.mpeg':
Duration: 00:20:49.76, start: 1.400000, bitrate: 3723 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), s16, 448 kb/s
My TV is stretching the movie horizontally - so thats why I thought about applying a different DAR to work around this "bug".
thx
Re: DAR setting

Posted:
Thu Jan 03, 2013 7:53 pm
by tombert
With DAR=16:9 setting:ffmpeg line:
- Code:
ffmpeg -threads auto -i /../mnt/raid5/media/Videos/test.avi -y -copyts -c:v mpeg2video -b:v 17000k -maxrate:v 17000k -bufsize:v 17000k -vf pad=854:480:107:0:black,setdar=4:3 -r 25 -g 15 -c:a ac3 -b:a 192k -ac 2 -map 0:0 -map 0:1 -sn -f mpegts /tmp/Serviio/transcoding-temp-1651-sony2010-ORIGINAL.stf
transcoded file:
- Code:
Input #0, mpegts, from '/tmp/Serviio/transcoding-temp-1651-sony2010-ORIGINAL.stf':
Duration: 00:02:30.04, start: 1.400000, bitrate: 4144 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 854x480 [SAR 320:427 DAR 4:3], 17000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 192 kb/s
Without DAR:ffmpeg line:
- Code:
ffmpeg -threads auto -i /../mnt/raid5/media/Videos/test.avi -y -copyts -c:v mpeg2video -b:v 17000k -maxrate:v 17000k -bufsize:v 17000k -r 25 -g 15 -c:a ac3 -b:a 192k -ac 2 -map 0:0 -map 0:1 -sn -f mpegts /tmp/Serviio/transcoding-temp-1651-sony2010-ORIGINAL.stf
transcoded file:
- Code:
Input #0, mpegts, from '/tmp/Serviio/transcoding-temp-1651-sony2010-ORIGINAL.stf':
Duration: 00:12:57.20, start: 1.400000, bitrate: 3786 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 17000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 192 kb/s
So in real it changes the SAR value, not the DAR ... (is this intended?)
-----------------------------------------------
I got another video with the following parameters:
- Code:
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1072 [SAR 1:1 DAR 120:67]
Which gets transcoded to (DAR=16:9):
- Code:
... -vf pad=1920:1080:0:4:black,setdar=4:3 -r 30000/1001 -g 15 ...
- Code:
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 3:4 DAR 4:3]
The transcoded video gets displayed correctly on my TV.
Another source:
- Code:
Stream #0:1[0x101]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9]
The transcoded file has the same SAR/DAR values.
The file gets horizontally stretched on my TV (bars on top and bottom).
------------------------------------------------
It looks to me that DAR is doing what I was looking for, only that it does not do it for already 16:9 files ...
Any ideas?
thx
Re: DAR setting

Posted:
Thu Jan 03, 2013 9:02 pm
by zip
why would it do it for already 16:9 files?
Re: DAR setting

Posted:
Fri Jan 04, 2013 9:15 am
by tombert
I understood the DAR setting exists because some TVs show a wrong aspect ratio ... and thats how to fix it.
Nevermind ... I think I'll have to find another solution.
thx
Re: DAR setting

Posted:
Fri Jan 04, 2013 11:02 am
by zip
yes, but what this does it just resizes the frame to fit into a 16:9 box.
Re: DAR setting

Posted:
Sun Jan 06, 2013 2:17 pm
by ziggyball
Hi tombert,
Did you find a solution to this?
I have a 2010 Sony and I am still having aspect ratio problems with Serviio v1+
Transcoded 16:9 files are squashed horizontally...
Mkv's of widescreen DVDs are displayed squashed vertically.
Re: DAR setting

Posted:
Sun Jan 06, 2013 4:21 pm
by tombert
Only a workaround:
Go to Settings->Screen there you have a slider called "Vertical Size". This allows to stretch/shrink the picture ... its a bit better but not a final solution.
We have to blame Sony for this though ... my BD Player shows the correct aspect ratio.
Re: DAR setting

Posted:
Sun Jan 13, 2013 5:17 pm
by pdneri
zip wrote:It will only be invoked when you transcode, not when you remux.
What if I want to correct aspect ratio of a remuxed video?
(hopefully without transconding)
Thanks
Davide
Re: DAR setting

Posted:
Mon Jan 14, 2013 12:52 am
by zip
if you can find the ffmpeg command that works for your TV, let me know. For my experiments, mpegts will not store DAR, or some renderers won't read its value.
Re: DAR setting

Posted:
Fri Jan 03, 2014 11:19 am
by pdneri
Hi Zip,
is your last sentence still true now?
I've seen last comment here:
https://trac.ffmpeg.org/ticket/2046which is:
Changed 7 months ago by cehoyos
◾Component changed from undetermined to FFmpeg
◾Resolution set to fixed
◾Status changed from new to closed
The original request was implemented by Nicolas George in b1cc12d
The direct264 patchset looks very interesting nonetheless.
I am particularly interested in solving this issue because I currently need to transcode (instead of remux), due to the 16:9 effect, and this also implies that I cannot pause/rewind/forward while watching.

Re: DAR setting

Posted:
Tue Jan 21, 2014 5:32 pm
by zip
In their example they are remuxing to mp4, not mpegts (which it looks like doesn't store the dar in the container level).
You could try to run the ffmpeg command manually using the latest ffmpeg, and then add to Serviio to be played natively, to see if it makes any difference for you.
Re: DAR setting

Posted:
Tue Jan 21, 2014 5:58 pm
by Iveky
is it possible to add something like this:
(this is how I converted some 4:3 films to 16:9)
ffmpeg -i film.avi -vcodec libx264 -strict -2 -q 20 -vf "scale=1024:576,setdar=16:9" -aspect 16:9 output1024.mp4
important part is: -vf "scale=1024:576,setdar=16:9"
by adding scale as option from serviio, we could solve all 16:9 problems that can appear.
or will you add it in future?
Re: DAR setting

Posted:
Wed Jan 22, 2014 1:03 pm
by zip
scale is already in place, but using different values. you can see that when using the DAR transcoding option (but that is not for remuxing)
Re: DAR setting

Posted:
Wed Jan 22, 2014 2:25 pm
by Iveky
i searched throu profiles, none use width x height, only maxheight is implemented?
i think, forcing ffmpeg to transcode into specific WxH, we cant set it through profile?
Sent from my LG-E440 using Tapatalk 2