From d2fc1534c885a55f669fa16fa7f1d96dfa15df28 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 30 Oct 2013 10:30:49 +0100 Subject: encoding-example-profiles: support HP Slate 7's weird aspect. Also, replace broken noup= by lavfi expressions. --- etc/encoding-example-profiles.conf | 42 +++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/etc/encoding-example-profiles.conf b/etc/encoding-example-profiles.conf index c232bb8f25..3ab38e2d12 100644 --- a/etc/encoding-example-profiles.conf +++ b/etc/encoding-example-profiles.conf @@ -68,6 +68,7 @@ ovcopts = qscale=4 profile-desc = "H.264 (x264)" ovc = libx264 ovcopts = preset=medium,crf=23,threads=0 +vf-add = noformat=444p,noformat=444p9,noformat=444p10,noformat=422p,noformat=422p9,noformat=422p10 [enc-v-mpeg2] profile-desc = "MPEG-2 Video (FFmpeg)" @@ -152,15 +153,14 @@ profile-desc = "MP4 for Blackberry Bold 9000" profile = enc-f-mp4 vf-add = dsize=480:360:0:2,scale=w=0:h=0,dsize=-1:-1 # native screen res, letterbox ovcopts-add = maxrate=1500k,bufsize=1000k,rc_init_occupancy=900k,refs=1,profile=baseline -vf-add=noformat=444p,noformat=444p9,noformat=444p10,noformat=422p,noformat=422p9,noformat=422p10 omaxfps = 30 [enc-to-nok-n900] profile-desc = "MP4 for Nokia N900" profile = enc-f-mp4 -vf-add = dsize=800:480:0:2,scale=w=0:h=0:noup=1 # native screen res, letterbox +# DW = 800, DH = 480, SAR = 1 +vf-add = lavfi=graph="scale=floor(min(min(800\,dar*480)\,in_w*max(1\,sar))/2+0.5)*2:floor(min(min(800/dar\,480)\,in_h*max(1/sar\,1))/2+0.5)*2,setsar=1" ovcopts-add = profile=baseline,level=30,maxrate=10000k,bufsize=10000k,rc_init_occupancy=9000k,refs=5 -vf-add=noformat=444p,noformat=444p9,noformat=444p10,noformat=422p,noformat=422p9,noformat=422p10 omaxfps = 30 [enc-to-nok-6300] @@ -180,14 +180,12 @@ vf-add = scale=w=480:h=272,dsize=480:270 srate = 48000 channels = 2 ovcopts-add = b=512k,profile=baseline -vf-add=noformat=444p,noformat=444p9,noformat=444p10,noformat=422p,noformat=422p9,noformat=422p10 [enc-to-iphone-noscale] profile-desc = "MP4 for iPhone (no scaling)" profile = enc-f-mp4 oautofps = yes # iphone supports 30fps max ovcopts-add = maxrate=2500k,bufsize=1000k,rc_init_occupancy=900k,level=30,profile=baseline -vf-add=noformat=444p,noformat=444p9,noformat=444p10,noformat=422p,noformat=422p9,noformat=422p10 omaxfps = 30 [enc-to-iphone] @@ -207,3 +205,37 @@ profile-desc = "MP4 for iPhone 5 (1136x640)" profile = enc-to-iphone-noscale vf-add = dsize=1136:480:1:2,scale=w=0:h=0,dsize=-1:-1 # panscan omaxfps = 30 + +[enc-to-hp-slate-7] +profile-desc = "MP4 for HP Slate 7 (1024x600, crazy aspect)" +profile = enc-f-mp4 +omaxfps = 30 +ovcopts-add = profile=high +# DW = 1024, DH = 600, DAR = 97:54 (=> SAR = 2425:2304) +vf-add = lavfi=graph="scale=2*floor(0.5+0.5*min(1024*min(1\,dar*54/97)\,in_w*max(1\,sar*2304/2425))):2*floor(0.5+0.5*min(600*min(97/54/dar\,1)\,in_h*max(2425/2304/sar\,1))),setsar=1" + +# Advanced scaling for specific output devices - how it works: +# DW = display width (px) (1024) +# DH = display height (px) (600) +# SAR = display sample aspect ratio, i.e. DAR * DH / DW (2425:2304) +# DAR = display aspect ratio, i.e. SAR * DW / DH (97:54) +# Variant: zoomed out +# vf-add = lavfi=graph="scale=floor(min(DW*min(1\,dar/DAR)\,in_w*max(1\,sar/SAR))/2+0.5)*2:floor(min(DH*min(DAR/dar\,1)\,in_h*max(SAR/sar\,1))/2+0.5)*2,setsar=1" +# Variant: zoomed in +# vf-add = lavfi=graph="scale=floor(min(DW*max(1\,dar/DAR)\,in_w*max(1\,sar/SAR))/2+0.5)*2:floor(min(DH*max(DAR/dar\,1)\,in_h*max(SAR/sar\,1))/2+0.5)*2,setsar=1" +# How it works: +# 1a: DW, DH*dar/DAR - fit to display width +# 1b: DH*DAR/dar, DH - fit to display height +# 1: the min of 1a and 1b these (i.e. fit inside both width and height); for zoomed in view, use the max +# 2a: in_w, in_h*SAR/sar - fit to original width +# 2b: in_w*sar/SAR, in_h - fit to original height +# 2: the max of 2a and 2b (i.e. avoid enlarging both dimensions - let HW scaling handle this) +# output: the min of 1 and 2 (i.e. fulfill both constraints) +# setsar=1 to prevent scaling on the device (skip this if the device actually wants the proper sar to be specified for not performing needless scaling) +# +# Simplified special case for SAR == 1, DAR == DW/DH: +# Variant: zoomed out +# vf-add = lavfi=graph="scale=floor(min(min(DW\,dar*DH)\,in_w*max(1\,sar))/2+0.5)*2:floor(min(min(DW/dar\,DH)\,in_h*max(1/sar\,1))/2+0.5)*2,setsar=1" +# Variant: zoomed in +# vf-add = lavfi=graph="scale=floor(min(max(DW\,dar*DH)\,in_w*max(1\,sar))/2+0.5)*2:floor(min(max(DW/dar\,DH)\,in_h*max(1/sar\,1))/2+0.5)*2,setsar=1" +# setsar=1 to prevent nasty almost-1 sar to be passed to the codec due to the rounding which can fail -- cgit v1.2.3