mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
transcode: add -nostdin -safe 1
This commit is contained in:
parent
43ec58085a
commit
aeaa60df45
2 changed files with 9 additions and 1 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
export interface FFmpegFlags {
|
export interface FFmpegFlags {
|
||||||
|
'safe'?: string;
|
||||||
|
'nostdin'?: string;
|
||||||
'c:v'?: string;
|
'c:v'?: string;
|
||||||
'preset'?: string;
|
'preset'?: string;
|
||||||
'loglevel'?: string;
|
'loglevel'?: string;
|
||||||
|
|
@ -15,7 +17,11 @@ export function ffmpeg(input: URL | ReadableStream<Uint8Array>, flags: FFmpegFla
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(flags)) {
|
for (const [key, value] of Object.entries(flags)) {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
args.push(`-${key}`, value);
|
if (value) {
|
||||||
|
args.push(`-${key}`, value);
|
||||||
|
} else {
|
||||||
|
args.push(`-${key}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import { ffmpeg } from './ffmpeg.ts';
|
||||||
|
|
||||||
export function transcodeVideo(input: ReadableStream<Uint8Array>): ReadableStream<Uint8Array> {
|
export function transcodeVideo(input: ReadableStream<Uint8Array>): ReadableStream<Uint8Array> {
|
||||||
return ffmpeg(input, {
|
return ffmpeg(input, {
|
||||||
|
'safe': '1', // Safe mode
|
||||||
|
'nostdin': '', // Disable stdin
|
||||||
'c:v': 'libx264', // Convert to H.264
|
'c:v': 'libx264', // Convert to H.264
|
||||||
'preset': 'veryfast', // Encoding speed
|
'preset': 'veryfast', // Encoding speed
|
||||||
'loglevel': 'fatal', // Suppress logs
|
'loglevel': 'fatal', // Suppress logs
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue