commit
d1462aae85
@ -1,25 +1,52 @@
|
|||||||
import { getEncoder } from './hardwareUtils';
|
import { getEncoder, IgetEncoder } from './hardwareUtils';
|
||||||
|
|
||||||
const run = async () => {
|
const baseInput = {
|
||||||
const encoderProperties = await getEncoder({
|
targetCodec: 'h264',
|
||||||
targetCodec: 'h264',
|
hardwareEncoding: true,
|
||||||
hardwareEncoding: true,
|
hardwareType: 'auto',
|
||||||
hardwareType: 'auto',
|
args: {
|
||||||
// @ts-expect-error type
|
workerType: 'transcodegpu',
|
||||||
args: {
|
ffmpegPath: 'ffmpeg',
|
||||||
workerType: 'transcodegpu',
|
jobLog: () => {
|
||||||
ffmpegPath: 'ffmpeg',
|
//
|
||||||
jobLog: (t:string) => {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(t);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
interface IcheckHardware {
|
||||||
|
targetCodec:string | undefined,
|
||||||
|
hardwareEncoding:boolean | undefined,
|
||||||
|
hardwareType:string | undefined,
|
||||||
|
ffmpegPath:string | undefined,
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkHardware = async (settings:IcheckHardware):Promise<IgetEncoder> => {
|
||||||
|
const input = JSON.parse(JSON.stringify(baseInput));
|
||||||
|
|
||||||
|
input.args.jobLog = () => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
// console.log(t);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (settings.targetCodec) {
|
||||||
|
input.targetCodec = settings.targetCodec;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.hardwareEncoding) {
|
||||||
|
input.hardwareEncoding = settings.hardwareEncoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.hardwareType) {
|
||||||
|
input.hardwareType = settings.hardwareType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.ffmpegPath) {
|
||||||
|
input.args.ffmpegPath = settings.ffmpegPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
const encoderProperties = await getEncoder(input);
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
return encoderProperties;
|
||||||
console.log({
|
|
||||||
encoderProperties,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void run();
|
export default checkHardware;
|
||||||
|
|||||||
Loading…
Reference in new issue