Various changes:

* Reformatted source code automatically.
* Possible fix for x264 refusing to build lossless videos.
* Allow encoders to add extra options to the command line, such as gpu selection.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2020-10-25 18:32:07 +01:00
parent 43952dd162
commit 3b0cdeaaac
4 changed files with 72 additions and 43 deletions
+13 -6
View File
@@ -31,6 +31,7 @@
"enabled": true,
"pool": "nvenc",
"parallel": 2,
"gpu": -1,
"presets": [
"p5",
"p6",
@@ -55,32 +56,38 @@
"hevc_nvenc": {
"enabled": false,
"pool": "nvenc",
"parallel": 3
"parallel": 2,
"gpu": -1
},
"h264_amf": {
"enabled": false,
"pool": "amf",
"parallel": 3
"parallel": 2,
"gpu": -1
},
"hevc_amf": {
"enabled": false,
"pool": "amf",
"parallel": 3
"parallel": 2,
"gpu": -1
},
"h264_qsv": {
"enabled": false,
"pool": "qsv",
"parallel": 3
"parallel": 2,
"gpu": -1
},
"hevc_qsv": {
"enabled": false,
"pool": "qsv",
"parallel": 3
"parallel": 2,
"gpu": -1
},
"vp9_qsv": {
"enabled": false,
"pool": "qsv",
"parallel": 3
"parallel": 2,
"gpu": -1
},
"libvpx-vp9": {
"enabled": false,
+4
View File
@@ -35,6 +35,10 @@ class encoder {
get(index, width, height, framerate) {
throw new Error("Not Implemented");
}
extra() {
return [];
}
}
module.exports = encoder;
+3 -9
View File
@@ -139,15 +139,9 @@ class h264_nvenc extends encoder {
return this.combinations[index];
}
/*
for (let br of _config.bitrates)
"-b:v", `${br.toFixed(0)}k`,
"-bufsize", `${(br * 2).toFixed(0)}k`,
"-minrate", "0",
"-maxrate", `${br.toFixed(0)}k`,
for (let kfm of _config.keyframe_multiplier)
"-g", (_cache.fps * kfm).toFixed(0),
*/
extra() {
return ["-gpu", settings.gpu];
}
}
module.exports = h264_nvenc;
+26 -2
View File
@@ -244,7 +244,6 @@ async function create_caches(config, ff, videos, encoders) { // Create Caches
} else {
command.push(
"-c:v", "libx264",
"-profile:v", "high",
"-preset", "veryfast",
"-crf", "0",
"-b:v", "0",
@@ -342,7 +341,7 @@ async function transcode(config, ff, videos, encoders) {
"-minrate", "0",
"-maxrate", "0",
"-bufsize", `${2 * bitrate}k`,
].concat(command.options).concat([file]);
].concat(command.options).concat(encoder.extra()).concat([file]);
queue_commands.push(
encoder.pool(),
@@ -379,8 +378,33 @@ async function transcode(config, ff, videos, encoders) {
console.timeEnd("Subtotal");
console.groupEnd();
// Process from here on out.
// LOOP
// 1. Pull out front of the command and file queue.
// 2. Encode using the given command(s).
// 3. Compare resulting files with real input (libvmaf).
// 4. Delete encoded files.
// 5. Repeat until queues empty, no more caches for video, and no more videos.
/*
console.group("Queueing...")
console.time("Subtotal");
for (let video_key of videos.keys()) {
console.group(video_key);
console.time(video_key);
let video = videos.get(video_key);
for (let cache_key of video.caches.keys()) {
let cache = video.caches.get(cache_key);
console.time(cache_key);
console.timeEnd(cache_key);
}
console.timeEnd(video_key);
console.groupEnd();
}
console.timeEnd("Subtotal");
console.groupEnd();
*/
/*
for (let video_name in videos) {
console.time(video_name);