Tdarr_Plugin_bsh1_Boosh_FFMPEG_QSV_HEVC
Boosh-Transcode Using QSV GPU & FFMPEG (v1.4)
==DETAILS== This is a QSV plugin. VAAPI is NOT used. Supports HEVC or AV1 encoding. Ensure you have supported hardware!
==OS SUPPORT== This plugin supports Linux & Windows using QSV. Mac is not officially supported. If you do use Mac, encodes will use videotoolbox instead of QSV & will ignore the encoder selection.
==LOGIC== Files will be transcoded into the selected format of HEVC or AV1, using Quick Sync Video (QSV) via an Intel GPU using ffmpeg. Settings are dependant on file bitrate & a bitrate modifier. The general logic is that either format can support the same amount of data at half the bitrate of H264. This plugin will skip files already in HEVC, AV1 & VP9 unless "reconvert_hevc" is marked as true. If it is then these will be reconverted again if they exceed the bitrate specified in "hevc_max_bitrate". This plugin relies on understanding the accurate video bitrate of your files. It's highly recommended to first remux into MKV & enable "Run mkvpropedit on files before running plugins" under Tdarr>Options.
Inputs:
Name: container
Type: string
Tooltip:
\n
==DESCRIPTION==
\nSpecifies the output container of the file.
\nEnsure that all stream types you may have are supported by your chosen container.
\n
==INFO==
\nOnly MP4 & MKV are supported and MKV is recommended.
\nExample:\n
mkv
\nExample:\n
mp4
Name: encoder
Type: string
Tooltip:
\n
==DESCRIPTION==
\nSpecifies the hardware encoder to use. Either HEVC or AV1
\nEnsure that your hardware is able to use the selected encoder.
A 8th Gen+ intel CPU is suggested for HEVC, & a Intel Arc GPU for AV1
\n
==INFO==
\nOnly HEVC or AV1 encoders are supported!
\nWhen using AV1, consider adjusting the Bitrate modifier to tune your output results
Name: force_conform
Type: boolean
Tooltip:
\n
==DESCRIPTION==
\nMake the file conform to output containers requirements.
Use if you need to ensure the encode works from mp4>mkv or mkv>mp4. \n
==WARNING== \n
This will remove data of certain types so ensure you are happy with that,
or use another plugin to convert these data types first!
\n
==INFO==
\nDrop hdmv_pgs_subtitle/eia_608/subrip/timed_id3 for MP4.
\nDrop data streams/mov_text/eia_608/timed_id3 for MKV.
\nDefault is false.
\nExample:\n
true
\nExample:\n
false
Name: enable_10bit
Type: boolean
Tooltip:
\n
==DESCRIPTION==
\nSpecify if we want to enable 10bit encoding.
\nIf this is enabled files will be processed and converted into 10bit
HEVC using main10 profile and with p010le pixel format.
If you just want to retain files that are already 10 bit then this can be left as false, as
10bit to 10bit in ffmpeg should be automatic.
\n
==INFO==
\nDefault is "false".
\nExample:\n
true
\nExample:\n
false
Name: target_bitrate_modifier
Type: number
Tooltip:
\n
==DESCRIPTION==
\nSpecify the modifier for the target bitrate. The logic is that HEVC can obtain the same quality
at half the bitrate.
\nIf you feel this isn't achieving the quality you want then increase this value.
\nRecommended to leave at default. Setting to 1.0 or higher will achieve no size reduction.
\nLook at the min & max bitrate options if you just want to set lower & upper limits for acceptable bitrate
\n
==INFO==
\nDefault is "0.5".
\nExample:\n
0.5
\nExample:\n
0.75
Name: encoder_speedpreset
Type: string
Tooltip:
\n
==DESCRIPTION==
\nSpecify the encoder speed/preset to use.
Slower options mean a slower encode but better quality and faster options mean faster encodes but
worse quality.
\nFor more information see intel white paper on ffmpeg results using QSV: \nhttps://www.intel.com/content/dam/www/public/us/en/documents/white-papers/cloud-computing-quicksync-video-ffmpeg-white-paper.pdf
\n
==INFO==
\nDefault is "slow".
\nExample:\n
medium
\nExample:\n
slower
Name: extra_qsv_options
Type: string
Tooltip:
\n
==DESCRIPTION==
\nHere you can add extra options to the ffmpeg QSV ENCODE cmd.
This does not override the ffmpeg cmd, it just allows additions to it.
\n
There are extra QSV options that can be
forced on/off as desired. See here for some possible cmds -
https://ffmpeg.org/ffmpeg-codecs.html#toc-HEVC-Options-1
OR https://ffmpeg.org/ffmpeg-codecs.html#AV1-Options
\n
==WARNING== \n
Be certain to verify the cmds work before adding to your workflow. \n
Check Tdarr Help Tab. Enter ffmpeg cmd - "-h encoder=hevc_qsv" OR "-h encoder=av1_qsv".
This will give a list of supported commands. \n
THERE ARE CMD DIFFERENCES BETWEEN HEVC & AV1! DO NOT JUST BLINDLY COPY CMDS BELOW AND EXPECT THEM TO WORK! \n
MAC SPECIFIC - This option is ignored on Mac because videotoolbox is used rather than qsv.
\n
==INFO==
\nDefault is empty but the first example below has a suggested value. If unsure just leave empty.
\nEnsure to only use cmds valid to encoding QSV as the script handles other ffmpeg cmds relating to
bitrate etc. Anything else entered here might be supported but could cause undesired results.
\nIf you are using a "-vf" cmd, please put it at the end to avoid issues!
\nExample:\n
-async_depth 4 -look_ahead 1 -look_ahead_depth 100 -extbrc 1 -rdo 1 -mbbrc 1 -b_strategy 1 -adaptive_i 1
-adaptive_b 1
\n FOR HEVC_QSV Above increases async, enables look ahead, extended bitrate control, b-frames, etc.\n
\nExample:\n
-async_depth 4 -aq-mode 4 -look_ahead 1 -look_ahead_depth 100 -b_strategy 1 -adaptive_i 1 -adaptive_b 1
\n FOR AV1_QSV Above increases async, enable adaptive quantization, look ahead, b-frames, etc.\n
\nExample:\n
-vf scale_qsv=w=1280:h=720
\nScale video resolution Method 1\n
\nExample:\n
-vf scale_qsv=720:-1
\nScale video resolution Method 2\n
Name: bitrate_cutoff
Type: number
Tooltip:
\n
==DESCRIPTION==
\nSpecify bitrate cutoff, files with a video bitrate lower then this will not be processed.
\n
==INFO==
\nRate is in kbps.
\nDefaults to 0 which means this is disabled.
\nEnter a valid number to enable.
\nExample:\n
2500
\nExample:\n
1500
Name: max_average_bitrate
Type: number
Tooltip:
\n
==DESCRIPTION==
\nSpecify a maximum average video bitrate. When encoding default behaviour is to halve the current video
bitrate to get an average target. This option sets a upper limit to that average
(i.e if you have a video bitrate of 10000, half is 5000, if your maximum desired average bitrate is 4000
then we use that as the target instead of 5000).
\n
==INFO==
\nBitrate here is referring to video bitrate as we want to set the video bitrate on encode.
\nRate is in kbps.
\nDefaults to 0 which means this is disabled.
\nEnter a valid number to enable.
\nExample:\n
4000
\nExample:\n
3000
Name: min_average_bitrate
Type: number
Tooltip:
\n
==DESCRIPTION==
\nSpecify a minimum average video bitrate. When encoding default behaviour is to halve the current video bitrate
to get an average target. This option sets a lower limit to that average (i.e if you have a video bitrate
of 3000, half is 1500, if your minimum desired average bitrate is 2000 then we use that as the target instead
of 1500).
\n
==INFO==
\nBitrate here is referring to video bitrate as we want to set the video bitrate on encode.
\nRate is in kbps.
\nDefaults to 0 which means this is disabled.
\nEnter a valid number to enable.
\nExample:\n
2000
\nExample:\n
1000
Name: reconvert_hevc
Type: boolean
Tooltip:
\n
==DESCRIPTION==
\nSet to reprocess HEVC/VP9/AV1 files (i.e reduce bitrate of files already in those codecs).
\nSince this uses the same logic as normal, halving the current bitrate, this is NOT recommended
unless you know what you are doing, so please leave FALSE if unsure!
\nNEEDS to be used in conjunction with "bitrate_cutoff" or "hevc_max_bitrate" otherwise is ignored.
\nThis is useful in certain situations, perhaps you have a file which is HEVC but has an extremely high
bitrate and you'd like to reduce it.
\n
==WARNING== \n
IF YOU HAVE HEVC/VP9/AV1 FILES YOU WANT TO KEEP IN THOSE FORMATS THEN DO NOT USE THIS OPTION. \n
\nThis option has the potential to LOOP your encodes! You can encode a file to HEVC and still
be above your cutoff and it would be converted again & again if this is set to true (since it's now HEVC).
So if you use this be sure to set "hevc_max_bitrate" & "max_average_bitrate" to help prevent the plugin looping.
Also it is highly suggested that you have your "hevc_max_bitrate" higher than "max_average_bitrate".
\nPlease be certain you want this enabled before setting it otherwise leave this as FALSE!
While the plugin will attempt to generate accurate video bitrate metadata, it can not always reliably do so
and will be forced to fall back onto estimates. Please bare this in mind when using the HEVC reprocess option.
\n
\nExample:\n
true
\nExample:\n
false
Name: hevc_max_bitrate
Type: number
Tooltip:
\n
==DESCRIPTION==
\nHas no effect unless "reconvert_hevc" is set to true. This allows you to specify a maximum
allowed average OVERALL bitrate for HEVC/AV1/VP9 files. Much like the "bitrate_cutoff" option, but
specifically for these files. It should be set HIGHER then your standard cutoff for safety.
\nAlso, it's highly suggested you use the min & max average bitrate options in combination with this. You will
want this to control the encoded video bitrate, otherwise you may end up unintentionally reprocessing these files.
i.e your file might have a overall bitrate of 20000, if your hevc cutoff is 5000 then it's going to
reconvert multiple times before it'll be below that cutoff.
\nWhile HEVC/AV1/VP9 reprocessing can be useful this is why it is NOT recommended unless you know what you are
doing!
\n
==WARNING== \n
While the plugin will attempt to generate accurate video bitrate metadata, it can not always reliably do so
and will be forced to fall back onto estimates. Please bare this in mind when using the HEVC reprocess option.
\n
==INFO==
\nRate is in kbps.
\nDefaults to 0 which means this is disabled.
\nEnter a valid number to enable, otherwise we use "bitrate_cutoff" and multiply x2 for a safe limit.
\nExample:\n
4000
\nExample:\n
3000