The swiss army knife of lossless video/audio editing
improve settings
Mikael Finstad7463049ee57a
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex f6ab42e9..02e8fd7b 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -2847,7 +2847,7 @@ function App() {/></div>- <ExportConfirm areWeCutting={areWeCutting} nonFilteredSegmentsOrInverse={nonFilteredSegmentsOrInverse} selectedSegments={selectedSegmentsOrInverse} segmentsToExport={segmentsToExport} willMerge={willMerge} visible={exportConfirmVisible} onClosePress={closeExportConfirm} onExportConfirm={onExportConfirm} renderOutFmt={renderOutFmt} outputDir={outputDir} numStreamsTotal={numStreamsTotal} numStreamsToCopy={numStreamsToCopy} onShowStreamsSelectorClick={handleShowStreamsSelectorClick} outFormat={fileFormat} setOutSegTemplate={setOutSegTemplate} outSegTemplate={outSegTemplateOrDefault} generateOutSegFileNames={generateOutSegFileNames} currentSegIndexSafe={currentSegIndexSafe} mainCopiedThumbnailStreams={mainCopiedThumbnailStreams} needSmartCut={needSmartCut} mergedOutFileName={mergedOutFileName} setMergedOutFileName={setMergedOutFileName} smartCutBitrate={smartCutBitrate} setSmartCutBitrate={setSmartCutBitrate} />+ <ExportConfirm areWeCutting={areWeCutting} nonFilteredSegmentsOrInverse={nonFilteredSegmentsOrInverse} selectedSegments={selectedSegmentsOrInverse} segmentsToExport={segmentsToExport} willMerge={willMerge} visible={exportConfirmVisible} onClosePress={closeExportConfirm} onExportConfirm={onExportConfirm} renderOutFmt={renderOutFmt} outputDir={outputDir} numStreamsTotal={numStreamsTotal} numStreamsToCopy={numStreamsToCopy} onShowStreamsSelectorClick={handleShowStreamsSelectorClick} outFormat={fileFormat} setOutSegTemplate={setOutSegTemplate} outSegTemplate={outSegTemplateOrDefault} generateOutSegFileNames={generateOutSegFileNames} currentSegIndexSafe={currentSegIndexSafe} mainCopiedThumbnailStreams={mainCopiedThumbnailStreams} needSmartCut={needSmartCut} mergedOutFileName={mergedOutFileName} setMergedOutFileName={setMergedOutFileName} smartCutBitrate={smartCutBitrate} setSmartCutBitrate={setSmartCutBitrate} toggleSettings={toggleSettings} /><Sheet visible={streamsSelectorShown} onClosePress={() => setStreamsSelectorShown(false)} maxWidth={1000}>{mainStreams && filePath != null && (diff --git a/src/renderer/src/components/ExportConfirm.tsx b/src/renderer/src/components/ExportConfirm.tsxindex 145b58b3..98487976 100644--- a/src/renderer/src/components/ExportConfirm.tsx+++ b/src/renderer/src/components/ExportConfirm.tsx@@ -4,7 +4,7 @@ import { WarningSignIcon, CrossIcon } from 'evergreen-ui';import { FaRegCheckCircle } from 'react-icons/fa';import i18n from 'i18next';import { useTranslation, Trans } from 'react-i18next';-import { IoIosHelpCircle } from 'react-icons/io';+import { IoIosHelpCircle, IoIosSettings } from 'react-icons/io';import type { SweetAlertIcon } from 'sweetalert2';import ExportButton from './ExportButton';@@ -64,6 +64,7 @@ function ExportConfirm({setMergedOutFileName,smartCutBitrate,setSmartCutBitrate,+ toggleSettings,} : {areWeCutting: boolean,selectedSegments: InverseCutSegment[],@@ -89,6 +90,7 @@ function ExportConfirm({setMergedOutFileName: (a: string) => void,smartCutBitrate: number | undefined,setSmartCutBitrate: Dispatch<SetStateAction<number | undefined>>,+ toggleSettings: () => void,}) {const { t } = useTranslation();@@ -151,6 +153,7 @@ function ExportConfirm({const onAvoidNegativeTsHelpPress = useCallback(() => {// https://ffmpeg.org/ffmpeg-all.html#Format-Options+ // https://github.com/mifi/lossless-cut/issues/1206const texts = {make_non_negative: i18n.t('Shift timestamps to make them non-negative. Also note that this affects only leading negative timestamps, and not non-monotonic negative timestamps.'),make_zero: i18n.t('Shift timestamps so that the first timestamp is 0. (LosslessCut default)'),@@ -309,6 +312,61 @@ function ExportConfirm({<table className={styles['options']}><tbody>++ {areWeCutting && (+ <tr>+ <td>+ {t('Shift all start times')}+ </td>+ <td>+ <Select value={cutFromAdjustmentFrames} onChange={(e) => setCutFromAdjustmentFrames(Number(e.target.value))} style={{ height: 20, marginLeft: 5 }}>+ {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((v) => <option key={v} value={v}>{t('+{{numFrames}} frames', { numFrames: v, count: v })}</option>)}+ </Select>+ </td>+ <td>+ <HelpIcon onClick={onCutFromAdjustmentFramesHelpPress} />+ </td>+ </tr>+ )}++ {isMov && (+ <>+ <tr>+ <td>+ {t('Enable MOV Faststart?')}+ </td>+ <td>+ <MovFastStartButton />+ {isIpod && !movFastStart && <div style={warningStyle}>{t('For the ipod format, it is recommended to activate this option')}</div>}+ </td>+ <td>+ {isIpod && !movFastStart ? (+ <WarningSignIcon verticalAlign="middle" color="warning" />+ ) : (+ <HelpIcon onClick={onMovFastStartHelpPress} />+ )}+ </td>+ </tr>++ <tr>+ <td>+ {t('Preserve all MP4/MOV metadata?')}+ {isIpod && preserveMovData && <div style={warningStyle}>{t('For the ipod format, it is recommended to deactivate this option')}</div>}+ </td>+ <td>+ <PreserveMovDataButton />+ </td>+ <td>+ {isIpod && preserveMovData ? (+ <WarningSignIcon verticalAlign="middle" color="warning" />+ ) : (+ <HelpIcon onClick={onPreserveMovDataHelpPress} />+ )}+ </td>+ </tr>+ </>+ )}+{willMerge && (<><tr>@@ -403,60 +461,6 @@ function ExportConfirm({</>)}- {areWeCutting && (- <tr>- <td>- {t('Shift all start times')}- </td>- <td>- <Select value={cutFromAdjustmentFrames} onChange={(e) => setCutFromAdjustmentFrames(Number(e.target.value))} style={{ height: 20, marginLeft: 5 }}>- {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((v) => <option key={v} value={v}>{t('+{{numFrames}} frames', { numFrames: v, count: v })}</option>)}- </Select>- </td>- <td>- <HelpIcon onClick={onCutFromAdjustmentFramesHelpPress} />- </td>- </tr>- )}-- {isMov && (- <>- <tr>- <td>- {t('Enable MOV Faststart?')}- </td>- <td>- <MovFastStartButton />- {isIpod && !movFastStart && <div style={warningStyle}>{t('For the ipod format, it is recommended to activate this option')}</div>}- </td>- <td>- {isIpod && !movFastStart ? (- <WarningSignIcon verticalAlign="middle" color="warning" />- ) : (- <HelpIcon onClick={onMovFastStartHelpPress} />- )}- </td>- </tr>-- <tr>- <td>- {t('Preserve all MP4/MOV metadata?')}- {isIpod && preserveMovData && <div style={warningStyle}>{t('For the ipod format, it is recommended to deactivate this option')}</div>}- </td>- <td>- <PreserveMovDataButton />- </td>- <td>- {isIpod && preserveMovData ? (- <WarningSignIcon verticalAlign="middle" color="warning" />- ) : (- <HelpIcon onClick={onPreserveMovDataHelpPress} />- )}- </td>- </tr>- </>- )}-{!needSmartCut && (() => {const avoidNegativeTsWarn = (() => {if (willMerge) {@@ -474,7 +478,7 @@ function ExportConfirm({return (<tr><td>- {`"${'avoid_negative_ts'}"`}+ "ffmpeg" <code className="highlighted">avoid_negative_ts</code>{avoidNegativeTsWarn != null && <div style={warningStyle}>{avoidNegativeTsWarn}</div>}</td><td>@@ -507,6 +511,16 @@ function ExportConfirm({<HelpIcon onClick={onFfmpegExperimentalHelpPress} /></td></tr>++ <tr>+ <td>+ {t('More settings')}+ </td>+ <td>+ <IoIosSettings size={24} role="button" onClick={toggleSettings} style={{ marginLeft: 5 }} />+ </td>+ <td />+ </tr></tbody></table></div>diff --git a/src/renderer/src/components/Settings.tsx b/src/renderer/src/components/Settings.tsxindex 5dba3f54..eac0c2f9 100644--- a/src/renderer/src/components/Settings.tsx+++ b/src/renderer/src/components/Settings.tsx@@ -104,19 +104,36 @@ function Settings({<tbody><Row>- <KeyCell>{t('Show advanced settings')}</KeyCell>+ <KeyCell><GlobeIcon style={{ verticalAlign: 'middle', marginRight: '.5em' }} /> App language</KeyCell>+ <td>+ <Select value={language || ''} onChange={onLangChange} style={{ fontSize: '1.2em' }}>+ <option key="" value="">{t('System language')}</option>+ {Object.keys(langNames).map((lang) => <option key={lang} value={lang}>{langNames[lang]}</option>)}+ </Select>+ </td>+ </Row>++ <Row>+ <KeyCell>+ {t('Show advanced settings')}+ <div style={detailsStyle}>+ {!showAdvanced && t('Advanced settings are currently not visible.')}+ </div>+ </KeyCell><td><Switch checked={showAdvanced} onCheckedChange={setShowAdvanced} /></td></Row><Row>- <KeyCell><GlobeIcon style={{ verticalAlign: 'middle', marginRight: '.5em' }} /> App language</KeyCell>+ <KeyCell>+ {t('Show export options screen before exporting?')}+ <div style={detailsStyle}>+ {t('This gives you an overview of the export and allows you to customise more parameters before exporting.')}+ </div>+ </KeyCell><td>- <Select value={language || ''} onChange={onLangChange} style={{ fontSize: '1.2em' }}>- <option key="" value="">{t('System language')}</option>- {Object.keys(langNames).map((lang) => <option key={lang} value={lang}>{langNames[lang]}</option>)}- </Select>+ <Switch checked={exportConfirmEnabled} onCheckedChange={toggleExportConfirmEnabled} /></td></Row>@@ -184,12 +201,15 @@ function Settings({<KeyCell>{t('Choose cutting mode: Remove or keep selected segments from video when exporting?')}<br /><div style={detailsStyle}>- <b>{t('Keep')}</b>: {t('The video inside segments will be kept, while the video outside will be discarded.')}<br />- <b>{t('Remove')}</b>: {t('The video inside segments will be discarded, while the video surrounding them will be kept.')}+ {invertCutSegments ? (+ <><b>{t('Remove')}</b>: {t('The video inside segments will be discarded, while the video surrounding them will be kept.')}</>+ ) : (+ <><b>{t('Keep')}</b>: {t('The video inside segments will be kept, while the video outside will be discarded.')}</>+ )}</div></KeyCell><td>- <Button iconBefore={FaYinYang} appearance={invertCutSegments ? 'default' : 'primary'} intent="success" onClick={() => setInvertCutSegments((v) => !v)}>+ <Button iconBefore={FaYinYang} appearance="primary" intent={invertCutSegments ? 'danger' : 'success'} onClick={() => setInvertCutSegments((v) => !v)}>{invertCutSegments ? t('Remove') : t('Keep')}</Button></td>@@ -203,10 +223,10 @@ function Settings({</div></KeyCell><td>+ <div>{customOutDir}</div><Button iconBefore={customOutDir ? FolderCloseIcon : DocumentIcon} onClick={changeOutDir}>{customOutDir ? t('Custom working directory') : t('Same directory as input file')}...</Button>- <div>{customOutDir}</div>{customOutDir && (<Buttonheight={20}@@ -250,13 +270,13 @@ function Settings({<div style={detailsStyle}>{keyframeCut ? (<>- {t('Cut at the nearest keyframe (not accurate time.) Equiv to')}:<br />- <code className="highlighted">ffmpeg -ss -i ...</code>+ <b>{t('Keyframe cut')}</b>: {t('Cut at the nearest keyframe (not accurate time.) Equiv to')}:<br />+ <code className="highlighted">ffmpeg -ss -i input.mp4</code></>) : (<>- {t('Accurate time but could leave an empty portion at the beginning of the video. Equiv to')}:<br />- <code className="highlighted">ffmpeg -i -ss ...</code>+ <b>{t('Normal cut')}</b>: {t('Accurate time but could leave an empty portion at the beginning of the video. Equiv to')}:<br />+ <code className="highlighted">ffmpeg -i -ss input.mp4</code></>)}</div>@@ -299,17 +319,19 @@ function Settings({</td></Row>- <Row>- <KeyCell>- {t('Snapshot capture method')}- <div style={detailsStyle}>{t('FFmpeg capture method might sometimes capture more correct colors, but the captured snapshot might be off by one or more frames, relative to the preview.')}</div>- </KeyCell>- <td>- <Button onClick={() => setCaptureFrameMethod((existing) => (existing === 'ffmpeg' ? 'videotag' : 'ffmpeg'))}>- {captureFrameMethod === 'ffmpeg' ? t('FFmpeg') : t('HTML video tag')}- </Button>- </td>- </Row>+ {showAdvanced && (+ <Row>+ <KeyCell>+ {t('Snapshot capture method')}+ <div style={detailsStyle}>{t('FFmpeg capture method might sometimes capture more correct colors, but the captured snapshot might be off by one or more frames, relative to the preview.')}</div>+ </KeyCell>+ <td>+ <Button onClick={() => setCaptureFrameMethod((existing) => (existing === 'ffmpeg' ? 'videotag' : 'ffmpeg'))}>+ {captureFrameMethod === 'ffmpeg' ? t('FFmpeg') : t('HTML video tag')}+ </Button>+ </td>+ </Row>+ )}<Row><KeyCell>{t('Snapshot capture quality')}</KeyCell>@@ -319,14 +341,16 @@ function Settings({</td></Row>- <Row>- <KeyCell>{t('File names of extracted video frames')}</KeyCell>- <td>- <Button iconBefore={captureFrameFileNameFormat === 'timestamp' ? TimeIcon : NumericalIcon} onClick={() => setCaptureFrameFileNameFormat((existing) => (existing === 'timestamp' ? 'index' : 'timestamp'))}>- {captureFrameFileNameFormat === 'timestamp' ? t('Frame timestamp') : t('Frame number')}- </Button>- </td>- </Row>+ {showAdvanced && (+ <Row>+ <KeyCell>{t('File names of extracted video frames')}</KeyCell>+ <td>+ <Button iconBefore={captureFrameFileNameFormat === 'timestamp' ? TimeIcon : NumericalIcon} onClick={() => setCaptureFrameFileNameFormat((existing) => (existing === 'timestamp' ? 'index' : 'timestamp'))}>+ {captureFrameFileNameFormat === 'timestamp' ? t('Frame timestamp') : t('Frame number')}+ </Button>+ </td>+ </Row>+ )}<Header title={t('Keyboard, mouse and input')} />@@ -391,6 +415,7 @@ function Settings({</td></Row>+<Header title={t('User interface')} />{showAdvanced && (@@ -421,15 +446,6 @@ function Settings({</Row>)}- <Row>- <KeyCell>{t('In timecode show')}</KeyCell>- <td>- <Button iconBefore={timecodeFormat === 'frameCount' ? NumericalIcon : TimeIcon} onClick={onTimecodeFormatClick}>- {timecodeFormatOptions[timecodeFormat]}- </Button>- </td>- </Row>-<Row><KeyCell>{t('Prefer strong colors')}</KeyCell><td>@@ -437,15 +453,18 @@ function Settings({</td></Row>- <Header title={t('Prompts and dialogs')} />-<Row>- <KeyCell>{t('Show export options screen before exporting?')}</KeyCell>+ <KeyCell>{t('In timecode show')}</KeyCell><td>- <Switch checked={exportConfirmEnabled} onCheckedChange={toggleExportConfirmEnabled} />+ <Button iconBefore={timecodeFormat === 'frameCount' ? NumericalIcon : TimeIcon} onClick={onTimecodeFormatClick}>+ {timecodeFormatOptions[timecodeFormat]}+ </Button></td></Row>++ <Header title={t('Prompts and dialogs')} />+<Row><KeyCell>{t('Show notifications')}</KeyCell><td>