mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 09:45:55 -07:00
Added AV1 encode support
Fairly major revision. Been using this locally for months on HEVC & AV1 encodes and not had any issues currently. I can't verify if my 4k HDR & DoVi setups are 'actually' working for real but they seem to look correct & I've not had errors for encodes or on Plex. With AV1 support, admittedly this may be confusing since the plugin ID still specifies HEVC but I have updated the name. I didn't want to split this into a new plugin since the logic is pretty much exactly the same & I don't want to maintain two almost identical plugins) - Adding AV1 encode support, added as drop down selector (default is still hevc) - Logic should pick valid video profile for either encoder setting - HDR detection & encode improvement (Appears to work on my HDR content & DoVi) - Added target bitrate modifier so it's possible to tune the bitrate (useful for AV1 to crunch it down further) - Better bitrate detection, should error if it can't be found at all - Mac support is over. Doubt anyone was really using it on Mac but it's not worth touching further. Plugin should still use videotoolbox when on Mac but I won't be fixing up errors. - Cleaned up descriptions & info logs where reasonable to try and clarify what's happening - Tests updated & added new test for a fully loaded AV1 setup
This commit is contained in:
parent
7b3f9ee4d0
commit
118c6f4471
2 changed files with 243 additions and 72 deletions
|
|
@ -49,7 +49,6 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -82,7 +81,7 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mp4.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -98,7 +97,7 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mp4.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -114,7 +113,7 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mp4.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -150,8 +149,8 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n'
|
||||
+ 'Input file is h264 High10. Hardware Decode not supported.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Input file is h264 High10. Hardware Decode not supported so will SW decode.\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 3227k\n'
|
||||
|
|
@ -167,8 +166,8 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n'
|
||||
+ 'Input file is h264 High10. Hardware Decode not supported.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Input file is h264 High10. Hardware Decode not supported so will SW decode.\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 3227k\n'
|
||||
|
|
@ -184,8 +183,8 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 6454kbps.\n'
|
||||
+ 'Input file is h264 High10. Hardware Decode not supported.\n'
|
||||
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
|
||||
+ 'Input file is h264 High10. Hardware Decode not supported so will SW decode.\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 3227k\n'
|
||||
|
|
@ -220,14 +219,12 @@ const tests = [
|
|||
output: {
|
||||
linux: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v hevc_qsv<io> -map 0 -c:v hevc_qsv -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
preset: '-fflags +genpts -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v hevc_qsv<io> -map 0 -c:v hevc_qsv -b:v 6000k -minrate 4500k -maxrate 7500k -bufsize 12000k -preset fast -c:a copy -c:s copy -max_muxing_queue_size 9999 -f matroska -profile:v main10 -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ',
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps.\n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 6000k\n'
|
||||
|
|
@ -245,7 +242,7 @@ const tests = [
|
|||
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps.\n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 6000k\n'
|
||||
|
|
@ -263,7 +260,7 @@ const tests = [
|
|||
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 6000kbps.\n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting.\n'
|
||||
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 6000k\n'
|
||||
|
|
@ -468,7 +465,7 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -484,7 +481,7 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -500,7 +497,7 @@ const tests = [
|
|||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ '10 bit encode enabled. Setting VideoToolBox Profile v2 & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -538,7 +535,7 @@ const tests = [
|
|||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ 'Input file is vc1. Hardware Decode not supported.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -555,7 +552,7 @@ const tests = [
|
|||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 1206kbps.\n'
|
||||
+ 'Input file is vc1. Hardware Decode not supported.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 603k\n'
|
||||
|
|
@ -616,7 +613,7 @@ const tests = [
|
|||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
|
||||
+ '==WARNING== This looks to be a HDR file. HDR is supported but correct encoding is not guaranteed.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 6000k\n'
|
||||
|
|
@ -633,7 +630,7 @@ const tests = [
|
|||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
|
||||
+ '==WARNING== This looks to be a HDR file. HDR is supported but correct encoding is not guaranteed.\n'
|
||||
+ '10 bit encode enabled. Setting Main10 Profile & 10 bit pixel format\n'
|
||||
+ '10 bit encode enabled. Setting main10 Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 6000k\n'
|
||||
|
|
@ -663,5 +660,75 @@ const tests = [
|
|||
},
|
||||
},
|
||||
},
|
||||
// Test 10 - The 'Everything' Test
|
||||
{
|
||||
input: {
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH265_1.json'));
|
||||
file.ffProbeData.streams[0].color_space = 'bt2020nc';
|
||||
file.ffProbeData.streams[0].color_transfer = 'smpte2084';
|
||||
file.ffProbeData.streams[0].color_primaries = 'bt2020';
|
||||
file.mediaInfo.track[1].BitRate = 12000000;
|
||||
file.ffProbeData.streams[0].profile = 'Main 10';
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {
|
||||
container: 'mkv',
|
||||
encoder: 'av1_qsv',
|
||||
force_confirm: 'true',
|
||||
enable_10bit: 'true',
|
||||
target_bitrate_modifier: '0.4',
|
||||
encoder_speedpreset: 'slow',
|
||||
extra_qsv_options: '-async_depth 4 -aq-mode 4 -look_ahead 1 -look_ahead_depth 100 -b_strategy 1 -adaptive_i 1 -adaptive_b 1',
|
||||
bitrate_cutoff: '7500',
|
||||
max_average_bitrate: '7000',
|
||||
min_average_bitrate: '3500',
|
||||
reconvert_hevc: 'true',
|
||||
hevc_max_bitrate: '8100',
|
||||
},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
linux: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv -init_hw_device qsv:hw_any,child_device_type=vaapi -c:v hevc_qsv<io> -map 0 -c:v av1_qsv -b:v 4800k -minrate 3600k -maxrate 6000k -bufsize 12000k -preset slow -async_depth 4 -aq-mode 4 -look_ahead 1 -look_ahead_depth 100 -b_strategy 1 -adaptive_i 1 -adaptive_b 1 -c:a copy -c:s copy -max_muxing_queue_size 9999 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -f matroska -profile:v main -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
|
||||
+ '==WARNING== This looks to be a HDR file. HDR is supported but correct encoding is not guaranteed.\n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 8100kbps.\n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting.\n'
|
||||
+ '10 bit encode enabled. Setting main Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 4800k\n'
|
||||
+ 'Minimum = 3600k\n'
|
||||
+ 'Maximum = 6000k\n'
|
||||
+ 'File Transcoding...\n',
|
||||
container: '.mkv',
|
||||
},
|
||||
win32: {
|
||||
processFile: true,
|
||||
preset: '-fflags +genpts -hwaccel qsv -hwaccel_output_format qsv -init_hw_device qsv:hw,child_device_type=d3d11va -c:v hevc_qsv<io> -map 0 -c:v av1_qsv -b:v 4800k -minrate 3600k -maxrate 6000k -bufsize 12000k -preset slow -async_depth 4 -aq-mode 4 -look_ahead 1 -look_ahead_depth 100 -b_strategy 1 -adaptive_i 1 -adaptive_b 1 -c:a copy -c:s copy -max_muxing_queue_size 9999 -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -f matroska -profile:v main -vf scale_qsv=format=p010le,hwupload=extra_hw_frames=64,format=qsv ',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '☑ It looks like the current video bitrate is 12000kbps.\n'
|
||||
+ '==WARNING== This looks to be a HDR file. HDR is supported but correct encoding is not guaranteed.\n'
|
||||
+ 'Reconvert_hevc is true & the file is already HEVC, VP9 or AV1. Using HEVC specific cutoff of 8100kbps.\n'
|
||||
+ '☒ The file is still above this new cutoff! Reconverting.\n'
|
||||
+ '10 bit encode enabled. Setting main Profile & 10 bit pixel format\n'
|
||||
+ 'Container for output selected as mkv.\n'
|
||||
+ 'Encode variable bitrate settings:\n'
|
||||
+ 'Target = 4800k\n'
|
||||
+ 'Minimum = 3600k\n'
|
||||
+ 'Maximum = 6000k\n'
|
||||
+ 'File Transcoding...\n',
|
||||
container: '.mkv',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
void run(tests);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue