mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 15:38:19 -07:00
Merge pull request #391 from HaveAGitGat/smoove_fix
Use file.ffProbeData.format.duration
This commit is contained in:
commit
d6922ec703
2 changed files with 35 additions and 1 deletions
|
|
@ -88,7 +88,13 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|||
let duration = '';
|
||||
|
||||
// Get duration of stream 0 and times it by 0.0166667 to get time in minutes
|
||||
duration = file.ffProbeData.streams[0].duration * 0.0166667;
|
||||
if (file.ffProbeData.streams[0].duration) {
|
||||
duration = file.ffProbeData.streams[0].duration;
|
||||
} else {
|
||||
duration = file.ffProbeData.format.duration;
|
||||
}
|
||||
|
||||
duration *= 0.0166667;
|
||||
|
||||
// Set up required variables.
|
||||
let videoIdx = 0;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,34 @@ const tests = [
|
|||
inputs: {},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
processFile: true,
|
||||
infoLog: 'Container for output selected as mkv. \n'
|
||||
+ 'Current bitrate = 3058 \n'
|
||||
+ 'Bitrate settings: \n'
|
||||
+ 'Target = 3058 \n'
|
||||
+ 'Minimum = 2140 \n'
|
||||
+ 'Maximum = 3975 \n'
|
||||
+ 'File is not h264. Transcoding. \n',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
container: '.mkv',
|
||||
preset: ',-map 0 -c:v h264_nvenc -preset fast -crf 23 -tune film -b:v 3058k -minrate 2140k -maxrate 3975k -bufsize 3058k -c:a copy -c:s copy -max_muxing_queue_size 9999 -pix_fmt yuv420p ',
|
||||
},
|
||||
},
|
||||
{
|
||||
input: {
|
||||
file: (() => {
|
||||
const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json'));
|
||||
delete file.ffProbeData.streams[0].duration;
|
||||
delete file.ffProbeData.format.duration;
|
||||
return file;
|
||||
})(),
|
||||
librarySettings: {},
|
||||
inputs: {},
|
||||
otherArguments: {},
|
||||
},
|
||||
output: {
|
||||
processFile: false,
|
||||
infoLog: 'Target bitrate could not be calculated. Skipping this plugin. \n',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue