mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-25 03:33:14 +01:00
reformat
This commit is contained in:
parent
6c9b1ba708
commit
fa7b36f69f
@ -53,7 +53,12 @@ export function abortFfmpegs() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleProgress(process: { stderr: Readable | null }, durationIn: number | undefined, onProgress: (a: number) => void, customMatcher: (a: string) => void = () => undefined) {
|
function handleProgress(
|
||||||
|
process: { stderr: Readable | null },
|
||||||
|
durationIn: number | undefined,
|
||||||
|
onProgress: (a: number) => void,
|
||||||
|
customMatcher: (a: string) => void = () => undefined,
|
||||||
|
) {
|
||||||
if (!onProgress) return;
|
if (!onProgress) return;
|
||||||
if (process.stderr == null) return;
|
if (process.stderr == null) return;
|
||||||
onProgress(0);
|
onProgress(0);
|
||||||
@ -425,7 +430,15 @@ function getCodecOpts(captureFormat: CaptureFormat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function captureFrames({ from, to, videoPath, outPathTemplate, quality, filter, framePts, onProgress, captureFormat }: {
|
export async function captureFrames({ from, to, videoPath, outPathTemplate, quality, filter, framePts, onProgress, captureFormat }: {
|
||||||
from: number, to: number, videoPath: string, outPathTemplate: string, quality: number, filter?: string | undefined, framePts?: boolean | undefined, onProgress: (p: number) => void, captureFormat: CaptureFormat,
|
from: number,
|
||||||
|
to: number,
|
||||||
|
videoPath: string,
|
||||||
|
outPathTemplate: string,
|
||||||
|
quality: number,
|
||||||
|
filter?: string | undefined,
|
||||||
|
framePts?: boolean | undefined,
|
||||||
|
onProgress: (p: number) => void,
|
||||||
|
captureFormat: CaptureFormat,
|
||||||
}) {
|
}) {
|
||||||
const args = [
|
const args = [
|
||||||
'-ss', String(from),
|
'-ss', String(from),
|
||||||
|
@ -25,9 +25,22 @@ function getFrameFromVideo(video: HTMLVideoElement, format: CaptureFormat, quali
|
|||||||
return dataUriToBuffer(dataUri);
|
return dataUriToBuffer(dataUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({ formatTimecode, treatOutputFileModifiedTimeAsStart }: { formatTimecode: FormatTimecode, treatOutputFileModifiedTimeAsStart?: boolean | undefined | null }) => {
|
export default ({ formatTimecode, treatOutputFileModifiedTimeAsStart }: {
|
||||||
|
formatTimecode: FormatTimecode,
|
||||||
|
treatOutputFileModifiedTimeAsStart?: boolean | undefined | null,
|
||||||
|
}) => {
|
||||||
const captureFramesRange = useCallback(async ({ customOutDir, filePath, fps, fromTime, toTime, estimatedMaxNumFiles, captureFormat, quality, filter, onProgress, outputTimestamps }: {
|
const captureFramesRange = useCallback(async ({ customOutDir, filePath, fps, fromTime, toTime, estimatedMaxNumFiles, captureFormat, quality, filter, onProgress, outputTimestamps }: {
|
||||||
customOutDir, filePath: string, fps: number, fromTime: number, toTime: number, estimatedMaxNumFiles: number, captureFormat: CaptureFormat, quality: number, filter?: string | undefined, onProgress: (a: number) => void, outputTimestamps: boolean
|
customOutDir: string | undefined,
|
||||||
|
filePath: string,
|
||||||
|
fps: number,
|
||||||
|
fromTime: number,
|
||||||
|
toTime: number,
|
||||||
|
estimatedMaxNumFiles: number,
|
||||||
|
captureFormat: CaptureFormat,
|
||||||
|
quality: number,
|
||||||
|
filter?: string | undefined,
|
||||||
|
onProgress: (a: number) => void,
|
||||||
|
outputTimestamps: boolean,
|
||||||
}) => {
|
}) => {
|
||||||
const getSuffix = (prefix: string) => `${prefix}.${captureFormat}`;
|
const getSuffix = (prefix: string) => `${prefix}.${captureFormat}`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user