Use file.ffProbeData.format.duration

make-only-subtitle-default
HaveAGitGat 3 years ago
parent 70471aa78c
commit f8e58f594c

@ -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…
Cancel
Save