Advanced aspect ratio conrtol
Hi,
with my new LG TV set I was searching for a proper video server. I ended up using Serviio and I am very happy with it.
Sorrowly LG's WebOS 3 is very picky about aspect ratio. Most of my videos are not NTSC/PAL standard or square pixel which is usually no problem if PAR and DAR are handled correctly. But if you don't meet NTSC/PAL standard WebOS will use PAR 1:1 and DAR 1:1 independant of the videos meta data.
To fix the problem I tested around with the DAR="16:9" option in the profiles which will end up in with a nicely 16:9 padded video forced to DAR 4:3. That is actually not the result expected but exactly what I found in the ffmpeg command in the log file.
Since DAR="16:9" is the only aspect ratio function I started to test around ffmpeg directly to transcode an arbitrary file to a DAR 16:9 square pixel output. To do so, I used two steps. First change to square pixel and second pad it to 16:9. Both work independantly of course. Regarding ffmpeg filter options it looks like:
or for the complete command line:
In addition I tested around with autocrop since some old files still need it. With Linux it can be done inline with a command line like this (for windows I am not sure how it could look like):
I wonder if it could be an option to implement those filter commands for serviio's profiles in one of the next version. Something like AutoCrop="true" and SquarePixel="true" without any options and PAD="X/Y" with X and Y as options - could be great to be more flexible e.g. for my 21:9 PC Monitor. In the pad filter line simply change all 16/9 to any X/Y given. Of course all filter parts are safe regarding container and codec multipliers.
I am interested in any comments.
with my new LG TV set I was searching for a proper video server. I ended up using Serviio and I am very happy with it.
Sorrowly LG's WebOS 3 is very picky about aspect ratio. Most of my videos are not NTSC/PAL standard or square pixel which is usually no problem if PAR and DAR are handled correctly. But if you don't meet NTSC/PAL standard WebOS will use PAR 1:1 and DAR 1:1 independant of the videos meta data.
To fix the problem I tested around with the DAR="16:9" option in the profiles which will end up in with a nicely 16:9 padded video forced to DAR 4:3. That is actually not the result expected but exactly what I found in the ffmpeg command in the log file.
Since DAR="16:9" is the only aspect ratio function I started to test around ffmpeg directly to transcode an arbitrary file to a DAR 16:9 square pixel output. To do so, I used two steps. First change to square pixel and second pad it to 16:9. Both work independantly of course. Regarding ffmpeg filter options it looks like:
or for the complete command line:
- Code:
ffmpeg -i SOURCE.mp4 -vf scale="trunc(iw/hsub)*hsub:trunc(ih/vsub)*vsub",scale="trunc(iw*sar/(1/1)/hsub)*hsub:trunc(ih/vsub)*vsub",setsar="1/1",pad="trunc(if(lt(dar\,16/9)\,ih*16/9/sar\,iw)/hsub)*hsub:trunc(if(lt(dar\,16/9)\,ih\,iw/(16/9)*sar)/vsub)*vsub:(ow-iw)/2\:(oh-ih)/2:black",setdar="16/9" test.mp4
In addition I tested around with autocrop since some old files still need it. With Linux it can be done inline with a command line like this (for windows I am not sure how it could look like):
I wonder if it could be an option to implement those filter commands for serviio's profiles in one of the next version. Something like AutoCrop="true" and SquarePixel="true" without any options and PAD="X/Y" with X and Y as options - could be great to be more flexible e.g. for my 21:9 PC Monitor. In the pad filter line simply change all 16/9 to any X/Y given. Of course all filter parts are safe regarding container and codec multipliers.
I am interested in any comments.