@@ -59,19 +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_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_vaapi
|
- [ ] h265_vaapi
|
||||||
- [ ] h264_vulkan
|
- [ ] h265_vulkan
|
||||||
- [ ] VP8
|
|
||||||
- [ ] libvpx
|
|
||||||
- [ ] vp8_vaapi
|
|
||||||
- [ ] VP9
|
- [ ] VP9
|
||||||
- [ ] libvpx-vp9
|
- [ ] libvpx-vp9
|
||||||
- [ ] vp9_vaapi
|
- [ ] vp9_vaapi
|
||||||
|
|||||||
+22
-14
@@ -31,7 +31,7 @@ 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 RunningProcessInfo {
|
||||||
process: Neutralino.SpawnedProcess;
|
process: Neutralino.SpawnedProcess;
|
||||||
@@ -212,27 +212,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();
|
||||||
@@ -581,7 +579,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" ||
|
||||||
@@ -590,6 +597,7 @@ function App() {
|
|||||||
>
|
>
|
||||||
<H264Options
|
<H264Options
|
||||||
codec={selectedCodec()}
|
codec={selectedCodec()}
|
||||||
|
encoder={selectedEncoder()}
|
||||||
params={ffmpegParams}
|
params={ffmpegParams}
|
||||||
onParamChanged={onParametersChanged}
|
onParamChanged={onParametersChanged}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -15,18 +15,12 @@ function DNxHDOptions(props: {
|
|||||||
onParamChanged: FFmpegParamChangedFunc;
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<section id="commonLossyOptions">
|
<section id="commonLossyOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
|
||||||
</div>
|
|
||||||
<div class="k-form">
|
|
||||||
<label>Help</label>
|
<label>Help</label>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
class="icon-button"
|
class="icon-button"
|
||||||
onclick={() =>
|
onclick={() => os.open("https://askubuntu.com/a/907515")}
|
||||||
os.open("https://askubuntu.com/a/907515")
|
|
||||||
}
|
|
||||||
title="DNxHD is a picky encoder."
|
title="DNxHD is a picky encoder."
|
||||||
>
|
>
|
||||||
<BreezeIcon icon="help-about" alt="Help" />
|
<BreezeIcon icon="help-about" alt="Help" />
|
||||||
@@ -51,7 +45,6 @@ function DNxHDOptions(props: {
|
|||||||
<option value="dnxhr_sq">DNxHR SQ</option>
|
<option value="dnxhr_sq">DNxHR SQ</option>
|
||||||
<option value="dnxhr_lb">DNxHR LB</option>
|
<option value="dnxhr_lb">DNxHR LB</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,170 +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 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: FFmpegParamChangedFunc;
|
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"
|
|
||||||
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>
|
<LibH26xOptions {...props} />
|
||||||
<div>
|
</Match>
|
||||||
<input
|
<Match
|
||||||
type="number"
|
when={
|
||||||
name="bitrate"
|
props.encoder === "h264_qsv" || props.encoder === "hevc_qsv"
|
||||||
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" />
|
<H264QsvOptions {...props} />
|
||||||
</button>
|
</Match>
|
||||||
</div>
|
</Switch>
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,7 @@ function VP9Options(props: {
|
|||||||
const defaultCrf = 30;
|
const defaultCrf = 30;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="commonLossyOptions">
|
<section id="commonLossyOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
|
||||||
</div>
|
|
||||||
<div class="k-form">
|
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="checkbox-container">
|
<div class="checkbox-container">
|
||||||
<input
|
<input
|
||||||
@@ -106,9 +102,7 @@ function VP9Options(props: {
|
|||||||
id="bitrate"
|
id="bitrate"
|
||||||
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
value={props.params.vbitrate ?? DEFAULT_BITRATE}
|
||||||
oninput={(e) => {
|
oninput={(e) => {
|
||||||
props.params.vbitrate = parseInt(
|
props.params.vbitrate = parseInt(e.target.value);
|
||||||
e.target.value,
|
|
||||||
);
|
|
||||||
props.onParamChanged(
|
props.onParamChanged(
|
||||||
"vbitrate",
|
"vbitrate",
|
||||||
parseInt(e.target.value),
|
parseInt(e.target.value),
|
||||||
@@ -126,10 +120,7 @@ function VP9Options(props: {
|
|||||||
value={props.params.faststart?.toString()}
|
value={props.params.faststart?.toString()}
|
||||||
onInput={(e) => {
|
onInput={(e) => {
|
||||||
props.params.faststart = e.target.checked;
|
props.params.faststart = e.target.checked;
|
||||||
props.onParamChanged(
|
props.onParamChanged("faststart", e.target.checked);
|
||||||
"faststart",
|
|
||||||
e.target.checked,
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
id="fastStartCheck"
|
id="fastStartCheck"
|
||||||
/>
|
/>
|
||||||
@@ -147,7 +138,6 @@ function VP9Options(props: {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -46,11 +46,7 @@ function LibaomOptions(props: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="encoderOptions">
|
<section id="encoderOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
|
||||||
</div>
|
|
||||||
<div class="k-form">
|
|
||||||
<label>Help</label>
|
<label>Help</label>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
@@ -92,10 +88,7 @@ function LibaomOptions(props: {
|
|||||||
max="63"
|
max="63"
|
||||||
value={props.params.crf ?? DEFAULT_CRF}
|
value={props.params.crf ?? DEFAULT_CRF}
|
||||||
oninput={(e) => {
|
oninput={(e) => {
|
||||||
props.onParamChanged(
|
props.onParamChanged("crf", parseInt(e.target.value));
|
||||||
"crf",
|
|
||||||
parseInt(e.target.value),
|
|
||||||
);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Show>
|
</Show>
|
||||||
@@ -118,7 +111,6 @@ function LibaomOptions(props: {
|
|||||||
<span>Kbps</span>
|
<span>Kbps</span>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ function Librav1eOptions(props: {
|
|||||||
onParamChanged: FFmpegParamChangedFunc;
|
onParamChanged: FFmpegParamChangedFunc;
|
||||||
}) {
|
}) {
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
props.onParamChanged("crf", undefined);
|
|
||||||
props.onParamChanged(
|
props.onParamChanged(
|
||||||
"vbitrate",
|
"vbitrate",
|
||||||
props.params.vbitrate ?? DEFAULT_BITRATE,
|
props.params.vbitrate ?? DEFAULT_BITRATE,
|
||||||
@@ -23,11 +22,7 @@ function Librav1eOptions(props: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="encoderOptions">
|
<section id="encoderOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
|
||||||
</div>
|
|
||||||
<div class="k-form">
|
|
||||||
<label>Help</label>
|
<label>Help</label>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
@@ -70,7 +65,6 @@ function Librav1eOptions(props: {
|
|||||||
/>
|
/>
|
||||||
<span>Kbps</span>
|
<span>Kbps</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,20 +33,8 @@ function LibSvtAv1Options({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
onParamChanged("vbitrate", undefined);
|
|
||||||
|
|
||||||
if (isNaN(parseInt(params.preset ?? ""))) {
|
|
||||||
onParamChanged("preset", "5");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="encoderOptions">
|
<section id="encoderOptions" class="k-form">
|
||||||
<div class="row flex-col align-items-center">
|
|
||||||
<h3 class="k-form-section-title">Encoder Options</h3>
|
|
||||||
</div>
|
|
||||||
<div class="k-form">
|
|
||||||
<label>Help</label>
|
<label>Help</label>
|
||||||
<div>
|
<div>
|
||||||
<button
|
<button
|
||||||
@@ -79,9 +67,7 @@ function LibSvtAv1Options({
|
|||||||
id="crf"
|
id="crf"
|
||||||
title="A range from 1 to 63. A good starting point for a 1080p video is 30"
|
title="A range from 1 to 63. A good starting point for a 1080p video is 30"
|
||||||
value={params.crf ?? 30}
|
value={params.crf ?? 30}
|
||||||
oninput={(e) =>
|
oninput={(e) => onParamChanged("crf", parseInt(e.target.value))}
|
||||||
onParamChanged("crf", parseInt(e.target.value))
|
|
||||||
}
|
|
||||||
min="1"
|
min="1"
|
||||||
max="63"
|
max="63"
|
||||||
/>
|
/>
|
||||||
@@ -116,7 +102,6 @@ function LibSvtAv1Options({
|
|||||||
<option value="0">Subjective Quality</option>
|
<option value="0">Subjective Quality</option>
|
||||||
<option value="1">Objective Quality (PSNR)</option>
|
<option value="1">Objective Quality (PSNR)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -171,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 =
|
||||||
@@ -220,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}`
|
||||||
|
|||||||
Reference in New Issue
Block a user