Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
8660bc9967
|
|||
|
86847cbeca
|
|||
|
3be7cd2407
|
|||
|
64cfdce699
|
|||
|
a949e5d46b
|
|||
|
958ecdca7d
|
|||
|
f1da312b95
|
@@ -0,0 +1,10 @@
|
|||||||
|
frontend:
|
||||||
|
cd solid-src; \
|
||||||
|
pnpm build
|
||||||
|
|
||||||
|
build: frontend
|
||||||
|
neu build
|
||||||
|
|
||||||
|
release: frontend
|
||||||
|
neu build --clean -r --embed-resources
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ encoders supported by your FFmpeg install will show up.
|
|||||||
- [ ] AV1
|
- [ ] AV1
|
||||||
- [x] libaom-av1
|
- [x] libaom-av1
|
||||||
- [x] librav1e (Partial support)
|
- [x] librav1e (Partial support)
|
||||||
- [ ] libsvtav1
|
- [x] libsvtav1
|
||||||
- [ ] av1_amf
|
- [ ] av1_amf
|
||||||
- [ ] av1_nvenc
|
- [ ] av1_nvenc
|
||||||
- [ ] av1_qsv
|
- [ ] av1_qsv
|
||||||
@@ -59,22 +59,16 @@ encoders supported by your FFmpeg install will show up.
|
|||||||
- [x] libx264rgb (Untested, but _should_ work)
|
- [x] libx264rgb (Untested, but _should_ work)
|
||||||
- [ ] h264_amf
|
- [ ] h264_amf
|
||||||
- [ ] h264_nvenc
|
- [ ] h264_nvenc
|
||||||
- [ ] h264_qsv
|
- [x] h264_qsv
|
||||||
- [ ] h264_v4l2m2m
|
|
||||||
- [ ] h264_vaapi
|
- [ ] h264_vaapi
|
||||||
- [ ] h264_vulkan
|
- [ ] h264_vulkan
|
||||||
- [ ] H.265
|
- [ ] H.265
|
||||||
- [x] libx265
|
- [x] libx265
|
||||||
- [ ] h264_amf
|
- [ ] h265_amf
|
||||||
- [ ] h264_nvenc
|
- [ ] h265_nvenc
|
||||||
- [ ] h264_qsv
|
- [x] h265_qsv
|
||||||
- [ ] h264_v4l2m2m
|
- [ ] h265_vaapi
|
||||||
- [ ] h264_vaapi
|
- [ ] h265_vulkan
|
||||||
- [ ] h264_vulkan
|
|
||||||
- [ ] VP8
|
|
||||||
- [ ] libvpx
|
|
||||||
- [ ] vp8_v4l2m2m
|
|
||||||
- [ ] vp8_vaapi
|
|
||||||
- [ ] VP9
|
- [ ] VP9
|
||||||
- [ ] libvpx-vp9
|
- [ ] libvpx-vp9
|
||||||
- [ ] vp9_vaapi
|
- [ ] vp9_vaapi
|
||||||
|
|||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env xdg-open
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Version=1.5
|
||||||
|
Name=Vencoder
|
||||||
|
Exec=/usr/bin/vencoder
|
||||||
|
Terminal=false
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/neutralinojs/neutralinojs/main/schemas/neutralino.config.schema.json",
|
"$schema": "https://raw.githubusercontent.com/neutralinojs/neutralinojs/main/schemas/neutralino.config.schema.json",
|
||||||
"applicationId": "xyz.dailitation.linesofcodes.vencoder",
|
"applicationId": "xyz.dailitation.linesofcodes.vencoder",
|
||||||
"version": "1.0.0",
|
"version": "0.1.1",
|
||||||
"defaultMode": "window",
|
"defaultMode": "window",
|
||||||
"documentRoot": "/solid-src/dist/",
|
"documentRoot": "/solid-src/dist/",
|
||||||
"url": "/",
|
"url": "/",
|
||||||
|
"port": 5432,
|
||||||
"enableServer": true,
|
"enableServer": true,
|
||||||
"enableNativeAPI": true,
|
"enableNativeAPI": true,
|
||||||
"singlePageServe": true,
|
"singlePageServe": true,
|
||||||
@@ -17,6 +18,11 @@
|
|||||||
"storage.*",
|
"storage.*",
|
||||||
"debug.log"
|
"debug.log"
|
||||||
],
|
],
|
||||||
|
"dataLocation": "system",
|
||||||
|
"storageLocation": "system",
|
||||||
|
"logging": {
|
||||||
|
"writeToLogFile": false
|
||||||
|
},
|
||||||
"modes": {
|
"modes": {
|
||||||
"window": {
|
"window": {
|
||||||
"title": "Vencoder",
|
"title": "Vencoder",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<script src="/__neutralino_globals.js"></script>
|
<script src="http://localhost:5432/__neutralino_globals.js"></script>
|
||||||
<title>Vencoder</title>
|
<title>Vencoder</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -14,4 +14,4 @@
|
|||||||
<script type="module" src="/src/index.tsx"></script>
|
<script type="module" src="/src/index.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -11,15 +11,17 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@neutralinojs/lib": "^6.3.0",
|
"@neutralinojs/lib": "^6.3.0",
|
||||||
"@solidjs/router": "^0.15.3",
|
"@solidjs/router": "^0.15.3",
|
||||||
|
"@tailwindcss/vite": "^4.1.14",
|
||||||
"color-convert": "^3.1.2",
|
"color-convert": "^3.1.2",
|
||||||
"solid-js": "^1.9.9"
|
"solid-js": "^1.9.9",
|
||||||
|
"tailwindcss": "^4.1.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^24.5.2",
|
"@types/node": "^24.6.2",
|
||||||
"prettier": "3.6.2",
|
"prettier": "3.6.2",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"vite": "^7.1.6",
|
"vite": "^7.1.9",
|
||||||
"vite-plugin-solid": "^2.11.8"
|
"vite-plugin-solid": "^2.11.9"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef"
|
"packageManager": "pnpm@10.17.1+sha512.17c560fca4867ae9473a3899ad84a88334914f379be46d455cbf92e5cf4b39d34985d452d2583baf19967fa76cb5c17bc9e245529d0b98745721aa7200ecaf7a"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+509
-141
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,3 @@
|
|||||||
onlyBuiltDependencies:
|
onlyBuiltDependencies:
|
||||||
|
- '@tailwindcss/oxide'
|
||||||
- esbuild
|
- esbuild
|
||||||
|
|||||||
+44
-94
@@ -23,18 +23,16 @@ import {
|
|||||||
} from "./util/ffmpeg";
|
} from "./util/ffmpeg";
|
||||||
import Neutralino from "@neutralinojs/lib";
|
import Neutralino from "@neutralinojs/lib";
|
||||||
import H264Options from "./components/H264Options";
|
import H264Options from "./components/H264Options";
|
||||||
import { openFile } from "./util/oshelper";
|
import { getVencoderFolder } from "./util/path";
|
||||||
import { getTemporaryFilePath, getVencoderFolder } from "./util/path";
|
|
||||||
import { generateRandomString } from "./util/string";
|
|
||||||
import "./css/icons.css";
|
import "./css/icons.css";
|
||||||
import BreezeIcon from "./components/BreezeIcon";
|
import BreezeIcon from "./components/BreezeIcon";
|
||||||
import AV1Options from "./components/AV1Options";
|
import AV1Options from "./components/AV1Options";
|
||||||
import DNxHDOptions from "./components/DNxHDOptions";
|
import DNxHDOptions from "./components/DNxHDOptions";
|
||||||
|
|
||||||
const commonCodecs = new Set(["h264", "hevc", "vp8", "vp9", "av1", "dnxhd"]);
|
const commonCodecs = new Set(["h264", "hevc", "vp9", "av1", "dnxhd"]);
|
||||||
|
|
||||||
interface RunningProcessInfo {
|
interface FileQueueItem {
|
||||||
process: Neutralino.SpawnedProcess;
|
command: string;
|
||||||
file: string;
|
file: string;
|
||||||
length: number;
|
length: number;
|
||||||
}
|
}
|
||||||
@@ -52,9 +50,6 @@ function App() {
|
|||||||
const [showCommonCodecs, setShowCommonCodecs] = createSignal(true);
|
const [showCommonCodecs, setShowCommonCodecs] = createSignal(true);
|
||||||
const [selectedCodec, setSelectedCodec] = createSignal<CodecInfo>();
|
const [selectedCodec, setSelectedCodec] = createSignal<CodecInfo>();
|
||||||
const [selectedEncoder, setSelectedEncoder] = createSignal("");
|
const [selectedEncoder, setSelectedEncoder] = createSignal("");
|
||||||
const [runningProcesses, setRunningProcesses] = createSignal<
|
|
||||||
RunningProcessInfo[]
|
|
||||||
>([]);
|
|
||||||
const [customFileExt, setCustomFileExt] = createSignal("");
|
const [customFileExt, setCustomFileExt] = createSignal("");
|
||||||
const [globalopts, setGlobalopts] = createSignal("");
|
const [globalopts, setGlobalopts] = createSignal("");
|
||||||
const [inputopts, setInputopts] = createSignal("");
|
const [inputopts, setInputopts] = createSignal("");
|
||||||
@@ -63,7 +58,6 @@ function App() {
|
|||||||
const [audioEncoder, setAudioEncoder] = createSignal("");
|
const [audioEncoder, setAudioEncoder] = createSignal("");
|
||||||
const [pixelFormatList, setPixelFormatList] = createSignal([] as string[]);
|
const [pixelFormatList, setPixelFormatList] = createSignal([] as string[]);
|
||||||
const [pixelFormat, setPixelFormat] = createSignal("");
|
const [pixelFormat, setPixelFormat] = createSignal("");
|
||||||
const logs: { [id: number]: string[] } = {};
|
|
||||||
let supportedCodecs: CodecList = { vcodecs: [], acodecs: [] };
|
let supportedCodecs: CodecList = { vcodecs: [], acodecs: [] };
|
||||||
let ffmpegParams: FFmpegParams = {
|
let ffmpegParams: FFmpegParams = {
|
||||||
vcodec: "",
|
vcodec: "",
|
||||||
@@ -73,9 +67,6 @@ function App() {
|
|||||||
output: "",
|
output: "",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let successfulCount = 0;
|
|
||||||
let unsuccessfulCount = 0;
|
|
||||||
let totalCount = 0;
|
|
||||||
|
|
||||||
function windowIsFocused() {
|
function windowIsFocused() {
|
||||||
setWindowFocused(true);
|
setWindowFocused(true);
|
||||||
@@ -85,52 +76,9 @@ function App() {
|
|||||||
setWindowFocused(false);
|
setWindowFocused(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSpawnedProcessEvents(evt: CustomEvent) {
|
|
||||||
switch (evt.detail.action) {
|
|
||||||
case "stdErr":
|
|
||||||
logs[evt.detail.id].push(evt.detail.data);
|
|
||||||
break;
|
|
||||||
case "exit":
|
|
||||||
if (evt.detail.data === 0) {
|
|
||||||
successfulCount += 1;
|
|
||||||
} else {
|
|
||||||
unsuccessfulCount += 1;
|
|
||||||
|
|
||||||
// If the exit code isn't 255 (the exit code of the program exiting because of cancellation)
|
|
||||||
if (evt.detail.data !== 255) {
|
|
||||||
Neutralino.os.showNotification(
|
|
||||||
"File Encoding Failed",
|
|
||||||
`Encoding for file "${runningProcesses()?.find((v) => v.process.id == evt.detail.id)?.file}" failed. Exit code ${evt.detail.data}.`,
|
|
||||||
);
|
|
||||||
|
|
||||||
const tempFilename = `${getTemporaryFilePath()}/vencoder-ffmpeg-${generateRandomString(8)}.log`;
|
|
||||||
Neutralino.filesystem.writeFile(
|
|
||||||
tempFilename,
|
|
||||||
logs[evt.detail.id].join("\n"),
|
|
||||||
);
|
|
||||||
openFile(tempFilename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (successfulCount + unsuccessfulCount === totalCount) {
|
|
||||||
Neutralino.os.showNotification(
|
|
||||||
"File(s) encoded.",
|
|
||||||
`${successfulCount} files encoded successfully. ${unsuccessfulCount} failed or cancelled.`,
|
|
||||||
);
|
|
||||||
successfulCount = 0;
|
|
||||||
unsuccessfulCount = 0;
|
|
||||||
totalCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`FFmpeg exited with code: ${evt.detail.data}`);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
events.on("windowFocus", windowIsFocused);
|
events.on("windowFocus", windowIsFocused);
|
||||||
events.on("windowBlur", windowUnfocused);
|
events.on("windowBlur", windowUnfocused);
|
||||||
events.on("spawnedProcess", handleSpawnedProcessEvents);
|
|
||||||
|
|
||||||
supportedCodecs = await getAvailableCodecs();
|
supportedCodecs = await getAvailableCodecs();
|
||||||
filterDisplayedCodecs();
|
filterDisplayedCodecs();
|
||||||
@@ -149,7 +97,6 @@ function App() {
|
|||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
events.off("windowFocus", windowIsFocused);
|
events.off("windowFocus", windowIsFocused);
|
||||||
events.off("windowBlur", windowUnfocused);
|
events.off("windowBlur", windowUnfocused);
|
||||||
events.off("spawnedProcess", handleSpawnedProcessEvents);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function removeBtnClicked() {
|
function removeBtnClicked() {
|
||||||
@@ -212,27 +159,25 @@ function App() {
|
|||||||
(v) => v.shortName === newValue,
|
(v) => v.shortName === newValue,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newValue !== "h264" && newValue !== "hevc") {
|
let encoder = newValue;
|
||||||
ffmpegParams.twopass = false;
|
if (codecObj?.encoders.length !== 0) {
|
||||||
|
encoder = codecObj?.encoders[0] ?? "";
|
||||||
}
|
}
|
||||||
|
setSelectedCodec(codecObj);
|
||||||
|
setSelectedEncoder(encoder);
|
||||||
|
}
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
ffmpegParams = {
|
ffmpegParams = {
|
||||||
vcodec: codecObj?.shortName ?? "",
|
vcodec: selectedCodec()?.shortName ?? "",
|
||||||
|
encoder: selectedEncoder(),
|
||||||
useropts: {
|
useropts: {
|
||||||
global: "",
|
global: "",
|
||||||
input: "",
|
input: "",
|
||||||
output: "",
|
output: "",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
});
|
||||||
let encoder = newValue;
|
|
||||||
if (codecObj?.encoders.length !== 0) {
|
|
||||||
encoder = codecObj?.encoders[0] ?? "";
|
|
||||||
}
|
|
||||||
ffmpegParams.encoder = encoder;
|
|
||||||
setSelectedCodec(codecObj);
|
|
||||||
setSelectedEncoder(encoder);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAudioEncoders() {
|
function getAudioEncoders() {
|
||||||
const codec = audioCodec();
|
const codec = audioCodec();
|
||||||
@@ -251,8 +196,10 @@ function App() {
|
|||||||
return encoders;
|
return encoders;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onParametersChanged(key: string, value: any) {
|
function onParametersChanged<K extends keyof FFmpegParams>(
|
||||||
// @ts-ignore
|
key: K,
|
||||||
|
value: any,
|
||||||
|
) {
|
||||||
ffmpegParams[key] = value;
|
ffmpegParams[key] = value;
|
||||||
setOutputCommand(generateOutputCommand(ffmpegParams));
|
setOutputCommand(generateOutputCommand(ffmpegParams));
|
||||||
}
|
}
|
||||||
@@ -264,6 +211,7 @@ function App() {
|
|||||||
x: 120,
|
x: 120,
|
||||||
y: 120,
|
y: 120,
|
||||||
injectGlobals: true,
|
injectGlobals: true,
|
||||||
|
processArgs: "--port=5434",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +224,7 @@ function App() {
|
|||||||
|
|
||||||
let acodec = audioEncoder();
|
let acodec = audioEncoder();
|
||||||
|
|
||||||
if (acodec === "") {
|
if (acodec === undefined || acodec === "") {
|
||||||
acodec = audioCodec();
|
acodec = audioCodec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +256,7 @@ function App() {
|
|||||||
|
|
||||||
async function convertClip(
|
async function convertClip(
|
||||||
clip: string,
|
clip: string,
|
||||||
): Promise<RunningProcessInfo | undefined> {
|
): Promise<FileQueueItem | undefined> {
|
||||||
ffmpegParams.inputFile = clip;
|
ffmpegParams.inputFile = clip;
|
||||||
|
|
||||||
const fileName = (await Neutralino.filesystem.getPathParts(clip)).stem;
|
const fileName = (await Neutralino.filesystem.getPathParts(clip)).stem;
|
||||||
@@ -351,9 +299,7 @@ function App() {
|
|||||||
const length = await getLengthMicroseconds(clip);
|
const length = await getLengthMicroseconds(clip);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
process: await Neutralino.os.spawnProcess(
|
command: generateOutputCommand(ffmpegParams),
|
||||||
generateOutputCommand(ffmpegParams),
|
|
||||||
),
|
|
||||||
file: clip,
|
file: clip,
|
||||||
length,
|
length,
|
||||||
};
|
};
|
||||||
@@ -362,21 +308,21 @@ function App() {
|
|||||||
async function convertAllClicked() {
|
async function convertAllClicked() {
|
||||||
const list = fileList();
|
const list = fileList();
|
||||||
|
|
||||||
totalCount = list.length;
|
const queue: FileQueueItem[] = [];
|
||||||
|
|
||||||
const processes = (await Promise.all(list.map(convertClip))).filter(
|
for (const file of list) {
|
||||||
(v) => v !== undefined,
|
const info = await convertClip(file);
|
||||||
);
|
|
||||||
|
|
||||||
setRunningProcesses(processes);
|
if (info !== undefined) {
|
||||||
|
queue.push(info);
|
||||||
processes.forEach((v) => (logs[v.process.id] = []));
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await Neutralino.storage.setData(
|
await Neutralino.storage.setData(
|
||||||
"filesBeingProcessed",
|
"filesBeingProcessed",
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
processes.map((v) => ({
|
queue.map((v) => ({
|
||||||
id: v.process.id,
|
com: v.command,
|
||||||
in: v.file,
|
in: v.file,
|
||||||
len: v.length,
|
len: v.length,
|
||||||
})),
|
})),
|
||||||
@@ -390,7 +336,7 @@ function App() {
|
|||||||
y: 120,
|
y: 120,
|
||||||
injectGlobals: true,
|
injectGlobals: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
enableInspector: false,
|
processArgs: "--port=5433",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,17 +349,11 @@ function App() {
|
|||||||
|
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
|
||||||
totalCount = 1;
|
|
||||||
|
|
||||||
setRunningProcesses([result]);
|
|
||||||
|
|
||||||
logs[result.process.id] = [];
|
|
||||||
|
|
||||||
await Neutralino.storage.setData(
|
await Neutralino.storage.setData(
|
||||||
"filesBeingProcessed",
|
"filesBeingProcessed",
|
||||||
JSON.stringify([
|
JSON.stringify([
|
||||||
{
|
{
|
||||||
id: result.process.id,
|
com: result.command,
|
||||||
in: result.file,
|
in: result.file,
|
||||||
len: result.length,
|
len: result.length,
|
||||||
},
|
},
|
||||||
@@ -577,7 +517,16 @@ function App() {
|
|||||||
</For>
|
</For>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
<Switch fallback={<div></div>}>
|
<div class="row flex-col align-items-center">
|
||||||
|
<h3 class="k-form-section-title">
|
||||||
|
Encoder Options
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<Switch
|
||||||
|
fallback={
|
||||||
|
<div class="text-center mt-4">No options.</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
<Match
|
<Match
|
||||||
when={
|
when={
|
||||||
selectedCodec()?.shortName === "h264" ||
|
selectedCodec()?.shortName === "h264" ||
|
||||||
@@ -586,6 +535,7 @@ function App() {
|
|||||||
>
|
>
|
||||||
<H264Options
|
<H264Options
|
||||||
codec={selectedCodec()}
|
codec={selectedCodec()}
|
||||||
|
encoder={selectedEncoder()}
|
||||||
params={ffmpegParams}
|
params={ffmpegParams}
|
||||||
onParamChanged={onParametersChanged}
|
onParamChanged={onParametersChanged}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
import { Match, Switch } from "solid-js";
|
import { Match, Switch } from "solid-js";
|
||||||
import type { CodecInfo, FFmpegParams } from "@/util/ffmpeg";
|
import type {
|
||||||
|
CodecInfo,
|
||||||
|
FFmpegParamChangedFunc,
|
||||||
|
FFmpegParams,
|
||||||
|
} from "@/util/ffmpeg";
|
||||||
import LibaomOptions from "./encoders/libaom";
|
import LibaomOptions from "./encoders/libaom";
|
||||||
import Librav1eOptions from "./encoders/librav1e";
|
import Librav1eOptions from "./encoders/librav1e";
|
||||||
|
import LibSvtAv1Options from "./encoders/libsvtav1";
|
||||||
|
|
||||||
function AV1Options(props: {
|
function AV1Options(props: {
|
||||||
codec: CodecInfo | undefined;
|
codec: CodecInfo | undefined;
|
||||||
encoder: string;
|
encoder: string;
|
||||||
params: FFmpegParams;
|
params: FFmpegParams;
|
||||||
onParamChanged: (key: string, value: any) => void;
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Switch fallback={<div>No options.</div>}>
|
<Switch fallback={<div class="text-center mt-4">No options.</div>}>
|
||||||
<Match when={props.encoder === "libaom-av1"}>
|
<Match when={props.encoder === "libaom-av1"}>
|
||||||
<LibaomOptions {...props} />
|
<LibaomOptions {...props} />
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={props.encoder === "librav1e"}>
|
<Match when={props.encoder === "librav1e"}>
|
||||||
<Librav1eOptions {...props} />
|
<Librav1eOptions {...props} />
|
||||||
</Match>
|
</Match>
|
||||||
|
<Match when={props.encoder === "libsvtav1"}>
|
||||||
|
<LibSvtAv1Options {...props} />
|
||||||
|
</Match>
|
||||||
</Switch>
|
</Switch>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { os } from "@neutralinojs/lib";
|
import { os } from "@neutralinojs/lib";
|
||||||
import { type CodecInfo, type FFmpegParams } from "../util/ffmpeg";
|
import {
|
||||||
|
type CodecInfo,
|
||||||
|
type FFmpegParamChangedFunc,
|
||||||
|
type FFmpegParams,
|
||||||
|
} from "../util/ffmpeg";
|
||||||
import BreezeIcon from "./BreezeIcon";
|
import BreezeIcon from "./BreezeIcon";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,46 +12,39 @@ import BreezeIcon from "./BreezeIcon";
|
|||||||
function DNxHDOptions(props: {
|
function DNxHDOptions(props: {
|
||||||
codec: CodecInfo | undefined;
|
codec: CodecInfo | undefined;
|
||||||
params: FFmpegParams;
|
params: FFmpegParams;
|
||||||
onParamChanged: (key: string, value: any) => void;
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<section id="commonLossyOptions">
|
<section id="commonLossyOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
<label>Help</label>
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
<div>
|
||||||
</div>
|
<button
|
||||||
<div class="k-form">
|
class="icon-button"
|
||||||
<label>Help</label>
|
onclick={() => os.open("https://askubuntu.com/a/907515")}
|
||||||
<div>
|
title="DNxHD is a picky encoder."
|
||||||
<button
|
|
||||||
class="icon-button"
|
|
||||||
onclick={() =>
|
|
||||||
os.open("https://askubuntu.com/a/907515")
|
|
||||||
}
|
|
||||||
title="DNxHD is a picky encoder."
|
|
||||||
>
|
|
||||||
<BreezeIcon icon="help-about" alt="Help" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<label for="profile">Profile</label>
|
|
||||||
<select
|
|
||||||
class="k-dropdown"
|
|
||||||
name="profile"
|
|
||||||
id="profile"
|
|
||||||
value={props.params.outputopts?.profile ?? "dnxhd"}
|
|
||||||
oninput={(e) => {
|
|
||||||
props.onParamChanged("outputopts", {
|
|
||||||
profile: e.target.value,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<option value="dnxhd">DNxHD</option>
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
<option value="dnxhr_444">DNxHR 444</option>
|
</button>
|
||||||
<option value="dnxhr_hqx">DNxHR HQX</option>
|
|
||||||
<option value="dnxhr_hq">DNxHR HQ</option>
|
|
||||||
<option value="dnxhr_sq">DNxHR SQ</option>
|
|
||||||
<option value="dnxhr_lb">DNxHR LB</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
<label for="profile">Profile</label>
|
||||||
|
<select
|
||||||
|
class="k-dropdown"
|
||||||
|
name="profile"
|
||||||
|
id="profile"
|
||||||
|
value={props.params.outputopts?.profile ?? "dnxhd"}
|
||||||
|
oninput={(e) => {
|
||||||
|
props.onParamChanged("outputopts", {
|
||||||
|
profile: e.target.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<option value="dnxhd">DNxHD</option>
|
||||||
|
<option value="dnxhr_444">DNxHR 444</option>
|
||||||
|
<option value="dnxhr_hqx">DNxHR HQX</option>
|
||||||
|
<option value="dnxhr_hq">DNxHR HQ</option>
|
||||||
|
<option value="dnxhr_sq">DNxHR SQ</option>
|
||||||
|
<option value="dnxhr_lb">DNxHR LB</option>
|
||||||
|
</select>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,169 +1,40 @@
|
|||||||
import { createSignal, Show } from "solid-js";
|
import { Match, Switch } from "solid-js";
|
||||||
import {
|
import {
|
||||||
DEFAULT_BITRATE,
|
|
||||||
type CodecInfo,
|
type CodecInfo,
|
||||||
|
type FFmpegParamChangedFunc,
|
||||||
type FFmpegParams,
|
type FFmpegParams,
|
||||||
} from "../util/ffmpeg";
|
} from "../util/ffmpeg";
|
||||||
import { os } from "@neutralinojs/lib";
|
import LibH26xOptions from "./encoders/libx264";
|
||||||
import BreezeIcon from "./BreezeIcon";
|
import H264QsvOptions from "./encoders/h264qsv";
|
||||||
|
|
||||||
const information = {
|
|
||||||
h264: {
|
|
||||||
defaultCrf: 23,
|
|
||||||
},
|
|
||||||
hevc: {
|
|
||||||
defaultCrf: 28,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for H.264/H.265 codecs
|
* Options for H.264/H.265 codecs
|
||||||
*/
|
*/
|
||||||
function H264Options(props: {
|
function H264Options(props: {
|
||||||
codec: CodecInfo | undefined;
|
codec: CodecInfo | undefined;
|
||||||
|
encoder: string;
|
||||||
params: FFmpegParams;
|
params: FFmpegParams;
|
||||||
onParamChanged: (key: string, value: any) => void;
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
}) {
|
}) {
|
||||||
const [twopass, setTwopass] = createSignal(false);
|
|
||||||
const defaultCrf =
|
|
||||||
props.codec?.shortName === "h264"
|
|
||||||
? information.h264.defaultCrf
|
|
||||||
: information.hevc.defaultCrf;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="commonLossyOptions">
|
<Switch fallback={<div class="text-center mt-4">No options.</div>}>
|
||||||
<div class="row flex-col align-items-center">
|
<Match
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
when={
|
||||||
</div>
|
props.encoder === "libx264" ||
|
||||||
<div class="k-form">
|
props.encoder === "libx264rgb" ||
|
||||||
<div></div>
|
props.encoder === "libx265"
|
||||||
<div class="checkbox-container">
|
}
|
||||||
<input
|
>
|
||||||
type="checkbox"
|
<LibH26xOptions {...props} />
|
||||||
value={props.params.twopass?.toString()}
|
</Match>
|
||||||
onInput={(e) => {
|
<Match
|
||||||
props.params.twopass = e.target.checked;
|
when={
|
||||||
props.onParamChanged("twopass", e.target.checked);
|
props.encoder === "h264_qsv" || props.encoder === "hevc_qsv"
|
||||||
setTwopass(e.target.checked);
|
}
|
||||||
}}
|
>
|
||||||
id="twopassCheck"
|
<H264QsvOptions {...props} />
|
||||||
/>
|
</Match>
|
||||||
<label for="twopassCheck">
|
</Switch>
|
||||||
Use target bitrate instead of CRF
|
|
||||||
</label>
|
|
||||||
<button
|
|
||||||
class="icon-button"
|
|
||||||
onclick={() =>
|
|
||||||
os.open(
|
|
||||||
"https://trac.ffmpeg.org/wiki/Encode/H.264#twopass",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
title="This will use the two-pass rate control mode instead of relying on a Constant Rate Factor (CRF) value."
|
|
||||||
>
|
|
||||||
<BreezeIcon icon="help-about" alt="Help" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<label for="encodingPreset">Preset</label>
|
|
||||||
<select
|
|
||||||
class="k-dropdown"
|
|
||||||
name="encodingPreset"
|
|
||||||
id="encodingPreset"
|
|
||||||
value={props.params.preset ?? "medium"}
|
|
||||||
oninput={(e) => {
|
|
||||||
props.params.preset = e.target.value;
|
|
||||||
props.onParamChanged("preset", e.target.value);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<option value="ultrafast">ultrafast</option>
|
|
||||||
<option value="superfast">superfast</option>
|
|
||||||
<option value="veryfast">veryfast</option>
|
|
||||||
<option value="faster">faster</option>
|
|
||||||
<option value="fast">fast</option>
|
|
||||||
<option value="medium">medium (Default)</option>
|
|
||||||
<option value="slow">slow</option>
|
|
||||||
<option value="slower">slower</option>
|
|
||||||
<option value="veryslow">veryslow</option>
|
|
||||||
<option
|
|
||||||
value="placebo"
|
|
||||||
title="Don't use this option, it rarely helps."
|
|
||||||
>
|
|
||||||
placebo
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<Show
|
|
||||||
when={twopass()}
|
|
||||||
fallback={
|
|
||||||
<>
|
|
||||||
<label for="crf">CRF</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
name="crf"
|
|
||||||
id="crf"
|
|
||||||
min="0"
|
|
||||||
max="51"
|
|
||||||
value={props.params.crf ?? defaultCrf}
|
|
||||||
oninput={(e) => {
|
|
||||||
props.params.crf = parseInt(e.target.value);
|
|
||||||
props.onParamChanged(
|
|
||||||
"crf",
|
|
||||||
parseInt(e.target.value),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<label for="bitrate">Bitrate</label>
|
|
||||||
<div>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
name="bitrate"
|
|
||||||
id="bitrate"
|
|
||||||
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
|
||||||
oninput={(e) => {
|
|
||||||
props.params.vbitrate = parseInt(
|
|
||||||
e.target.value,
|
|
||||||
);
|
|
||||||
props.onParamChanged(
|
|
||||||
"vbitrate",
|
|
||||||
parseInt(e.target.value),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<span> Kbps</span>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
<Show when={props.codec?.shortName === "h264"}>
|
|
||||||
<div></div>
|
|
||||||
<div class="checkbox-container">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
value={props.params.faststart?.toString()}
|
|
||||||
onInput={(e) => {
|
|
||||||
props.params.faststart = e.target.checked;
|
|
||||||
props.onParamChanged(
|
|
||||||
"faststart",
|
|
||||||
e.target.checked,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
id="fastStartCheck"
|
|
||||||
/>
|
|
||||||
<label for="fastStartCheck">Enable Fast Start</label>
|
|
||||||
<button
|
|
||||||
class="icon-button"
|
|
||||||
onclick={() =>
|
|
||||||
os.open(
|
|
||||||
"https://trac.ffmpeg.org/wiki/Encode/H.264#faststartforwebvideo",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
title="This will move some information to the beginning of your file and allow the video to begin playing before it is completely downloaded by the viewer, recommended for web videos. Click for more information."
|
|
||||||
>
|
|
||||||
<BreezeIcon icon="help-about" alt="Help" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
import { createSignal, Show } from "solid-js";
|
||||||
|
import {
|
||||||
|
DEFAULT_BITRATE,
|
||||||
|
type CodecInfo,
|
||||||
|
type FFmpegParams,
|
||||||
|
} from "../util/ffmpeg";
|
||||||
|
import { os } from "@neutralinojs/lib";
|
||||||
|
import BreezeIcon from "./BreezeIcon";
|
||||||
|
|
||||||
|
function VP9Options(props: {
|
||||||
|
codec: CodecInfo | undefined;
|
||||||
|
params: FFmpegParams;
|
||||||
|
onParamChanged: (key: string, value: any) => void;
|
||||||
|
}) {
|
||||||
|
const [twopass, setTwopass] = createSignal(false);
|
||||||
|
const defaultCrf = 30;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section id="commonLossyOptions" class="k-form">
|
||||||
|
<div></div>
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
value={props.params.twopass?.toString()}
|
||||||
|
onInput={(e) => {
|
||||||
|
props.params.twopass = e.target.checked;
|
||||||
|
props.onParamChanged("twopass", e.target.checked);
|
||||||
|
setTwopass(e.target.checked);
|
||||||
|
}}
|
||||||
|
id="twopassCheck"
|
||||||
|
/>
|
||||||
|
<label for="twopassCheck">
|
||||||
|
Use target bitrate instead of CRF
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
class="icon-button"
|
||||||
|
onclick={() =>
|
||||||
|
os.open(
|
||||||
|
"https://trac.ffmpeg.org/wiki/Encode/H.264#twopass",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
title="This will use the two-pass rate control mode instead of relying on a Constant Rate Factor (CRF) value."
|
||||||
|
>
|
||||||
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<label for="encodingPreset">Preset</label>
|
||||||
|
<select
|
||||||
|
class="k-dropdown"
|
||||||
|
name="encodingPreset"
|
||||||
|
id="encodingPreset"
|
||||||
|
value={props.params.preset ?? "medium"}
|
||||||
|
oninput={(e) => {
|
||||||
|
props.params.preset = e.target.value;
|
||||||
|
props.onParamChanged("preset", e.target.value);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<option value="ultrafast">ultrafast</option>
|
||||||
|
<option value="superfast">superfast</option>
|
||||||
|
<option value="veryfast">veryfast</option>
|
||||||
|
<option value="faster">faster</option>
|
||||||
|
<option value="fast">fast</option>
|
||||||
|
<option value="medium">medium (Default)</option>
|
||||||
|
<option value="slow">slow</option>
|
||||||
|
<option value="slower">slower</option>
|
||||||
|
<option value="veryslow">veryslow</option>
|
||||||
|
<option
|
||||||
|
value="placebo"
|
||||||
|
title="Don't use this option, it rarely helps."
|
||||||
|
>
|
||||||
|
placebo
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<Show
|
||||||
|
when={twopass()}
|
||||||
|
fallback={
|
||||||
|
<>
|
||||||
|
<label for="crf">CRF</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="crf"
|
||||||
|
id="crf"
|
||||||
|
min="0"
|
||||||
|
max="51"
|
||||||
|
value={props.params.crf ?? defaultCrf}
|
||||||
|
oninput={(e) => {
|
||||||
|
props.params.crf = parseInt(e.target.value);
|
||||||
|
props.onParamChanged(
|
||||||
|
"crf",
|
||||||
|
parseInt(e.target.value),
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<label for="bitrate">Bitrate</label>
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="bitrate"
|
||||||
|
id="bitrate"
|
||||||
|
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
||||||
|
oninput={(e) => {
|
||||||
|
props.params.vbitrate = parseInt(e.target.value);
|
||||||
|
props.onParamChanged(
|
||||||
|
"vbitrate",
|
||||||
|
parseInt(e.target.value),
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span> Kbps</span>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
<Show when={props.codec?.shortName === "h264"}>
|
||||||
|
<div></div>
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
value={props.params.faststart?.toString()}
|
||||||
|
onInput={(e) => {
|
||||||
|
props.params.faststart = e.target.checked;
|
||||||
|
props.onParamChanged("faststart", e.target.checked);
|
||||||
|
}}
|
||||||
|
id="fastStartCheck"
|
||||||
|
/>
|
||||||
|
<label for="fastStartCheck">Enable Fast Start</label>
|
||||||
|
<button
|
||||||
|
class="icon-button"
|
||||||
|
onclick={() =>
|
||||||
|
os.open(
|
||||||
|
"https://trac.ffmpeg.org/wiki/Encode/H.264#faststartforwebvideo",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
title="This will move some information to the beginning of your file and allow the video to begin playing before it is completely downloaded by the viewer, recommended for web videos. Click for more information."
|
||||||
|
>
|
||||||
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default VP9Options;
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
import {
|
||||||
|
DEFAULT_BITRATE,
|
||||||
|
type CodecInfo,
|
||||||
|
type FFmpegParamChangedFunc,
|
||||||
|
type FFmpegParams,
|
||||||
|
} from "@/util/ffmpeg";
|
||||||
|
import { createEffect, createSignal, onMount, Show } from "solid-js";
|
||||||
|
|
||||||
|
function H264QsvOptions({
|
||||||
|
onParamChanged,
|
||||||
|
}: {
|
||||||
|
codec: CodecInfo | undefined;
|
||||||
|
params: FFmpegParams;
|
||||||
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
|
}) {
|
||||||
|
const [rateControl, setRateControl] = createSignal("icq");
|
||||||
|
const [globalQuality, setGlobalQuality] = createSignal(18);
|
||||||
|
const [bitrate, setBitrate] = createSignal(DEFAULT_BITRATE);
|
||||||
|
const [cqp, setCqp] = createSignal(18);
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
const opts: Record<string, string> = {};
|
||||||
|
|
||||||
|
switch (rateControl()) {
|
||||||
|
case "icq":
|
||||||
|
onParamChanged("vbitrate", undefined);
|
||||||
|
const quality = globalQuality();
|
||||||
|
opts["global_quality"] = quality.toString();
|
||||||
|
break;
|
||||||
|
case "cbr":
|
||||||
|
onParamChanged("vbitrate", bitrate());
|
||||||
|
opts["maxrate"] = `${bitrate() ?? DEFAULT_BITRATE}k`;
|
||||||
|
break;
|
||||||
|
case "vbr":
|
||||||
|
onParamChanged("vbitrate", bitrate());
|
||||||
|
break;
|
||||||
|
case "cqp":
|
||||||
|
onParamChanged("vbitrate", undefined);
|
||||||
|
opts["q"] = cqp().toString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
onParamChanged("outputopts", opts);
|
||||||
|
});
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
onParamChanged("hwaccel", "qsv");
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section id="encoderOptions" class="k-form">
|
||||||
|
<label for="rateControl">Rate Control Mode</label>
|
||||||
|
<select
|
||||||
|
name="rateControl"
|
||||||
|
id="rateControl"
|
||||||
|
class="k-dropdown"
|
||||||
|
value={rateControl()}
|
||||||
|
oninput={(e) => setRateControl(e.target.value)}
|
||||||
|
>
|
||||||
|
<option value="cbr">CBR: Constant Bitrate</option>
|
||||||
|
<option value="cqp">
|
||||||
|
CQP: Constant Quantization Parameter
|
||||||
|
</option>
|
||||||
|
<option value="vbr">VBR: Variable Bitrate</option>
|
||||||
|
<option value="icq">ICQ: Intelligent Constant Quality</option>
|
||||||
|
</select>
|
||||||
|
<Show when={rateControl() === "icq"}>
|
||||||
|
<label for="globalQuality">Global Quality</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="globalQuality"
|
||||||
|
id="globalQuality"
|
||||||
|
min="1"
|
||||||
|
max="51"
|
||||||
|
value={globalQuality()}
|
||||||
|
oninput={(e) => setGlobalQuality(parseInt(e.target.value))}
|
||||||
|
/>
|
||||||
|
</Show>
|
||||||
|
<Show when={rateControl() === "cqp"}>
|
||||||
|
<label for="cqp">CQP</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="cqp"
|
||||||
|
id="cqp"
|
||||||
|
min="1"
|
||||||
|
max="51"
|
||||||
|
value={cqp()}
|
||||||
|
oninput={(e) => setCqp(parseInt(e.target.value))}
|
||||||
|
/>
|
||||||
|
</Show>
|
||||||
|
<Show when={rateControl() === "cbr" || rateControl() === "vbr"}>
|
||||||
|
<label for="bitrate">Bitrate</label>
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="bitrate"
|
||||||
|
id="bitrate"
|
||||||
|
value={bitrate()}
|
||||||
|
oninput={(e) => setBitrate(parseInt(e.target.value))}
|
||||||
|
/>
|
||||||
|
<span> Kbps</span>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
<Show when={rateControl() === "vbr" || rateControl() === "icq"}>
|
||||||
|
<div></div>
|
||||||
|
<div
|
||||||
|
class="checkbox-container"
|
||||||
|
title="May not be available on some platforms."
|
||||||
|
>
|
||||||
|
<input type="checkbox" name="lookAhead" id="lookAhead" />
|
||||||
|
<label for="lookAhead">Look-ahead mode</label>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default H264QsvOptions;
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
DEFAULT_BITRATE,
|
DEFAULT_BITRATE,
|
||||||
type CodecInfo,
|
type CodecInfo,
|
||||||
|
type FFmpegParamChangedFunc,
|
||||||
type FFmpegParams,
|
type FFmpegParams,
|
||||||
} from "@/util/ffmpeg";
|
} from "@/util/ffmpeg";
|
||||||
import { os } from "@neutralinojs/lib";
|
import { os } from "@neutralinojs/lib";
|
||||||
@@ -12,7 +13,7 @@ const DEFAULT_CRF = 23;
|
|||||||
function LibaomOptions(props: {
|
function LibaomOptions(props: {
|
||||||
codec: CodecInfo | undefined;
|
codec: CodecInfo | undefined;
|
||||||
params: FFmpegParams;
|
params: FFmpegParams;
|
||||||
onParamChanged: (key: string, value: any) => void;
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
}) {
|
}) {
|
||||||
const [rateControlMode, setRateControlMode] = createSignal("Constant");
|
const [rateControlMode, setRateControlMode] = createSignal("Constant");
|
||||||
|
|
||||||
@@ -45,79 +46,71 @@ function LibaomOptions(props: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="encoderOptions">
|
<section id="encoderOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
<label>Help</label>
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
<div>
|
||||||
</div>
|
<button
|
||||||
<div class="k-form">
|
class="icon-button"
|
||||||
<label>Help</label>
|
onclick={() =>
|
||||||
<div>
|
os.open(
|
||||||
<button
|
"https://trac.ffmpeg.org/wiki/Encode/AV1#libaom",
|
||||||
class="icon-button"
|
)
|
||||||
onclick={() =>
|
|
||||||
os.open(
|
|
||||||
"https://trac.ffmpeg.org/wiki/Encode/AV1#libaom",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
title="Click to view the documentation for this encoder."
|
|
||||||
>
|
|
||||||
<BreezeIcon icon="help-about" alt="Help" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<label for="rateControlMode">Rate-control modes</label>
|
|
||||||
<select
|
|
||||||
class="k-dropdown"
|
|
||||||
onchange={(e) => setRateControlMode(e.target.value)}
|
|
||||||
name="rateControlMode"
|
|
||||||
id="rateControlMode"
|
|
||||||
>
|
|
||||||
<option value="Constant">Constant Quality</option>
|
|
||||||
<option value="Constrained">Constrained Quality</option>
|
|
||||||
<option value="2PassABR">2-Pass Average Bitrate</option>
|
|
||||||
<option value="ABR">1-Pass Average Bitrate</option>
|
|
||||||
</select>
|
|
||||||
<Show
|
|
||||||
when={
|
|
||||||
rateControlMode() === "Constant" ||
|
|
||||||
rateControlMode() === "Constrained"
|
|
||||||
}
|
}
|
||||||
|
title="Click to view the documentation for this encoder."
|
||||||
>
|
>
|
||||||
<label for="crf">CRF</label>
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<label for="rateControlMode">Rate-control modes</label>
|
||||||
|
<select
|
||||||
|
class="k-dropdown"
|
||||||
|
onchange={(e) => setRateControlMode(e.target.value)}
|
||||||
|
name="rateControlMode"
|
||||||
|
id="rateControlMode"
|
||||||
|
>
|
||||||
|
<option value="Constant">Constant Quality</option>
|
||||||
|
<option value="Constrained">Constrained Quality</option>
|
||||||
|
<option value="2PassABR">2-Pass Average Bitrate</option>
|
||||||
|
<option value="ABR">1-Pass Average Bitrate</option>
|
||||||
|
</select>
|
||||||
|
<Show
|
||||||
|
when={
|
||||||
|
rateControlMode() === "Constant" ||
|
||||||
|
rateControlMode() === "Constrained"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<label for="crf">CRF</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="crf"
|
||||||
|
id="crf"
|
||||||
|
min="1"
|
||||||
|
max="63"
|
||||||
|
value={props.params.crf ?? DEFAULT_CRF}
|
||||||
|
oninput={(e) => {
|
||||||
|
props.onParamChanged("crf", parseInt(e.target.value));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Show>
|
||||||
|
<Show when={rateControlMode() !== "Constant"}>
|
||||||
|
<label for="bitrate">Bitrate</label>
|
||||||
|
<div class="row gap2 align-items-center">
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
name="crf"
|
name="bitrate"
|
||||||
id="crf"
|
id="bitrate"
|
||||||
min="1"
|
aria-label="Kbps"
|
||||||
max="63"
|
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
||||||
value={props.params.crf ?? DEFAULT_CRF}
|
|
||||||
oninput={(e) => {
|
oninput={(e) => {
|
||||||
props.onParamChanged(
|
props.onParamChanged(
|
||||||
"crf",
|
"vbitrate",
|
||||||
parseInt(e.target.value),
|
parseInt(e.target.value),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Show>
|
<span>Kbps</span>
|
||||||
<Show when={rateControlMode() !== "Constant"}>
|
</div>
|
||||||
<label for="bitrate">Bitrate</label>
|
</Show>
|
||||||
<div class="row gap2 align-items-center">
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
name="bitrate"
|
|
||||||
id="bitrate"
|
|
||||||
aria-label="Kbps"
|
|
||||||
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
|
||||||
oninput={(e) => {
|
|
||||||
props.onParamChanged(
|
|
||||||
"vbitrate",
|
|
||||||
parseInt(e.target.value),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<span>Kbps</span>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
DEFAULT_BITRATE,
|
DEFAULT_BITRATE,
|
||||||
type CodecInfo,
|
type CodecInfo,
|
||||||
|
type FFmpegParamChangedFunc,
|
||||||
type FFmpegParams,
|
type FFmpegParams,
|
||||||
} from "@/util/ffmpeg";
|
} from "@/util/ffmpeg";
|
||||||
import { os } from "@neutralinojs/lib";
|
import { os } from "@neutralinojs/lib";
|
||||||
@@ -10,10 +11,9 @@ import { onMount } from "solid-js";
|
|||||||
function Librav1eOptions(props: {
|
function Librav1eOptions(props: {
|
||||||
codec: CodecInfo | undefined;
|
codec: CodecInfo | undefined;
|
||||||
params: FFmpegParams;
|
params: FFmpegParams;
|
||||||
onParamChanged: (key: string, value: any) => void;
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
}) {
|
}) {
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
props.onParamChanged("crf", undefined);
|
|
||||||
props.onParamChanged(
|
props.onParamChanged(
|
||||||
"vbitrate",
|
"vbitrate",
|
||||||
props.params.vbitrate ?? DEFAULT_BITRATE,
|
props.params.vbitrate ?? DEFAULT_BITRATE,
|
||||||
@@ -22,50 +22,48 @@ function Librav1eOptions(props: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="encoderOptions">
|
<section id="encoderOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
<label>Help</label>
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon-button"
|
||||||
|
onclick={() =>
|
||||||
|
os.open(
|
||||||
|
"https://www.ffmpeg.org/ffmpeg-all.html#librav1e",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
title="Click to view the documentation for this encoder."
|
||||||
|
>
|
||||||
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="k-form">
|
<label>Speed</label>
|
||||||
<label>Help</label>
|
<input
|
||||||
<div>
|
type="number"
|
||||||
<button
|
name="speed"
|
||||||
class="icon-button"
|
id="speed"
|
||||||
onclick={() =>
|
min="0"
|
||||||
os.open(
|
max="10"
|
||||||
"https://www.ffmpeg.org/ffmpeg-all.html#librav1e",
|
value={props.params.speed ?? 5}
|
||||||
)
|
oninput={(e) =>
|
||||||
}
|
props.onParamChanged("speed", parseInt(e.target.value))
|
||||||
title="Click to view the documentation for this encoder."
|
}
|
||||||
>
|
/>
|
||||||
<BreezeIcon icon="help-about" alt="Help" />
|
<label for="bitrate">Bitrate</label>
|
||||||
</button>
|
<div class="row gap2 align-items-center">
|
||||||
</div>
|
|
||||||
<label>Speed</label>
|
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
name="speed"
|
name="bitrate"
|
||||||
id="speed"
|
id="bitrate"
|
||||||
min="0"
|
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
||||||
max="10"
|
|
||||||
value={props.params.speed ?? 5}
|
|
||||||
oninput={(e) =>
|
oninput={(e) =>
|
||||||
props.onParamChanged("speed", e.target.value)
|
props.onParamChanged(
|
||||||
|
"vbitrate",
|
||||||
|
parseInt(e.target.value),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<label for="bitrate">Bitrate</label>
|
<span>Kbps</span>
|
||||||
<div class="row gap2 align-items-center">
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
name="bitrate"
|
|
||||||
id="bitrate"
|
|
||||||
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
|
||||||
oninput={(e) =>
|
|
||||||
props.onParamChanged("vbitrate", e.target.value)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<span>Kbps</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,109 @@
|
|||||||
|
import {
|
||||||
|
type CodecInfo,
|
||||||
|
type FFmpegParamChangedFunc,
|
||||||
|
type FFmpegParams,
|
||||||
|
} from "@/util/ffmpeg";
|
||||||
|
import { os } from "@neutralinojs/lib";
|
||||||
|
import BreezeIcon from "@/components/BreezeIcon";
|
||||||
|
import { createEffect, createSignal } from "solid-js";
|
||||||
|
|
||||||
|
function LibSvtAv1Options({
|
||||||
|
params,
|
||||||
|
onParamChanged,
|
||||||
|
}: {
|
||||||
|
codec: CodecInfo | undefined;
|
||||||
|
params: FFmpegParams;
|
||||||
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
|
}) {
|
||||||
|
const [gop, setGop] = createSignal("-1");
|
||||||
|
const [filmGrain, setFilmGrain] = createSignal("0");
|
||||||
|
const [tune, setTune] = createSignal("1");
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
const g = gop();
|
||||||
|
const params = [`tune=${tune()}`];
|
||||||
|
|
||||||
|
if (filmGrain() !== "0") {
|
||||||
|
params.push(`film-grain=${filmGrain()}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
onParamChanged("outputopts", {
|
||||||
|
g: g === "-1" ? undefined : g,
|
||||||
|
"svtav1-params": params.join(":"),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section id="encoderOptions" class="k-form">
|
||||||
|
<label>Help</label>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon-button"
|
||||||
|
onclick={() =>
|
||||||
|
os.open(
|
||||||
|
"https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Ffmpeg.md",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
title="Click to view the documentation for this encoder."
|
||||||
|
>
|
||||||
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<label for="preset">Preset</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="preset"
|
||||||
|
id="preset"
|
||||||
|
title="A range from -2 to 13. Higher means faster but a loss in quality. Preset 13 is not intended for human use."
|
||||||
|
value={params.preset ?? 5}
|
||||||
|
oninput={(e) => onParamChanged("preset", e.target.value)}
|
||||||
|
min="-2"
|
||||||
|
max="13"
|
||||||
|
/>
|
||||||
|
<label for="crf">CRF</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="crf"
|
||||||
|
id="crf"
|
||||||
|
title="A range from 1 to 63. A good starting point for a 1080p video is 30"
|
||||||
|
value={params.crf ?? 30}
|
||||||
|
oninput={(e) => onParamChanged("crf", parseInt(e.target.value))}
|
||||||
|
min="1"
|
||||||
|
max="63"
|
||||||
|
/>
|
||||||
|
<label for="gop">GOP</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="gop"
|
||||||
|
id="gop"
|
||||||
|
title="How many frames will pass before the encoder will add a key frame. Specify -1 to leave the parameter unspecified."
|
||||||
|
value={gop()}
|
||||||
|
oninput={(e) => setGop(e.target.value)}
|
||||||
|
min="-1"
|
||||||
|
/>
|
||||||
|
<label for="filmGrain">Film Grain</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="filmGrain"
|
||||||
|
id="filmGrain"
|
||||||
|
title="Film grains are hard to compress. The encoder can try to replace the film grain in the video with a synthetic grain."
|
||||||
|
value={filmGrain()}
|
||||||
|
oninput={(e) => setFilmGrain(e.target.value)}
|
||||||
|
min="0"
|
||||||
|
/>
|
||||||
|
<label for="tune">Tune</label>
|
||||||
|
<select
|
||||||
|
name="tune"
|
||||||
|
id="tune"
|
||||||
|
class="k-dropdown"
|
||||||
|
value={tune()}
|
||||||
|
oninput={(e) => setTune(e.target.value)}
|
||||||
|
>
|
||||||
|
<option value="0">Subjective Quality</option>
|
||||||
|
<option value="1">Objective Quality (PSNR)</option>
|
||||||
|
</select>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LibSvtAv1Options;
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
import { createSignal, Show } from "solid-js";
|
||||||
|
import {
|
||||||
|
DEFAULT_BITRATE,
|
||||||
|
type CodecInfo,
|
||||||
|
type FFmpegParamChangedFunc,
|
||||||
|
type FFmpegParams,
|
||||||
|
} from "@/util/ffmpeg";
|
||||||
|
import { os } from "@neutralinojs/lib";
|
||||||
|
import BreezeIcon from "@/components/BreezeIcon";
|
||||||
|
|
||||||
|
const information = {
|
||||||
|
h264: {
|
||||||
|
defaultCrf: 23,
|
||||||
|
},
|
||||||
|
hevc: {
|
||||||
|
defaultCrf: 28,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for H.264/H.265 codecs
|
||||||
|
*/
|
||||||
|
function LibH26xOptions(props: {
|
||||||
|
codec: CodecInfo | undefined;
|
||||||
|
params: FFmpegParams;
|
||||||
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
|
}) {
|
||||||
|
const [twopass, setTwopass] = createSignal(false);
|
||||||
|
const defaultCrf =
|
||||||
|
props.codec?.shortName === "h264"
|
||||||
|
? information.h264.defaultCrf
|
||||||
|
: information.hevc.defaultCrf;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section id="commonLossyOptions" class="k-form">
|
||||||
|
<div></div>
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
value={props.params.twopass?.toString()}
|
||||||
|
onInput={(e) => {
|
||||||
|
props.params.twopass = e.target.checked;
|
||||||
|
props.onParamChanged("twopass", e.target.checked);
|
||||||
|
setTwopass(e.target.checked);
|
||||||
|
}}
|
||||||
|
id="twopassCheck"
|
||||||
|
/>
|
||||||
|
<label for="twopassCheck">
|
||||||
|
Use target bitrate instead of CRF
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
class="icon-button"
|
||||||
|
onclick={() =>
|
||||||
|
os.open(
|
||||||
|
"https://trac.ffmpeg.org/wiki/Encode/H.264#twopass",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
title="This will use the two-pass rate control mode instead of relying on a Constant Rate Factor (CRF) value."
|
||||||
|
>
|
||||||
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<label for="encodingPreset">Preset</label>
|
||||||
|
<select
|
||||||
|
class="k-dropdown"
|
||||||
|
name="encodingPreset"
|
||||||
|
id="encodingPreset"
|
||||||
|
value={props.params.preset ?? "medium"}
|
||||||
|
oninput={(e) => {
|
||||||
|
props.params.preset = e.target.value;
|
||||||
|
props.onParamChanged("preset", e.target.value);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<option value="ultrafast">ultrafast</option>
|
||||||
|
<option value="superfast">superfast</option>
|
||||||
|
<option value="veryfast">veryfast</option>
|
||||||
|
<option value="faster">faster</option>
|
||||||
|
<option value="fast">fast</option>
|
||||||
|
<option value="medium">medium (Default)</option>
|
||||||
|
<option value="slow">slow</option>
|
||||||
|
<option value="slower">slower</option>
|
||||||
|
<option value="veryslow">veryslow</option>
|
||||||
|
<option
|
||||||
|
value="placebo"
|
||||||
|
title="Don't use this option, it rarely helps."
|
||||||
|
>
|
||||||
|
placebo
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<Show
|
||||||
|
when={twopass()}
|
||||||
|
fallback={
|
||||||
|
<>
|
||||||
|
<label for="crf">CRF</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="crf"
|
||||||
|
id="crf"
|
||||||
|
min="0"
|
||||||
|
max="51"
|
||||||
|
value={props.params.crf ?? defaultCrf}
|
||||||
|
oninput={(e) => {
|
||||||
|
props.params.crf = parseInt(e.target.value);
|
||||||
|
props.onParamChanged(
|
||||||
|
"crf",
|
||||||
|
parseInt(e.target.value),
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<label for="bitrate">Bitrate</label>
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="bitrate"
|
||||||
|
id="bitrate"
|
||||||
|
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
||||||
|
oninput={(e) =>
|
||||||
|
props.onParamChanged(
|
||||||
|
"vbitrate",
|
||||||
|
parseInt(e.target.value),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span> Kbps</span>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
<Show when={props.codec?.shortName === "h264"}>
|
||||||
|
<div></div>
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
value={props.params.faststart?.toString()}
|
||||||
|
onInput={(e) => {
|
||||||
|
props.params.faststart = e.target.checked;
|
||||||
|
props.onParamChanged("faststart", e.target.checked);
|
||||||
|
}}
|
||||||
|
id="fastStartCheck"
|
||||||
|
/>
|
||||||
|
<label for="fastStartCheck">Enable Fast Start</label>
|
||||||
|
<button
|
||||||
|
class="icon-button"
|
||||||
|
onclick={() =>
|
||||||
|
os.open(
|
||||||
|
"https://trac.ffmpeg.org/wiki/Encode/H.264#faststartforwebvideo",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
title="This will move some information to the beginning of your file and allow the video to begin playing before it is completely downloaded by the viewer, recommended for web videos. Click for more information."
|
||||||
|
>
|
||||||
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LibH26xOptions;
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
/* An attempt of imitating KDE's Kirigami UI Framework */
|
/* An attempt of imitating KDE's Kirigami UI Framework */
|
||||||
|
|
||||||
|
@reference "./index.css";
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--k-grid-unit: 16px;
|
--k-grid-unit: 16px;
|
||||||
--k-small-spacing: 4px;
|
--k-small-spacing: 4px;
|
||||||
@@ -97,6 +99,7 @@ button {
|
|||||||
border-radius: var(--k-border-radius);
|
border-radius: var(--k-border-radius);
|
||||||
box-shadow: var(--k-border-color) 0 1px;
|
box-shadow: var(--k-border-color) 0 1px;
|
||||||
background-color: var(--k-primary-highlight);
|
background-color: var(--k-primary-highlight);
|
||||||
|
padding: 2px 6px;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -123,6 +126,7 @@ button {
|
|||||||
padding: var(--k-small-spacing) calc(var(--k-medium-spacing) + 12px)
|
padding: var(--k-small-spacing) calc(var(--k-medium-spacing) + 12px)
|
||||||
var(--k-small-spacing) var(--k-medium-spacing);
|
var(--k-small-spacing) var(--k-medium-spacing);
|
||||||
border: 1px solid var(--k-border-color);
|
border: 1px solid var(--k-border-color);
|
||||||
|
border-radius: var(--k-border-radius);
|
||||||
box-shadow: var(--k-border-color) 0 1px;
|
box-shadow: var(--k-border-color) 0 1px;
|
||||||
max-width: 16em;
|
max-width: 16em;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
@@ -177,6 +181,7 @@ input[type="number"] {
|
|||||||
border-bottom: 1px solid var(--k-border-color);
|
border-bottom: 1px solid var(--k-border-color);
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
margin-bottom: var(--k-medium-spacing);
|
margin-bottom: var(--k-medium-spacing);
|
||||||
|
@apply text-xl font-bold mt-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.k-page-footer {
|
.k-page-footer {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
--system-accent-color: accentcolor;
|
--system-accent-color: accentcolor;
|
||||||
@@ -102,3 +104,7 @@ h2 {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progress {
|
||||||
|
accent-color: var(--system-accent-color);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { getVencoderFolder } from "@/util/path";
|
import { openFile } from "@/util/oshelper";
|
||||||
|
import { getTemporaryFilePath, getVencoderFolder } from "@/util/path";
|
||||||
|
import { generateRandomString } from "@/util/string";
|
||||||
import { events, os, storage, type SpawnedProcess } from "@neutralinojs/lib";
|
import { events, os, storage, type SpawnedProcess } from "@neutralinojs/lib";
|
||||||
import { createSignal, onMount, onCleanup, Show, Index } from "solid-js";
|
import { createSignal, onMount, onCleanup, Show } from "solid-js";
|
||||||
|
|
||||||
interface TargetFile {
|
interface TargetFile {
|
||||||
id: string;
|
com: string;
|
||||||
in: string;
|
in: string;
|
||||||
len: number;
|
len: number;
|
||||||
}
|
}
|
||||||
@@ -32,13 +34,19 @@ function ProgressPage() {
|
|||||||
const [runningProcesses, setRunningProcesses] = createSignal<
|
const [runningProcesses, setRunningProcesses] = createSignal<
|
||||||
SpawnedProcess[]
|
SpawnedProcess[]
|
||||||
>([]);
|
>([]);
|
||||||
|
const [queueLength, setQueueLength] = createSignal(0);
|
||||||
const [finished, setFinished] = createSignal(false);
|
const [finished, setFinished] = createSignal(false);
|
||||||
const [fileInfo, setFileInfo] = createSignal<TargetFile[]>([]);
|
|
||||||
const progressObject: {
|
const progressObject: {
|
||||||
[key: string]: ProgressInfo;
|
[key: string]: ProgressInfo;
|
||||||
} = {};
|
} = {};
|
||||||
const [progressList, setProgressList] = createSignal<ProgressInfo[]>([]);
|
const [progressList, setProgressList] = createSignal<ProgressInfo[]>([]);
|
||||||
const [isCancelling, setIsCancelling] = createSignal(false);
|
const [isCancelling, setIsCancelling] = createSignal(false);
|
||||||
|
const filesBeingProcessed: Record<number, TargetFile> = {};
|
||||||
|
const logs: { [id: number]: string[] } = {};
|
||||||
|
let fileQueue: TargetFile[] = [];
|
||||||
|
let successfulCount = 0;
|
||||||
|
let unsuccessfulCount = 0;
|
||||||
|
let totalCount = 0;
|
||||||
|
|
||||||
function windowIsFocused() {
|
function windowIsFocused() {
|
||||||
setWindowFocused(false);
|
setWindowFocused(false);
|
||||||
@@ -48,6 +56,26 @@ function ProgressPage() {
|
|||||||
setWindowFocused(true);
|
setWindowFocused(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function processFiles(files: TargetFile[]) {
|
||||||
|
const processes = [];
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const proc = await os.spawnProcess(file.com);
|
||||||
|
|
||||||
|
logs[proc.id] = [];
|
||||||
|
processes.push(proc);
|
||||||
|
|
||||||
|
progressObject[proc.id] = {
|
||||||
|
filename: file.in,
|
||||||
|
percentage: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
filesBeingProcessed[proc.id] = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
setRunningProcesses(processes);
|
||||||
|
}
|
||||||
|
|
||||||
function handleSpawnedProcessEvents(evt: CustomEvent) {
|
function handleSpawnedProcessEvents(evt: CustomEvent) {
|
||||||
switch (evt.detail.action) {
|
switch (evt.detail.action) {
|
||||||
case "stdOut":
|
case "stdOut":
|
||||||
@@ -56,14 +84,12 @@ function ProgressPage() {
|
|||||||
.split("\n")
|
.split("\n")
|
||||||
.map((v) => v.split("=")),
|
.map((v) => v.split("=")),
|
||||||
);
|
);
|
||||||
const file = fileInfo().find((v) => v.id === evt.detail.id);
|
const file = filesBeingProcessed[evt.detail.id];
|
||||||
|
|
||||||
if (file === undefined) return;
|
if (file === undefined) return;
|
||||||
|
|
||||||
progressObject[evt.detail.id] = {
|
progressObject[evt.detail.id].percentage =
|
||||||
filename: file.in,
|
(parseInt(info.out_time_us) / file.len) * 100;
|
||||||
percentage: (parseInt(info.out_time_us) / file.len) * 100,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Number.isNaN(progressObject[evt.detail.id].percentage)) {
|
if (Number.isNaN(progressObject[evt.detail.id].percentage)) {
|
||||||
progressObject[evt.detail.id].percentage = 0;
|
progressObject[evt.detail.id].percentage = 0;
|
||||||
@@ -72,17 +98,55 @@ function ProgressPage() {
|
|||||||
setProgressList(Object.values(progressObject));
|
setProgressList(Object.values(progressObject));
|
||||||
break;
|
break;
|
||||||
case "stdErr":
|
case "stdErr":
|
||||||
|
logs[evt.detail.id].push(evt.detail.data);
|
||||||
break;
|
break;
|
||||||
case "exit":
|
case "exit":
|
||||||
console.log(`FFmpeg exited with code: ${evt.detail.data}`);
|
console.log(`FFmpeg exited with code: ${evt.detail.data}`);
|
||||||
|
|
||||||
os.getSpawnedProcesses().then((processes) => {
|
if (evt.detail.data === 0) {
|
||||||
if (processes.length === 0) {
|
progressObject[evt.detail.id].percentage = 100;
|
||||||
setFinished(true);
|
setProgressList(Object.values(progressObject));
|
||||||
}
|
successfulCount += 1;
|
||||||
|
} else {
|
||||||
|
unsuccessfulCount += 1;
|
||||||
|
|
||||||
setRunningProcesses(processes);
|
// If the exit code isn't 255 (the exit code of the program exiting because of cancellation)
|
||||||
});
|
if (evt.detail.data !== 255) {
|
||||||
|
Neutralino.os.showNotification(
|
||||||
|
"File Encoding Failed",
|
||||||
|
`Encoding for file "${filesBeingProcessed[evt.detail.id].in}" failed. Exit code ${evt.detail.data}.`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const tempFilename = `${getTemporaryFilePath()}/vencoder-ffmpeg-${generateRandomString(8)}.log`;
|
||||||
|
Neutralino.filesystem.writeFile(
|
||||||
|
tempFilename,
|
||||||
|
logs[evt.detail.id].join("\n"),
|
||||||
|
);
|
||||||
|
openFile(tempFilename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (successfulCount + unsuccessfulCount === totalCount) {
|
||||||
|
os.showNotification(
|
||||||
|
"File(s) encoded.",
|
||||||
|
`${successfulCount} files encoded successfully. ${unsuccessfulCount} failed or cancelled.`,
|
||||||
|
);
|
||||||
|
successfulCount = 0;
|
||||||
|
unsuccessfulCount = 0;
|
||||||
|
totalCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finished()) return;
|
||||||
|
|
||||||
|
const nextFile = fileQueue.pop();
|
||||||
|
|
||||||
|
if (nextFile === undefined) {
|
||||||
|
setFinished(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
processFiles([nextFile]);
|
||||||
|
setQueueLength(fileQueue.length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,20 +156,16 @@ function ProgressPage() {
|
|||||||
events.on("windowBlur", windowUnfocused);
|
events.on("windowBlur", windowUnfocused);
|
||||||
events.on("spawnedProcess", handleSpawnedProcessEvents);
|
events.on("spawnedProcess", handleSpawnedProcessEvents);
|
||||||
|
|
||||||
const processes = await os.getSpawnedProcesses();
|
|
||||||
setRunningProcesses(processes);
|
|
||||||
|
|
||||||
const storedFileInfo: TargetFile[] = JSON.parse(
|
const storedFileInfo: TargetFile[] = JSON.parse(
|
||||||
await storage.getData("filesBeingProcessed"),
|
await storage.getData("filesBeingProcessed"),
|
||||||
);
|
);
|
||||||
setFileInfo(storedFileInfo);
|
totalCount = storedFileInfo.length;
|
||||||
|
|
||||||
for (let i = 0; i < processes.length; i++) {
|
const file = storedFileInfo.pop()!;
|
||||||
progressObject[processes[i].id] = {
|
|
||||||
filename: storedFileInfo[i].in,
|
processFiles([file]);
|
||||||
percentage: 0,
|
fileQueue = storedFileInfo;
|
||||||
};
|
setQueueLength(fileQueue.length);
|
||||||
}
|
|
||||||
|
|
||||||
setProgressList(Object.values(progressObject));
|
setProgressList(Object.values(progressObject));
|
||||||
});
|
});
|
||||||
@@ -157,15 +217,15 @@ function ProgressPage() {
|
|||||||
<Show when={finished()}>
|
<Show when={finished()}>
|
||||||
Processes finished. You can close this window.
|
Processes finished. You can close this window.
|
||||||
</Show>
|
</Show>
|
||||||
<Index each={progressList()}>
|
{progressList().map((item) => {
|
||||||
{(item, _) => (
|
return (
|
||||||
<div
|
<div
|
||||||
class="row flex-col"
|
class="row flex-col"
|
||||||
style={{
|
style={{
|
||||||
"padding-bottom": "var(--k-grid-unit)",
|
"padding-bottom": "var(--k-grid-unit)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<label>{item().filename}</label>
|
<label>{item.filename}</label>
|
||||||
<div
|
<div
|
||||||
class="grid"
|
class="grid"
|
||||||
style={{
|
style={{
|
||||||
@@ -175,21 +235,22 @@ function ProgressPage() {
|
|||||||
<div class="row justify-content-center align-items-center">
|
<div class="row justify-content-center align-items-center">
|
||||||
<progress
|
<progress
|
||||||
class="col"
|
class="col"
|
||||||
value={item().percentage}
|
value={item.percentage}
|
||||||
max="100"
|
max="100"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center align-items-center">
|
<div class="row justify-content-center align-items-center">
|
||||||
{Math.min(
|
{Math.min(
|
||||||
Math.round(item().percentage),
|
Math.round(item.percentage),
|
||||||
100,
|
100,
|
||||||
)}
|
)}
|
||||||
%
|
%
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
);
|
||||||
</Index>
|
})}
|
||||||
|
<div>{queueLength()} file(s) queued.</div>
|
||||||
</div>
|
</div>
|
||||||
<footer class="p-medium row" style={{ "align-items": "end" }}>
|
<footer class="p-medium row" style={{ "align-items": "end" }}>
|
||||||
<Show
|
<Show
|
||||||
|
|||||||
@@ -144,9 +144,11 @@ export interface FFmpegParams {
|
|||||||
/**
|
/**
|
||||||
* Extra output parameters defined by Vencoder
|
* Extra output parameters defined by Vencoder
|
||||||
*/
|
*/
|
||||||
outputopts?: { [key: string]: string };
|
outputopts?: { [key: string]: string | undefined };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type FFmpegParamChangedFunc = <K extends keyof FFmpegParams>(key: K, value: FFmpegParams[K]) => void;
|
||||||
|
|
||||||
const NULL_LOCATION = window.NL_OS === "Windows" ? "NUL" : "/dev/null";
|
const NULL_LOCATION = window.NL_OS === "Windows" ? "NUL" : "/dev/null";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,7 +171,7 @@ export function generateOutputCommand(params: FFmpegParams) {
|
|||||||
? " -movflags +faststart"
|
? " -movflags +faststart"
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
let globalopts = "-hwaccel auto -y";
|
let globalopts = `-hwaccel ${params.hwaccel ?? "auto"} -y`;
|
||||||
let inputopts =
|
let inputopts =
|
||||||
params.useropts.input !== "" ? " " + params.useropts.input : "";
|
params.useropts.input !== "" ? " " + params.useropts.input : "";
|
||||||
let outputopts =
|
let outputopts =
|
||||||
@@ -191,6 +193,8 @@ export function generateOutputCommand(params: FFmpegParams) {
|
|||||||
|
|
||||||
if (params.outputopts !== undefined) {
|
if (params.outputopts !== undefined) {
|
||||||
for (const key of Object.keys(params.outputopts)) {
|
for (const key of Object.keys(params.outputopts)) {
|
||||||
|
if (params.outputopts[key] === undefined) continue;
|
||||||
|
|
||||||
outputopts += ` -${key} ${params.outputopts[key]}`.trimEnd();
|
outputopts += ` -${key} ${params.outputopts[key]}`.trimEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +220,7 @@ ffmpeg ${commonOpts} ${params.vcodec === "hevc" ? "-x265-params pass=2" : "-pass
|
|||||||
}
|
}
|
||||||
|
|
||||||
return `ffmpeg ${globalopts}${inputopts} -i "${params.inputFile ?? "{fileName}"}" -c:v ${params.encoder ?? params.vcodec}${params.crf === undefined ? "" : ` -crf ${params.crf}`
|
return `ffmpeg ${globalopts}${inputopts} -i "${params.inputFile ?? "{fileName}"}" -c:v ${params.encoder ?? params.vcodec}${params.crf === undefined ? "" : ` -crf ${params.crf}`
|
||||||
}${params.vbitrate === undefined ? "" : ` -b:v ${params.vbitrate}`
|
}${params.vbitrate === undefined ? "" : ` -b:v ${params.vbitrate}k`
|
||||||
}${faststart}${params.preset === undefined ? "" : ` -preset ${params.preset}`
|
}${faststart}${params.preset === undefined ? "" : ` -preset ${params.preset}`
|
||||||
} -c:a ${params.acodec ?? "copy"}${params.abitrate === undefined ? "" : ` -b:a ${params.abitrate}k`
|
} -c:a ${params.acodec ?? "copy"}${params.abitrate === undefined ? "" : ` -b:a ${params.abitrate}k`
|
||||||
}${params.speed === undefined ? "" : ` -speed ${params.speed}`
|
}${params.speed === undefined ? "" : ` -speed ${params.speed}`
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { fileURLToPath, URL } from "node:url";
|
import { fileURLToPath, URL } from "node:url";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import solid from "vite-plugin-solid";
|
import solid from "vite-plugin-solid";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [solid()],
|
plugins: [solid(), tailwindcss()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
|
|||||||
Reference in New Issue
Block a user