<renderencoding version="0.1">


    <!-- quality qroups are groups of quality options presented with an encoding option -->
    <!-- addargs="arg1=val1 arg2=va2"(space separated list) -->
    <!-- replvalues="replexp1 replval1;replexp2 replval2" (; separated list) -->
    <!-- @#@# is encoding = e.g. 'format@#@#nv12,hwupload' turns to 'format=nv12,hwupload' -->



    <qualityqroup id="qgroup1" defaultindex="10">
        <quality name="200 kb/s" replvalues="%BITRATE% 200k" />
        <quality name="400 kb/s" replvalues="%BITRATE% 400k" />
        <quality name="600 kb/s" replvalues="%BITRATE% 600k" />
        <quality name="800 kb/s" replvalues="%BITRATE% 800k" />
        <quality name="1000 kb/s" replvalues="%BITRATE% 1000k" />
        <quality name="2000 kb/s" replvalues="%BITRATE% 2000k" />
        <quality name="3000 kb/s" replvalues="%BITRATE% 3000k" />
        <quality name="4000 kb/s" replvalues="%BITRATE% 4000k" />
        <quality name="5000 kb/s" replvalues="%BITRATE% 5000k" />
        <quality name="6000 kb/s" replvalues="%BITRATE% 6000k" />
        <quality name="8000 kb/s" replvalues="%BITRATE% 8000k" />
        <quality name="10000 kb/s" replvalues="%BITRATE% 10000k" />
        <quality name="12000 kb/s" replvalues="%BITRATE% 12000k" />
        <quality name="18000 kb/s" replvalues="%BITRATE% 18000k" />
        <quality name="20000 kb/s" replvalues="%BITRATE% 20000k" />
        <quality name="25000 kb/s" replvalues="%BITRATE% 25000k" />
    </qualityqroup>
    <qualityqroup id="qgroup2" defaultindex="10">
        <quality name="200 kb/s" replvalues="%BITRATE% 200k" />
        <quality name="400 kb/s" replvalues="%BITRATE% 400k" />
        <quality name="600 kb/s" replvalues="%BITRATE% 600k" />
        <quality name="800 kb/s" replvalues="%BITRATE% 800k" />
        <quality name="1000 kb/s" replvalues="%BITRATE% 1000k" />
        <quality name="2000 kb/s" replvalues="%BITRATE% 2000k" />
        <quality name="3000 kb/s" replvalues="%BITRATE% 3000k" />
        <quality name="4000 kb/s" replvalues="%BITRATE% 4000k" />
        <quality name="5000 kb/s" replvalues="%BITRATE% 5000k" />
        <quality name="6000 kb/s" replvalues="%BITRATE% 6000k" />
        <quality name="8000 kb/s" replvalues="%BITRATE% 8000k" />
        <quality name="10000 kb/s" replvalues="%BITRATE% 10000k" />
        <quality name="12000 kb/s" replvalues="%BITRATE% 12000k" />
        <quality name="18000 kb/s" replvalues="%BITRATE% 18000k" />
        <quality name="20000 kb/s" replvalues="%BITRATE% 20000k" />
        <quality name="25000 kb/s" replvalues="%BITRATE% 25000k" />
        <quality name="35000 kb/s" replvalues="%BITRATE% 35000k" />
        <quality name="50000 kb/s" replvalues="%BITRATE% 50000k" />
        <quality name="60000 kb/s" replvalues="%BITRATE% 60000k" />
        <quality name="70000 kb/s" replvalues="%BITRATE% 70000k" />
        <quality name="80000 kb/s" replvalues="%BITRATE% 80000k" />
    </qualityqroup>
    <qualityqroup id="qgroup3" defaultindex="2">
        <quality name="4M b/s" replvalues="%BITRATE% 4M" />
        <quality name="6M b/s" replvalues="%BITRATE% 6M" />
        <quality name="8M b/s" replvalues="%BITRATE% 8M" />
        <quality name="10M b/s" replvalues="%BITRATE% 10M" />
        <quality name="20M b/s" replvalues="%BITRATE% 20M" />
        <quality name="40M b/s" replvalues="%BITRATE% 40M" />
        <quality name="60M b/s" replvalues="%BITRATE% 60M" />
        <quality name="90M b/s" replvalues="%BITRATE% 90M" />
        <quality name="120M b/s" replvalues="%BITRATE% 120M" />
        <quality name="150M b/s" replvalues="%BITRATE% 150M" />
        <quality name="180M b/s" replvalues="%BITRATE% 180M" />
        <quality name="220M b/s" replvalues="%BITRATE% 220M" />
    </qualityqroup>
    <qualityqroup id="proxyqgroup" defaultindex="1">
        <quality name="400 kb/s" replvalues="%BITRATE% 400k" />
        <quality name="600 kb/s" replvalues="%BITRATE% 600k" />
        <quality name="800 kb/s" replvalues="%BITRATE% 800k" />
        <quality name="1000 kb/s" replvalues="%BITRATE% 1000k" />
        <quality name="2000 kb/s" replvalues="%BITRATE% 2000k" />
    </qualityqroup>    
    <qualityqroup id="lossless">
        <quality name="lossless"/>
    </qualityqroup>
    <qualityqroup id="variable">
        <quality name="variable 1 pass"/>
        <quality name="variable 2 pass" addargs="pass=2"/>
    </qualityqroup>
    <qualityqroup id="variablenooption">
        <quality name="variable 1 pass"/>
    </qualityqroup>
    <qualityqroup id="prores422" defaultindex="2">
        <quality name="Proxy" replvalues="%PROFILE% 0" />
        <quality name="LT" replvalues="%PROFILE% 1" />
        <quality name="Normal" replvalues="%PROFILE% 2" />
        <quality name="HQ" replvalues="%PROFILE% 3" />
    </qualityqroup>
    <qualityqroup id="prores4444" defaultindex="0">
        <quality name="Normal" replvalues="%PROFILE% 4" />
        <quality name="XQ" replvalues="%PROFILE% 5" />
    </qualityqroup>
    <qualityqroup id="not_settable">
        <quality name="not settable"/>
    </qualityqroup>

    <!-- User editable encodings -->
    <!-- encoding options group together codecs, file formats and quality option groups -->

    <!-- H.264 --> 
    <encodingoption name="H.264 / .mp4" extension="mp4" presetgroup="H.264, HEVC" audiodesc=" mp3" type="av" resize="True" qgroup="qgroup2">
        <profile args="f=mp4 s=%SCREENSIZE% hq=1 acodec=libmp3lame ab=320k ac=2 pix_fmt=yuv420p vcodec=libx264 minrate=0 b=%BITRATE% b_strategy=1 subcmp=2 cmp=2 coder=1 flags=+loop qmax=51 subq=7 qmin=10 qcomp=0.6 qdiff=4 trellis=1 aspect=%ASPECT%"/>
    </encodingoption>
    <encodingoption name="H.264 Baseline Profile / .mp4" extension="mp4" presetgroup="H.264, HEVC" audiodesc=" aac" type="av" resize="True" qgroup="not_settable">
        <profile args="f=mp4 acodec=aac ab=256k vcodec=libx264 threads=0 vpre=medium preset=medium vprofile=baseline coder=0 bf=0 flags2=-wpred-dct8x8 wpredp=0 movflags=+faststart"/>
    </encodingoption>
    <encodingoption name="H.264 Main Profile / .mp4" extension="mp4" presetgroup="H.264, HEVC" audiodesc=" aac" type="av" resize="True" qgroup="not_settable">
        <profile args="f=mp4 acodec=aac ab=256k vcodec=libx264 threads=0 vpre=medium preset=medium vprofile=main flags2=-dct8x8 movflags=+faststart"/>
    </encodingoption>
    <encodingoption name="H.264 High Profile / .mp4" extension="mp4" presetgroup="H.264, HEVC" audiodesc=" aac" type="av" resize="True" qgroup="not_settable">
        <profile args="f=mp4 acodec=aac ab=256k vcodec=libx264 threads=0 vpre=medium preset=medium vprofile=high flags2=-dct8x8 movflags=+faststart"/>
    </encodingoption>
    <encodingoption name="HEVC Main Profile / .mp4" extension="mp4" presetgroup="H.264, HEVC" audiodesc=" aac" type="av" resize="True" qgroup="not_settable">
        <profile args="f=mp4 acodec=aac ab=256k vcodec=libx265 threads=0 preset=medium movflags=+faststart"/>
    </encodingoption>

    <!-- NVENC --> 
    <!-- -c:v h264_nvenc -preset medium -b:v BITRATE -bufsize BITRATE*2 -profile:v high -bf 3 -b_ref_mode 2 -temporal-aq 1 -rc-lookahead 20 -vsync 0 --> 
    <encodingoption name="NVENC H.264 High Profile / .mp4" extension="mp4" presetgroup="NVENC" audiodesc=" aac" type="av" resize="True" qgroup="qgroup3">
        <profile args="f=mp4 acodec=aac ab=256k vcodec=h264_nvenc preset=medium vb=%BITRATE% bufsize=%BITRATE% vprofile=high bf=3 b_ref_mode=2 temporal-aq=1 rc_lookahead=20 vsync=0"/>
    </encodingoption>
    <encodingoption name="NVENC HEVC / .mp4" extension="mp4" presetgroup="NVENC" audiodesc=" aac" type="av" resize="True" qgroup="not_settable">
        <profile args="f=mp4 acodec=aac ab=256k vcodec=hevc_nvenc rc=vbr cq=24 qmin=24 qmax=24 vprofile=main b_ref_mode=0"/>
    </encodingoption>
     <encodingoption name="NVENC HEVC HDR / .mp4" extension="mp4" presetgroup="NVENC" audiodesc=" aac" type="av" resize="True" qgroup="not_settable">
         <profile args="f=mp4 acodec=aac ab=256k vcodec=hevc_nvenc rc=vbr cq=24 qmin=24 qmax=24 vprofile=main10 b_ref_mode=0 pix_fmt=p010le"/>
     </encodingoption>

    <!-- VAAPI -->
    <!-- ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mp4 -vf 'format=nv12,hwupload' -c:v h264_vaapi -b:v 5M output.mp4 -->
    <encodingoption name="VAAPI H.264 / .mp4" extension="mp4" presetgroup="VAAPI" audiodesc=" aac" type="av" resize="True" qgroup="qgroup3">
        <profile args="f=mp4 acodec=aac ab=256k vcodec=h264_vaapi vf='format@#@#nv12,hwupload' vaapi_device=/dev/dri/renderD128 vb=%BITRATE%"/>
    </encodingoption>

    <!-- MPEG --> 
    <encodingoption name="MPEG-4 / .mp4" extension="mp4" presetgroup="MPEG" type="av" audiodesc=" mp2" resize="True" qgroup="qgroup1">
        <profile args="f=mp4 hq=1 acodec=mp2 ab=256k vcodec=mpeg4 minrate=0 vb=%BITRATE%"/>
    </encodingoption>
    <encodingoption name="MPEG-2 / .mpg" extension="mpg" presetgroup="MPEG" audiodesc=" mp2" type="av" resize="True" qgroup="qgroup1">
        <profile args="f=mpeg acodec=mp2 ab=256k vcodec=mpeg2video minrate=0 vb=%BITRATE% bf=2 b_strategy=1 trellis=1" />
    </encodingoption>
    
    
    <!--WebM, Prores, DNxHD -->
    <encodingoption name="WebM VP8 / .webm" extension="webm" presetgroup="webmetc" audiodesc=" vorbis" type="av" resize="True" qgroup="qgroup2">
        <profile args="f=webm acodec=libvorbis ab=128k vcodec=libvpx g=120 rc_lookahead=16 quality=good speed=0 vprofile=0 qmax=51 qmin=11 slices=4 vb=%BITRATE% maxrate=24M minrate=100k arnr_max_frames=7 arnr_strength=5 arnr_type=3 auto-alt-ref=0 mlt_image_format=rgb24a pix_fmt=yuva420p" />
    </encodingoption>
    <encodingoption name="WebM VP9 / .webm" extension="webm" presetgroup="webmetc" audiodesc=" opus" type="av" resize="True" qgroup="qgroup2">
        <profile args="f=webm acodec=libopus ar=48000 ab=128k vcodec=libvpx-vp9 vb=%BITRATE% g=120 bf=2 threads=0 rc_lookahead=16 quality=good speed=3 vprofile=0 qmax=51 qmin=4 slices=4 tile-columns=6 frame-parallel=1 auto-alt-ref=1 lag-in-frames=25 row-mt=1" />
    </encodingoption>
    <encodingoption name="Apple ProRes 422 / .mov" extension="mov" presetgroup="webmetc" audiodesc=" pcm" type="av" resize="True" qgroup="prores422">
        <profile args="f=mov acodec=pcm_s24le ac=2 vcodec=prores vprofile=%PROFILE% vendor=ap10 pix_fmt=yuv422p10le" />
    </encodingoption>
    <encodingoption name="Apple ProRes 4444 / .mov" extension="mov" presetgroup="webmetc" audiodesc=" pcm" type="av" resize="True" qgroup="prores4444">
        <profile args="f=mov acodec=pcm_s24le ac=2 vcodec=prores_ks vprofile=%PROFILE% vendor=ap10 pix_fmt=yuva444p10le" />
    </encodingoption>    
    <encodingoption name="DNxHD / .mov" extension="mov" presetgroup="webmetc" audiodesc=" pcm" type="av" resize="True" qgroup="qgroup3">
        <profile args="pix_fmt=yuv422p progressive=1 vcodec=dnxhd vprofile=dnxhr_hq qscale=1 vb=%BITRATE% g=1 bf=0 acodec=pcm_s24le f=mov movflags=+write_colr+faststart" />
    </encodingoption> 

    
    <!-- Lossless --> 
    <encodingoption name="Lossless H.264 / .mp4" extension="mp4" presetgroup="Lossless" audiodesc=" mp3"  type="av" resize="True" qgroup="lossless">
        <profile args="f=mp4 acodec=libmp3lame ab=320k ac=2 pix_fmt=yuv420p vcodec=libx264 cqp=0 me_method=esa subq=8 qmin=10 qcomp=0.6 qdiff=4 qmax=51 coder=ac partitions=+parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 refs=16 trellis=1" />
    </encodingoption>
    <encodingoption name="Lossless MPEG-4 / .mp4" extension="mp4" presetgroup="Lossless" audiodesc=" mp3" type="av" resize="True" qgroup="lossless">
        <profile args="f=mp4 acodec=libmp3lame ab=320k ac=2 vcodec=mpeg4 qscale=1 qmin=1" />
    </encodingoption>
    <encodingoption name="Lossless FFv1 / .mkv" extension="mkv" presetgroup="Lossless" audiodesc=" flac" type="av" resize="True" qgroup="lossless">
        <profile args="f=mkv acodec=flac vcodec=ffv1 level=3 g=1 slicecrc=1 slices=16" />
    </encodingoption>
    <encodingoption name="Lossless HuffYUV / .avi" extension="avi" presetgroup="Lossless" audiodesc=" pcm" type="av" resize="True" qgroup="lossless">
        <profile args="f=avi acodec=pcm_s24le ac=2 vcodec=huffyuv" />
    </encodingoption>


    <!-- Audio --> 
    <encodingoption name="PCM / .wav" extension="wav" presetgroup="Audio" audiodesc="pcm" type="audio" resize="NA" qgroup="not_settable"> 
        <profile args="f=wav video_off=1" />
    </encodingoption>
    <encodingoption name="FLAC / .mka" extension="mka" presetgroup="Audio" audiodesc="pcm" type="audio" resize="NA" qgroup="not_settable"> 
        <profile args="f=matroska acodec=flac vn=1 video_off=1" />
    </encodingoption>
    <encodingoption name="AAC / .m4a" extension="mka" presetgroup="Audio" audiodesc="m4a" type="audio" resize="NA" qgroup="not_settable"> 
        <profile args="f=mp4 acodec=aac ab=256k vn=1 video_off=1" />
    </encodingoption>
    <encodingoption name="VORBIS / .ogg" extension="ogg" presetgroup="Audio" audiodesc="ogg" type="audio" resize="NA" qgroup="not_settable"> 
        <profile args="f=ogg acodec=vorbis ab=256k vn=1 video_off=1" />
    </encodingoption>



    <!-- Image Sequence  --> 
    <encodingoption name="Image Sequence BMP" extension="bmp" presetgroup="Image Sequence" audiodesc="NA" type="img_seq" resize="NA" qgroup="lossless">
        <profile args="vcodec=bmp f=image2 an=1 audio_off=1 g=1 bf=0" />
    </encodingoption>
    <encodingoption name="Image Sequence DPX" extension="dpx" presetgroup="Image Sequence" audiodesc="NA" type="img_seq" resize="NA" qgroup="lossless">
        <profile args="vcodec=dpx" />
    </encodingoption>
    <encodingoption name="Image Sequence PNG" extension="png" presetgroup="Image Sequence" audiodesc="NA" type="img_seq" resize="NA" qgroup="lossless">
        <profile args="vcodec=png" />
    </encodingoption>
    <encodingoption name="Image Sequence PPM" extension="ppm" presetgroup="Image Sequence" audiodesc="NA" type="img_seq" resize="NA" qgroup="lossless">
        <profile args="vcodec=ppm" />
    </encodingoption>
    <encodingoption name="Image Sequence TGA" extension="tga" presetgroup="Image Sequence" audiodesc="NA" type="img_seq" resize="NA" qgroup="lossless">
        <profile args="vcodec=targa" />
    </encodingoption>
    <encodingoption name="Image Sequence TIFF" extension="tif" presetgroup="Image Sequence" audiodesc="NA" type="img_seq" resize="NA" qgroup="lossless">
        <profile args="vcodec=tiff" />
    </encodingoption>
    
    
    <!-- Alpha -->
    <encodingoption name="WebM VP9 Alpha" extension="webm" presetgroup="Alpha" audiodesc="opus" type="av" resize="True" qgroup="qgroup3">
        <profile args="f=webm acodec=libopus ar=48000 ab=128k vcodec=libvpx-vp9 vb=%BITRATE% g=120 bf=2 threads=0 rc_lookahead=16 quality=good speed=3 vprofile=0 qmax=51 qmin=4 slices=4 tile-columns=6 frame-parallel=1 lag-in-frames=25 row-mt=1 auto-alt-ref=0 mlt_image_format=rgba pix_fmt=yuva420p" />
    </encodingoption>


    <!-- Proxy encoding -->
    <proxyencodingoption name="H.264 Preset Ultrafast" extension="mp4" type="av" audiodesc="mp3, 192kb/s, 48000Hz" resize="True" qgroup="qgroup2">
        <profile args="f=mp4 acodec=libmp3lame ac=2 ab=192k ar=48000 vcodec=libx264 preset=ultrafast tune=fastdecode g=30 crf=25"/>
    </proxyencodingoption>
    <proxyencodingoption name="MPEG-4 Preset Ultrafast" extension="mp4" type="av" audiodesc="mp3, 192kb/s, 48000Hz" resize="True" qgroup="qgroup1">
        <profile args="f=mp4 acodec=libmp3lame ac=2 ab=192k ar=48000 vcodec=mpeg4 preset=ultrafast"/>
    </proxyencodingoption>
    <proxyencodingoption name="MPEG-2 Transport Stream" extension="m2t" type="av" audiodesc="mp2, 256kb/s, 48000Hz" resize="True" qgroup="qgroup1">
       <profile args="f=mpegts acodec=mp2 ab=256k ar=48000 vcodec=mpeg2video g=5" />
    </proxyencodingoption>
    <proxyencodingoption name="Apple ProRes 422 Proxy / .mov" extension="mov" type="av" audiodesc="pcm" resize="True" qgroup="not_settable">
        <profile args="f=mov acodec=pcm_s24le ac=2 vcodec=prores vprofile=0 vendor=ap10 pix_fmt=yuv422p10le" />
    </proxyencodingoption>
    <proxyencodingoption name="FFMPEG NVENC H.264  / .mp4" extension="mp4" type="av" audiodesc="pcm" resize="True" qgroup="not_settable" ffmpeggpuenc="h264_nvenc">
        <profile args="%SOURCEFILE -c:a aac -vf scale=%SCREENSIZE -c:v h264_nvenc -rc vbr -cq 28 -pix_fmt yuv420p %PROXYFILE"/>
    </proxyencodingoption>
    <proxyencodingoption name="FFMPEG VAAPI H.264  / .mp4" extension="mp4" type="av" audiodesc="pcm" resize="True" qgroup="not_settable" ffmpeggpuenc="h264_vaapi">
        <profile args="%SOURCEFILE -vaapi_device /dev/dri/renderD128 -vf 'format=nv12,hwupload,scale_vaapi=%SCREEN%SIZE%TWO%' -c:v h264_vaapi %PROXYFILE"/>
    </proxyencodingoption>


</renderencoding>
