The swiss army knife of lossless video/audio editing
Show which tracks/files are edited and allow resetting changes
Claude264d6e0a7d00
diff --git a/locales/en/translation.json b/locales/en/translation.jsonindex 3fabf6b4..3252a4e9 100644--- a/locales/en/translation.json+++ b/locales/en/translation.json@@ -642,6 +642,8 @@"Report an error": "Report an error","Report error": "Report error","Reset": "Reset",+ "Reset all changes": "Reset all changes",+ "Reset all changes to files and tracks?": "Reset all changes to files and tracks?","Reset font size": "Reset font size","Resulting segment file names_one": "Resulting file name","Resulting segment file names_other": "Resulting file names",@@ -810,6 +812,7 @@"This is where working files and exported files are stored.": "This is where working files and exported files are stored.","This option allows you to shift all segment start times forward by one or more frames before cutting. This can be useful if the output video starts from the wrong (preceding) keyframe.": "This option allows you to shift all segment start times forward by one or more frames before cutting. This can be useful if the output video starts from the wrong (preceding) keyframe.","This option lets you losslessly change the speed at which media players will play back the exported file. For example if you double the FPS, the playback speed will double (and duration will halve), however all the frames will be intact and played back (but faster). Be careful not to set it too high, as the player might not be able to keep up (playback CPU usage will increase proportionally to the speed!)": "This option lets you losslessly change the speed at which media players will play back the exported file. For example if you double the FPS, the playback speed will double (and duration will halve), however all the frames will be intact and played back (but faster). Be careful not to set it too high, as the player might not be able to keep up (playback CPU usage will increase proportionally to the speed!)",+ "This track has been edited": "This track has been edited","thumbnail": "thumbnail","Timeline keyboard seek acceleration": "Timeline keyboard seek acceleration","Timeline keyboard seek interval": "Timeline keyboard seek interval",diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 7d142652..f18b001e 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -2830,6 +2830,7 @@ function App() {toggleCopyAllStreamsForPath={toggleCopyAllStreamsForPath}onStreamSourceFileDrop={handleStreamSourceFileDrop}outFormat={fileFormat}+ confirmDialog={confirmDialog}/>)}diff --git a/src/renderer/src/StreamsSelector.tsx b/src/renderer/src/StreamsSelector.tsxindex e0e59a70..0c09c8b7 100644--- a/src/renderer/src/StreamsSelector.tsx+++ b/src/renderer/src/StreamsSelector.tsx@@ -1,7 +1,7 @@import type { Dispatch, SetStateAction, CSSProperties, ReactNode, ChangeEventHandler, DragEventHandler } from 'react';import { memo, useState, useMemo, useCallback } from 'react';-import { FaImage, FaPaperclip, FaVideo, FaVideoSlash, FaFileImport, FaVolumeUp, FaVolumeMute, FaBan, FaFileExport, FaBook, FaInfoCircle, FaFilter, FaEye, FaEdit, FaTrash, FaSortNumericDown, FaSortNumericUp, FaHamburger, FaMap, FaLanguage } from 'react-icons/fa';+import { FaImage, FaPaperclip, FaVideo, FaVideoSlash, FaFileImport, FaVolumeUp, FaVolumeMute, FaBan, FaFileExport, FaBook, FaInfoCircle, FaFilter, FaEye, FaEdit, FaTrash, FaSortNumericDown, FaSortNumericUp, FaHamburger, FaMap, FaLanguage, FaUndo } from 'react-icons/fa';import { GoFileBinary } from 'react-icons/go';import { MdSubtitles } from 'react-icons/md';import { useTranslation, Trans } from 'react-i18next';@@ -15,7 +15,7 @@ import AutoExportToggler from './components/AutoExportToggler';import Select from './components/Select';import type { FileStream } from './ffmpeg';import { getStreamFps } from './ffmpeg';-import { getActiveDisposition, attachedPicDisposition, isGpsStream, isMov } from './util/streams';+import { getActiveDisposition, attachedPicDisposition, isGpsStream, isMov, hasFileEdits, hasStreamEdits } from './util/streams';import { fileMetadataKeys, getCodecTagSuggestions, getLanguageSuggestions, getNonNativeMovMetadataKeys, isValidCodecTag, isValidCreationTime, isValidLanguageCode, needsHvc1Tag, streamMetadataKeys } from './util/metadata';import useUserSettings from './hooks/useUserSettings';import TagEditor, { cancelTagEditOnEscape, type TagInfo } from './components/TagEditor';@@ -28,8 +28,16 @@ import styles from './StreamsSelector.module.css';import Json5Dialog from './components/Json5Dialog';import GpsMap from './components/GpsMap';import Switch from './components/Switch';+import type { ConfirmDialog } from './components/GenericDialog';+type ResetParams = (path: string, streamId?: number) => void;++// highlighted when there are changes+function EditButton({ title, onClick, highlighted }: { title: string, onClick: () => void, highlighted: boolean }) {+ return <Button title={title} onClick={onClick}><FaEdit style={{ verticalAlign: 'middle', color: highlighted ? 'var(--accent-11)' : undefined }} /></Button>;+}+type UpdateStreamParams = (fileId: string, streamId: number, setter: (a: StreamParams) => void) => void;interface EditingStream {@@ -95,6 +103,11 @@ function MovMetadataNotice({ outFormat, metadata, isStream }: { outFormat: strin);}+function ResetButton({ disabled, onClick }: { disabled: boolean, onClick: () => void }) {+ const { t } = useTranslation();+ return <DialogButton disabled={disabled} onClick={onClick}><FaUndo style={{ verticalAlign: 'baseline', fontSize: '.8em', marginRight: '.3em' }} />{t('Reset')}</DialogButton>;+}+function KeyValue({ name, value }: { name: ReactNode, value: ReactNode }) {return (<div style={{ display: 'flex', gap: '1em', marginBottom: '.3em', justifyContent: 'space-between' }}>@@ -289,13 +302,14 @@ const EditFileDialog = memo(({ editingFile, allFilesMeta, paramsByFile, setParam});// eslint-disable-next-line react/display-name-const EditStreamDialog = memo(({ editingStream: { streamId: editingStreamId, path: editingFile }, setEditingStream, allFilesMeta, paramsByFile, updateStreamParams, outFormat }: {+const EditStreamDialog = memo(({ editingStream: { streamId: editingStreamId, path: editingFile }, setEditingStream, allFilesMeta, paramsByFile, updateStreamParams, outFormat, resetParams }: {editingStream: EditingStream,setEditingStream: Dispatch<SetStateAction<EditingStream | undefined>>,allFilesMeta: FilesMeta,paramsByFile: ParamsByFile,updateStreamParams: UpdateStreamParams,outFormat: string | undefined,+ resetParams: ResetParams,}) => {const { t, i18n } = useTranslation();const [editingKey, setEditingKey] = useState<string>();@@ -447,6 +461,7 @@ const EditStreamDialog = memo(({ editingStream: { streamId: editingStreamId, pat</Tabs.Root><Dialog.ButtonRow>+ <ResetButton disabled={!hasStreamEdits(streamParams)} onClick={() => resetParams(editingFile, editingStreamId)} /><Dialog.Close asChild><DialogButton disabled={editingKey != null} primary>{t('Done')}</DialogButton></Dialog.Close>@@ -478,7 +493,8 @@ const Stream = memo(({ filePath, stream, onToggle, toggleCopyStreamIds, copyStreconst { t } = useTranslation();const effectiveDisposition = useMemo(() => getStreamEffectiveDisposition(paramsByFile, filePath, stream), [filePath, paramsByFile, stream]);- const effectiveLanguage = getStreamParams({ paramsByFile, filePath, streamId: stream.index })?.metadata['language'] ?? stream.tags?.language;+ const streamParams = getStreamParams({ paramsByFile, filePath, streamId: stream.index });+ const effectiveLanguage = streamParams?.metadata['language'] ?? stream.tags?.language;const bitrate = parseInt(stream.bit_rate!, 10);const streamDuration = parseInt(stream.duration, 10);@@ -565,7 +581,8 @@ const Stream = memo(({ filePath, stream, onToggle, toggleCopyStreamIds, copyStre</Select></td>- <td style={{ textAlign: 'right', fontSize: '1.1em' }}>+ <td style={{ textAlign: 'right', fontSize: '1.1em', whiteSpace: 'nowrap' }}>+ {hasStreamEdits(streamParams) && <EditButton title={t('This track has been edited')} onClick={() => setEditingStream({ streamId: stream.index, path: filePath })} highlighted />}<DropdownMenu.Root><DropdownMenu.Trigger asChild><Button><FaHamburger style={{ verticalAlign: 'middle', padding: '.4em' }} /></Button>@@ -641,8 +658,9 @@ const Stream = memo(({ filePath, stream, onToggle, toggleCopyStreamIds, copyStre);});-function FileHeading({ path, format, onEditClick, toggleCopyAllStreams, chapters, onTrashClick, onExtractAllStreamsPress, changeEnabledStreamsFilter }: {+function FileHeading({ path, format, onEditClick, edited, toggleCopyAllStreams, chapters, onTrashClick, onExtractAllStreamsPress, changeEnabledStreamsFilter }: {path: string,+ edited: boolean,format: FFprobeFormat | undefined,onEditClick?: (() => void) | undefined,toggleCopyAllStreams: () => void,@@ -668,7 +686,7 @@ function FileHeading({ path, format, onEditClick, toggleCopyAllStreams, chapters<Json5Dialog title={t('File info')} json={format}><Button title={t('File info')}><FaInfoCircle style={{ verticalAlign: 'middle' }} /></Button></Json5Dialog>- {onEditClick && <Button title={t('Edit file metadata')} onClick={onEditClick}><FaEdit style={{ verticalAlign: 'middle' }} /></Button>}+ {onEditClick && <EditButton title={t('Edit file metadata')} onClick={onEditClick} highlighted={edited} />}<Button title={t('Toggle all tracks')} onClick={() => toggleCopyAllStreams()}><FaEye style={{ verticalAlign: 'middle' }} /></Button>{changeEnabledStreamsFilter && <Button title={t('Filter tracks')} onClick={changeEnabledStreamsFilter}><FaFilter style={{ verticalAlign: 'middle' }} /></Button>}{onExtractAllStreamsPress && <Button title={t('Export each track as individual files')} onClick={onExtractAllStreamsPress}><FaFileExport style={{ verticalAlign: 'middle' }} /></Button>}@@ -702,7 +720,7 @@ const fileStyle: CSSProperties = { marginBottom: '2em', padding: '.5em 0', overffunction StreamsSelector({- mainFilePath, mainFileFormat, mainFileStreams, mainFileChapters, isCopyingStreamId, toggleCopyStreamId, setCopyStreamIdsForPath, onExtractStreamPress, onExtractAllStreamsPress, allFilesMeta, externalFilesMeta, setExternalFilesMeta, showAddStreamSourceDialog, shortestFlag, setShortestFlag, nonCopiedExtraStreams, paramsByFile, setParamsByFile, updateStreamParams, formatTimecode, loadSubtitleTrackToSegments, toggleCopyStreamIds, changeEnabledStreamsFilter, toggleCopyAllStreamsForPath, onStreamSourceFileDrop, outFormat,+ mainFilePath, mainFileFormat, mainFileStreams, mainFileChapters, isCopyingStreamId, toggleCopyStreamId, setCopyStreamIdsForPath, onExtractStreamPress, onExtractAllStreamsPress, allFilesMeta, externalFilesMeta, setExternalFilesMeta, showAddStreamSourceDialog, shortestFlag, setShortestFlag, nonCopiedExtraStreams, paramsByFile, setParamsByFile, updateStreamParams, formatTimecode, loadSubtitleTrackToSegments, toggleCopyStreamIds, changeEnabledStreamsFilter, toggleCopyAllStreamsForPath, onStreamSourceFileDrop, outFormat, confirmDialog,}: {mainFilePath: string,mainFileFormat: FFprobeFormat | undefined,@@ -730,6 +748,7 @@ function StreamsSelector({toggleCopyAllStreamsForPath: (path: string) => void,onStreamSourceFileDrop: DragEventHandler<HTMLDivElement>,outFormat: string | undefined,+ confirmDialog: ConfirmDialog,}) {const [editingFile, setEditingFile] = useState<string>();const [editingStream, setEditingStream] = useState<EditingStream>();@@ -754,11 +773,29 @@ function StreamsSelector({const externalFilesEntries = Object.entries(externalFilesMeta);+ // without streamId: resets the file's own params (not its tracks)+ const resetParams = useCallback<ResetParams>((path, streamId) => setParamsByFile(produce((draft) => {+ const fileParams = draft.get(path);+ if (fileParams == null) return;+ if (streamId != null) {+ fileParams.paramsByStream.delete(streamId);+ } else {+ fileParams.metadata = {};+ delete fileParams.offset;+ }+ })), [setParamsByFile]);++ const haveEdits = [...paramsByFile.values()].some((fileParams) => hasFileEdits(fileParams) || [...fileParams.paramsByStream.values()].some((streamParams) => hasStreamEdits(streamParams)));++ const onResetAllClick = useCallback(async () => {+ if (await confirmDialog({ description: t('Reset all changes to files and tracks?') })) setParamsByFile(new Map());+ }, [confirmDialog, setParamsByFile, t]);+return (<><div style={fileStyle} onDrop={onStreamSourceFileDrop}>{/* We only support editing main file metadata for now */}- <FileHeading path={mainFilePath} format={mainFileFormat} chapters={mainFileChapters} onEditClick={() => setEditingFile(mainFilePath)} toggleCopyAllStreams={() => toggleCopyAllStreamsForPath(mainFilePath)} onExtractAllStreamsPress={onExtractAllStreamsPress} changeEnabledStreamsFilter={changeEnabledStreamsFilter} />+ <FileHeading path={mainFilePath} format={mainFileFormat} edited={hasFileEdits(paramsByFile.get(mainFilePath))} chapters={mainFileChapters} onEditClick={() => setEditingFile(mainFilePath)} toggleCopyAllStreams={() => toggleCopyAllStreamsForPath(mainFilePath)} onExtractAllStreamsPress={onExtractAllStreamsPress} changeEnabledStreamsFilter={changeEnabledStreamsFilter} /><table className={styles['table']}><Thead />@@ -786,7 +823,7 @@ function StreamsSelector({{externalFilesEntries.map(([path, { streams: externalFileStreams, format }]) => (<div key={path} style={fileStyle}>- <FileHeading path={path} format={format} onEditClick={() => setEditingFile(path)} toggleCopyAllStreams={() => toggleCopyAllStreamsForPath(path)} onTrashClick={() => removeFile(path)} />+ <FileHeading path={path} format={format} edited={hasFileEdits(paramsByFile.get(path))} onEditClick={() => setEditingFile(path)} toggleCopyAllStreams={() => toggleCopyAllStreamsForPath(path)} onTrashClick={() => removeFile(path)} /><table className={styles['table']}><Thead />@@ -816,6 +853,12 @@ function StreamsSelector({<FaFileImport style={{ verticalAlign: 'middle', marginRight: '.5em' }} /> {t('Include more tracks from other file')}</Button>+ {haveEdits && (+ <Button style={{ marginBottom: '1em', marginLeft: '.5em', padding: '0.3em 1em' }} onClick={onResetAllClick}>+ <FaUndo style={{ verticalAlign: 'middle', marginRight: '.5em' }} /> {t('Reset all changes')}+ </Button>+ )}+{nonCopiedExtraStreams.length > 0 && (<div style={{ marginBottom: '1em' }}><span style={{ marginRight: 10 }}>{t('Discard or extract unprocessable tracks to separate files?')}</span>@@ -843,6 +886,7 @@ function StreamsSelector({<EditFileDialog editingFile={editingFile} editingKey={editingKey} setEditingKey={setEditingKey} allFilesMeta={allFilesMeta} paramsByFile={paramsByFile} setParamsByFile={setParamsByFile} enableMetadata={editingFile === mainFilePath} outFormat={outFormat} /><Dialog.ButtonRow>+ <ResetButton disabled={!hasFileEdits(paramsByFile.get(editingFile))} onClick={() => resetParams(editingFile)} /><Dialog.Close asChild><DialogButton primary disabled={editingKey != null}>{t('Done')}</DialogButton></Dialog.Close>@@ -862,6 +906,7 @@ function StreamsSelector({paramsByFile={paramsByFile}updateStreamParams={updateStreamParams}outFormat={outFormat}+ resetParams={resetParams}/>)}</>diff --git a/src/renderer/src/hooks/useFfmpegOperations.ts b/src/renderer/src/hooks/useFfmpegOperations.tsindex 622ca030..3d022a9f 100644--- a/src/renderer/src/hooks/useFfmpegOperations.ts+++ b/src/renderer/src/hooks/useFfmpegOperations.ts@@ -6,7 +6,7 @@ import i18n from 'i18next';import { getSuffixedOutPath, transferTimestamps, getOutFileExtension, getOutDir, getHtml5ifiedPath, unlinkWithRetry, getFrameDuration, isMac, html5ifiedPrefix, html5dummySuffix, assertFileExists } from '../util';import { isCuttingStart, isCuttingEnd, runFfmpegWithProgress, getFfCommandLine, getDuration, createChaptersFromSegments, readFileFfprobeMeta, getExperimentalArgs, getVideoTimescaleArgs, logStdoutStderr, runFfmpegConcat, RefuseOverwriteError, runFfmpeg } from '../ffmpeg';-import { getEffectiveAvoidNegativeTs, getKeyframeCutSeekCompensation, getMapStreamsArgs, getStreamIdsToCopy, isCopyingOnlyAudioStreams } from '../util/streams';+import { getEffectiveAvoidNegativeTs, getKeyframeCutSeekCompensation, getMapStreamsArgs, getStreamIdsToCopy, isCopyingOnlyAudioStreams, isCropActive, isAspectRatioActive } from '../util/streams';import { needsSmartCut, getCodecParams } from '../smartcut';import { getGuaranteedSegments, isDurationValid } from '../segments';import type { FFprobeStream } from '../../../common/ffprobe';@@ -394,37 +394,33 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, treaconst getStream = () => getFileStreams()?.find((s) => s.index === streamId);// Lossless crop via codec bitstream metadata (#643)- if (streamParams.crop) {+ if (isCropActive(streamParams.crop)) {const { left, right, top, bottom } = streamParams.crop;- if (left > 0 || right > 0 || top > 0 || bottom > 0) {- // Look up codec_name from allFilesMeta to determine the correct bitstream filter- const streamInfo = getStream();- const codecName = streamInfo?.codec_name;-- const cropParams = `crop_left=${left}:crop_right=${right}:crop_top=${top}:crop_bottom=${bottom}`;- if (codecName === 'h264') {- bitstreamFilters.push(`h264_metadata=${cropParams}`);- } else if (codecName === 'hevc') {- bitstreamFilters.push(`hevc_metadata=${cropParams}`);- }+ // Look up codec_name from allFilesMeta to determine the correct bitstream filter+ const streamInfo = getStream();+ const codecName = streamInfo?.codec_name;++ const cropParams = `crop_left=${left}:crop_right=${right}:crop_top=${top}:crop_bottom=${bottom}`;+ if (codecName === 'h264') {+ bitstreamFilters.push(`h264_metadata=${cropParams}`);+ } else if (codecName === 'hevc') {+ bitstreamFilters.push(`hevc_metadata=${cropParams}`);}}// Lossless aspect ratio (SAR) via codec bitstream metadata (#643)- if (streamParams.aspectRatio) {+ if (isAspectRatioActive(streamParams.aspectRatio)) {const { num, den } = streamParams.aspectRatio;- if (num > 0 && den > 0) {- const streamInfo = getStream();- const codecName = streamInfo?.codec_name;-- if (codecName === 'h264') {- bitstreamFilters.push(`h264_metadata=sample_aspect_ratio=${num}/${den}`);- } else if (codecName === 'hevc') {- bitstreamFilters.push(`hevc_metadata=sample_aspect_ratio=${num}/${den}`);- } else {- // For non-H264/HEVC codecs, use container-level -aspect flag- ret.push('-aspect', `${num}:${den}`);- }+ const streamInfo = getStream();+ const codecName = streamInfo?.codec_name;++ if (codecName === 'h264') {+ bitstreamFilters.push(`h264_metadata=sample_aspect_ratio=${num}/${den}`);+ } else if (codecName === 'hevc') {+ bitstreamFilters.push(`hevc_metadata=sample_aspect_ratio=${num}/${den}`);+ } else {+ // For non-H264/HEVC codecs, use container-level -aspect flag+ ret.push('-aspect', `${num}:${den}`);}}diff --git a/src/renderer/src/util/streams.test.ts b/src/renderer/src/util/streams.test.tsindex 9d9c5bca..19fc1603 100644--- a/src/renderer/src/util/streams.test.ts+++ b/src/renderer/src/util/streams.test.ts@@ -1,6 +1,6 @@import { test, expect } from 'vitest';-import { getEffectiveAvoidNegativeTs, getKeyframeCutSeekCompensation, getMapStreamsArgs, getStreamIdsToCopy, isCopyingOnlyAudioStreams } from './streams';+import { getEffectiveAvoidNegativeTs, getKeyframeCutSeekCompensation, getMapStreamsArgs, getStreamIdsToCopy, isCopyingOnlyAudioStreams, hasFileEdits, hasStreamEdits } from './streams';import type { FFprobeStreamDisposition } from '../../../common/ffprobe';import type { LiteFFprobeStream } from '../types';@@ -232,3 +232,21 @@ test('getKeyframeCutSeekCompensation', () => {// not cutting startexpect(getKeyframeCutSeekCompensation({ formatName: 'matroska,webm', streams: bFrames, cutFrom: 0 })).toBe(0);});++test('hasStreamEdits', () => {+ expect(hasStreamEdits(undefined)).toBe(false);+ // lingering params that don't affect the export+ expect(hasStreamEdits({ metadata: {}, bsfH264Mp4toannexb: false, crop: { left: 0, right: 0, top: 0, bottom: 0 }, aspectRatio: { num: 16, den: 0 } })).toBe(false);+ expect(hasStreamEdits({ metadata: { language: 'eng' } })).toBe(true);+ expect(hasStreamEdits({ metadata: { title: '' } })).toBe(true); // empty means delete+ expect(hasStreamEdits({ metadata: {}, tag: 'hvc1' })).toBe(true);+ expect(hasStreamEdits({ metadata: {}, crop: { left: 2, right: 0, top: 0, bottom: 0 } })).toBe(true);+});++test('hasFileEdits', () => {+ expect(hasFileEdits(undefined)).toBe(false);+ expect(hasFileEdits({ metadata: {}, paramsByStream: new Map([[0, { metadata: { title: 'a' } }]]) })).toBe(false); // track edits don't count+ expect(hasFileEdits({ metadata: {}, paramsByStream: new Map(), offset: 0 })).toBe(false);+ expect(hasFileEdits({ metadata: {}, paramsByStream: new Map(), offset: 1.5 })).toBe(true);+ expect(hasFileEdits({ metadata: { title: 'a' }, paramsByStream: new Map() })).toBe(true);+});diff --git a/src/renderer/src/util/streams.ts b/src/renderer/src/util/streams.tsindex c3433847..4a59f6f6 100644--- a/src/renderer/src/util/streams.ts+++ b/src/renderer/src/util/streams.ts@@ -1,7 +1,7 @@import invariant from 'tiny-invariant';import type { FFprobeStream, FFprobeStreamDisposition } from '../../../common/ffprobe';import type { AvoidNegativeTs } from '../../../common/types';-import type { AllFilesMeta, ChromiumHTMLAudioElement, ChromiumHTMLVideoElement, CopyfileStreams, LiteFFprobeStream } from '../types';+import type { AllFilesMeta, BsfAspectRatioParams, BsfCropParams, ChromiumHTMLAudioElement, ChromiumHTMLVideoElement, CopyfileStreams, FileParams, LiteFFprobeStream, StreamParams } from '../types';import type { FileStream } from '../ffmpeg';@@ -105,6 +105,22 @@ export const isMov = (format: string | undefined) => format != null && ['ismv',export const isMatroska = (format: string | undefined) => format != null && ['matroska', 'webm'].includes(format);+// all zero means no crop / aspect ratio (the editors store zeros when cleared)+export const isCropActive = (crop: BsfCropParams | undefined): crop is BsfCropParams => crop != null && (crop.left > 0 || crop.right > 0 || crop.top > 0 || crop.bottom > 0);+export const isAspectRatioActive = (aspectRatio: BsfAspectRatioParams | undefined): aspectRatio is BsfAspectRatioParams => aspectRatio != null && aspectRatio.num > 0 && aspectRatio.den > 0;++// whether the user has made any changes that affect the export (params can linger after being undone, e.g. a switch turned off)+export const hasStreamEdits = (params: StreamParams | undefined) => params != null && (+ Object.keys(params.metadata).length > 0+ || params.disposition != null+ || !!params.bsfH264Mp4toannexb || !!params.bsfHevcMp4toannexb || !!params.bsfHevcAudInsert+ || params.tag != null+ || isCropActive(params.crop)+ || isAspectRatioActive(params.aspectRatio)+);++export const hasFileEdits = (params: FileParams | undefined) => params != null && (Object.keys(params.metadata).length > 0 || !!params.offset);+type GetVideoArgsFn = (a: { streamIndex: number, outputIndex: number }) => string[] | undefined;function getPerStreamFlags({ stream, outputIndex, outFormat, manuallyCopyDisposition = false, getVideoArgs = () => undefined, needFlac }: {