2012-09-14 15:51:26 +00:00
#
2012-10-11 00:04:08 +00:00
# mpv configuration file
2012-09-14 15:51:26 +00:00
#
#########################
# encoding profile file #
#########################
#
# Usage of this file: copy/symlink it to a fixed location, and add
# include = /path/to/this/encoding-example-profiles.conf
2012-10-11 00:04:08 +00:00
# to your ~/.mpv/config
2012-09-14 15:51:26 +00:00
#
# Then, list all profiles by
2012-10-11 00:04:08 +00:00
# mpv -profile help | grep enc-
2012-09-14 15:51:26 +00:00
#
# The following kinds of encoding profiles exist:
# enc-a-*: initialize an audio codec including good defaults
# enc-v-*: initialize a video codec including good defaults
# enc-f-*: initialize a file format including good defaults, including
# selecting and initializing a good audio and video codec
# enc-to-*: load known good settings for a target device; this typically
# includes selecting an enc-f-* profile, then adjusting some
# settings like frame rate, resolution and codec parameters
#
# AFTER including a profile of these, you can of course still change
# options, or even switch to another codec.
#
# You can view the exact options a profile sets by
2012-10-11 00:04:08 +00:00
# mpv -show-profile enc-to-bb-9000
2012-09-14 15:51:26 +00:00
#
# Examples:
2012-10-11 00:04:08 +00:00
# mpv -profile enc-to-dvdpal -o outfile.mpg infile.mkv
# mpv -profile enc-f-avi -ofps 30 -o outfile.avi infile.mkv
2012-11-15 14:42:06 +00:00
# mpv -profile enc-v-mpeg4 -ovcopts-add qscale=7 -profile enc-a-mp3 -oacopts-add b=320k -o outfile.avi infile.mkv
2012-09-14 15:51:26 +00:00
################
# audio codecs #
################
[enc-a-aac]
profile-desc = "AAC (libfaac or FFmpeg)"
2012-10-12 04:31:50 +00:00
oac = libfdk_aac,libfaac,libvo_aacenc,aac
2012-12-01 16:16:51 +00:00
oacopts = b=96k
2012-09-14 15:51:26 +00:00
[enc-a-ac3]
profile-desc = "AC3 (FFmpeg)"
oac = ac3
oacopts = b=448k
[enc-a-mp3]
profile-desc = "MP3 (LAME)"
oac = libmp3lame
oacopts = b=128k
[enc-a-vorbis]
profile-desc = "Vorbis (libvorbis)"
2013-03-31 17:13:06 +00:00
oac = libvorbis,vorbis
2012-11-15 14:42:06 +00:00
oacopts = qscale=3
2012-09-14 15:51:26 +00:00
################
# video codecs #
################
[enc-v-h263]
profile-desc = "H.263 (FFmpeg)"
ovc = h263
2012-11-15 14:42:06 +00:00
ovcopts = qscale=4
2012-09-14 15:51:26 +00:00
[enc-v-h264]
profile-desc = "H.264 (x264)"
ovc = libx264
ovcopts = preset=medium,crf=23,threads=0
2013-10-30 09:30:49 +00:00
vf-add = noformat=444p,noformat=444p9,noformat=444p10,noformat=422p,noformat=422p9,noformat=422p10
2012-09-14 15:51:26 +00:00
[enc-v-mpeg2]
profile-desc = "MPEG-2 Video (FFmpeg)"
ovc = mpeg2video
ovcopts-clr = yes
[enc-v-mpeg4]
profile-desc = "MPEG-4 Part 2 (FFmpeg)"
ovc = mpeg4
2012-11-15 14:42:06 +00:00
ovcopts = qscale=4
2012-09-14 15:51:26 +00:00
[enc-v-vp8]
profile-desc = "VP8 (libvpx)"
2012-12-28 10:21:35 +00:00
ovc = libvpx
ovcopts = qmin=4,b=10000000k # ought to be enough for anyone; for CBR use, set b=; for VBR use, set qmin= to quality
2012-09-14 15:51:26 +00:00
###########
# formats #
###########
[enc-f-3gp]
profile-desc = "H.263 + AAC (for 3GP)"
of = 3gp
ocopyts = yes
profile = enc-v-h263
profile = enc-a-aac
ofopts-clr = yes
[enc-f-avi]
profile-desc = "MPEG-4 + MP3 (for AVI)"
of = avi
ocopyts = no
oautofps = yes
profile = enc-v-mpeg4
profile = enc-a-mp3
ofopts-clr = yes
[enc-f-mp4]
profile-desc = "H.264 + AAC (for MP4)"
of = mp4
ocopyts = yes
profile = enc-v-h264
profile = enc-a-aac
ofopts-clr = yes
[enc-f-webm]
profile-desc = "VP8 + Vorbis (for WebM)"
of = webm
ocopyts = yes
profile = enc-v-vp8
profile = enc-a-vorbis
ofopts-clr = yes
##################
# target devices #
##################
[enc-to-dvdpal]
2012-09-29 13:04:40 +00:00
profile-desc = "DVD-Video PAL, use dvdauthor -v pal -a ac3+en (MUST be used with 4:3 or 16:9 aspect, and 720x576, 704x576, 352x576 or 352x288 resolution)"
2012-09-14 15:51:26 +00:00
profile = enc-v-mpeg2
profile = enc-a-ac3
of = dvd
ofopts-add = packetsize=2048,muxrate=10080000
ofps = 25
oharddup = yes
2012-09-29 13:04:40 +00:00
ovfirst = yes # dvdauthor needs this
2012-09-14 15:51:26 +00:00
srate = 48000
ovcopts-add = g=15,b=6000000,maxrate=9000000,minrate=0,bufsize=1835008
[enc-to-dvdntsc]
2012-09-29 13:04:40 +00:00
profile-desc = "DVD-Video NTSC, use dvdauthor -v ntsc -a ac3+en (MUST be used with 4:3 or 16:9 aspect, and 720x480, 704x480, 352x480 or 352x240 resolution)"
2012-09-14 15:51:26 +00:00
profile = enc-v-mpeg2
profile = enc-a-ac3
of = dvd
ofopts-add = packetsize=2048,muxrate=10080000
ofps = 24000/1001
oharddup = yes
2012-09-29 13:04:40 +00:00
ovfirst = yes # dvdauthor needs this
2012-09-14 15:51:26 +00:00
srate = 48000
ovcopts-add = g=18,b=6000000,maxrate=9000000,minrate=0,bufsize=1835008
[enc-to-bb-9000]
profile-desc = "MP4 for Blackberry Bold 9000"
profile = enc-f-mp4
2012-12-01 18:50:15 +00:00
vf-add = dsize=480:360:0:2,scale=w=0:h=0,dsize=-1:-1 # native screen res, letterbox
2012-09-14 15:51:26 +00:00
ovcopts-add = maxrate=1500k,bufsize=1000k,rc_init_occupancy=900k,refs=1,profile=baseline
2013-06-09 13:37:28 +00:00
omaxfps = 30
2012-09-14 15:51:26 +00:00
2013-03-04 11:14:59 +00:00
[enc-to-nok-n900]
profile-desc = "MP4 for Nokia N900"
profile = enc-f-mp4
2013-10-30 09:30:49 +00:00
# DW = 800, DH = 480, SAR = 1
2013-11-07 16:54:16 +00:00
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=sar=1"
2013-03-20 15:01:04 +00:00
ovcopts-add = profile=baseline,level=30,maxrate=10000k,bufsize=10000k,rc_init_occupancy=9000k,refs=5
2013-06-09 13:37:28 +00:00
omaxfps = 30
2013-03-04 11:14:59 +00:00
2012-09-14 15:51:26 +00:00
[enc-to-nok-6300]
profile-desc = "3GP for Nokia 6300"
profile = enc-f-3gp
ofps = 25
2012-09-24 14:06:21 +00:00
vf-add = scale=w=176:h=144
2012-09-14 15:51:26 +00:00
srate = 16000
channels = 1
oacopts-add = b=32k
[enc-to-psp]
profile-desc = "MP4 for PlayStation Portable"
profile = enc-f-mp4
ofps = 30000/1001
2012-12-01 18:50:15 +00:00
vf-add = scale=w=480:h=272,dsize=480:270
2012-09-14 15:51:26 +00:00
srate = 48000
channels = 2
ovcopts-add = b=512k,profile=baseline
2013-01-10 10:56:04 +00:00
[enc-to-iphone-noscale]
profile-desc = "MP4 for iPhone (no scaling)"
2012-09-14 15:51:26 +00:00
profile = enc-f-mp4
oautofps = yes # iphone supports 30fps max
ovcopts-add = maxrate=2500k,bufsize=1000k,rc_init_occupancy=900k,level=30,profile=baseline
2013-06-09 13:37:28 +00:00
omaxfps = 30
2012-09-14 15:51:26 +00:00
2013-01-10 10:56:04 +00:00
[enc-to-iphone]
profile-desc = "MP4 for iPhone (480x320)"
2013-01-18 12:58:31 +00:00
profile = enc-to-iphone-noscale
2013-01-10 10:56:04 +00:00
vf-add = dsize=480:320:1:2,scale=w=0:h=0,dsize=-1:-1 # panscan
2013-06-09 13:37:28 +00:00
omaxfps = 30
2013-01-10 10:56:04 +00:00
2012-09-14 15:51:26 +00:00
[enc-to-iphone-4]
profile-desc = "MP4 for iPhone 4 (960x640)"
2013-01-18 12:58:31 +00:00
profile = enc-to-iphone-noscale
2013-01-10 10:56:04 +00:00
vf-add = dsize=960:480:1:2,scale=w=0:h=0,dsize=-1:-1 # panscan
2013-06-09 13:37:28 +00:00
omaxfps = 30
2012-12-01 18:50:15 +00:00
[enc-to-iphone-5]
profile-desc = "MP4 for iPhone 5 (1136x640)"
2013-01-18 12:58:31 +00:00
profile = enc-to-iphone-noscale
2013-01-10 10:56:04 +00:00
vf-add = dsize=1136:480:1:2,scale=w=0:h=0,dsize=-1:-1 # panscan
2013-06-09 13:37:28 +00:00
omaxfps = 30
2013-10-30 09:30:49 +00:00
[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)
2013-11-07 16:54:16 +00:00
vf-add = lavfi=graph="scale=floor(min(1024*min(1\,dar/(97/54))\,in_w*max(1\,sar/(2425/2304)))/2+0.5)*2:floor(min(600*min((97/54)/dar\,1)\,in_h*max((2425/2304)/sar\,1))/2+0.5)*2,setsar=sar=1"
[enc-to-hp-slate-7-git]
profile-desc = "MP4 for HP Slate 7 (1024x600, crazy aspect), FFmpeg-git"
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=floor(min(1024*min(1\,dar/(97/54))\,in_w)/2+0.5)*2:floor(min(600*min((97/54)/dar\,1)\,in_h)/2+0.5)*2,setsar=sar=sar/(2425/2304)"
2013-10-30 09:30:49 +00:00
# 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
2013-11-07 16:54:16 +00:00
# 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=sar=1"
2013-10-30 09:30:49 +00:00
# Variant: zoomed in
2013-11-07 16:54:16 +00:00
# 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=sar=1"
2013-10-30 09:30:49 +00:00
# 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)
2013-11-07 16:54:16 +00:00
# setsar=sar=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)
2013-10-30 09:30:49 +00:00
#
# Simplified special case for SAR == 1, DAR == DW/DH:
# Variant: zoomed out
2013-11-07 16:54:16 +00:00
# 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=sar=1"
2013-10-30 09:30:49 +00:00
# Variant: zoomed in
2013-11-07 16:54:16 +00:00
# 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=sar=1"
# setsar=sar=1 to prevent nasty almost-1 SAR to be passed to the codec due to the rounding which can fail
2013-10-31 04:30:17 +00:00
#
# If the device supports file SAR properly, we can make use of it to avoid
2013-11-07 16:54:16 +00:00
# upscaling. The setsar=sar=sar/SAR at the end serves to fake the SAR for devices that don't know their own display's SAR.
2013-10-31 04:30:17 +00:00
# Variant: zoomed out
2013-11-07 16:54:16 +00:00
# vf-add = lavfi=graph="scale=floor(min(DW*min(1\,dar/DAR)\,in_w)/2+0.5)*2:floor(min(DH*min(DAR/dar\,1)\,in_h)/2+0.5)*2,setsar=sar=sar/SAR"
2013-10-31 04:30:17 +00:00
# Variant: zoomed in
2013-11-07 16:54:16 +00:00
# vf-add = lavfi=graph="scale=floor(min(DW*max(1\,dar/DAR)\,in_w)/2+0.5)*2:floor(min(DH*max(DAR/dar\,1)\,in_h)/2+0.5)*2,setsar=sar=sar/SAR"
2013-10-31 04:30:17 +00:00
# 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)/2+0.5)*2:floor(min(min(DW/dar\,DH)\,in_h)/2+0.5)*2"
# Variant: zoomed in
# vf-add = lavfi=graph="scale=floor(min(max(DW\,dar*DH)\,in_w)/2+0.5)*2:floor(min(max(DW/dar\,DH)\,in_h)/2+0.5)*2"