Skip to content

The swiss army knife of lossless video/audio editing

Apply the video scaling setting to FFmpeg-assisted playback too

Claudebf8fa9826de3
diff --git a/locales/en/translation.json b/locales/en/translation.json
index 5a35acbf..ce6d8bfa 100644
--- a/locales/en/translation.json
+++ b/locales/en/translation.json
@@ -527,7 +527,6 @@
"None": "None",
"Normal cut": "Normal cut",
"Not all formats support all track types, and LosslessCut is unable to properly cut some track types, so you may have to sacrifice some tracks by disabling them in order to get correct result.": "Not all formats support all track types, and LosslessCut is unable to properly cut some track types, so you may have to sacrifice some tracks by disabling them in order to get correct result.",
- "Not applied when FFmpeg renders the preview (FFmpeg-assisted playback or rotation preview)": "Not applied when FFmpeg renders the preview (FFmpeg-assisted playback or rotation preview)",
"Note that also other settings from the normal export dialog apply to this merge function. For more information about all options, see the export dialog.": "Note that also other settings from the normal export dialog apply to this merge function. For more information about all options, see the export dialog.",
"Note that depending on input parameters, up to {{estimatedMaxNumFiles}} files may be produced!": "Note that depending on input parameters, up to {{estimatedMaxNumFiles}} files may be produced!",
"Note that this is not supported in all video players.": "Note that this is not supported in all video players.",
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 43fe1743..2e845b67 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -2596,7 +2596,7 @@ function App() {
{renderSubtitles()}
</video>
- {filePath != null && compatPlayerEnabled && <MediaSourcePlayer rotate={effectiveRotation} filePath={filePath} videoStream={activeVideoStream} audioStreams={activeAudioStreams} masterVideoRef={videoRef} mediaSourceQuality={mediaSourceQuality} ffmpegHwaccel={ffmpegHwaccel} />}
+ {filePath != null && compatPlayerEnabled && <MediaSourcePlayer rotate={effectiveRotation} filePath={filePath} videoStream={activeVideoStream} audioStreams={activeAudioStreams} masterVideoRef={videoRef} mediaSourceQuality={mediaSourceQuality} ffmpegHwaccel={ffmpegHwaccel} baseVideoStyle={mainVideoStyle} />}
</div>
{bigWaveformEnabled && <BigWaveform waveforms={waveforms} relevantTime={relevantTime} playing={playing} fileDurationNonZero={fileDurationNonZero} zoom={zoomUnrounded} seekRel={seekRel} darkMode={darkMode} />}
diff --git a/src/renderer/src/MediaSourcePlayer.tsx b/src/renderer/src/MediaSourcePlayer.tsx
index 7f8cfb92..e9530606 100644
--- a/src/renderer/src/MediaSourcePlayer.tsx
+++ b/src/renderer/src/MediaSourcePlayer.tsx
@@ -307,7 +307,7 @@ async function startPlayback({ path, slaveVideo, masterVideo, videoStreamIndex,
processChunk();
}
-function MediaSourcePlayer({ rotate, filePath, videoStream, audioStreams, masterVideoRef, mediaSourceQuality, ffmpegHwaccel }: {
+function MediaSourcePlayer({ rotate, filePath, videoStream, audioStreams, masterVideoRef, mediaSourceQuality, ffmpegHwaccel, baseVideoStyle }: {
rotate: number | undefined,
filePath: string,
videoStream: FFprobeStream | undefined,
@@ -315,6 +315,7 @@ function MediaSourcePlayer({ rotate, filePath, videoStream, audioStreams, master
masterVideoRef: RefObject<HTMLVideoElement | null>,
mediaSourceQuality: number,
ffmpegHwaccel: FfmpegHwAccel,
+ baseVideoStyle: CSSProperties,
}) {
const videoRef = useRef<HTMLVideoElement>(null);
const canvasRef = useRef<HTMLCanvasElement>(null);
@@ -406,8 +407,8 @@ function MediaSourcePlayer({ rotate, filePath, videoStream, audioStreams, master
}, []);
const videoStyle = useMemo<CSSProperties>(() => ({
- position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, display: 'block', width: '100%', height: '100%', objectFit: 'contain', transform: rotate ? `rotate(${rotate}deg)` : undefined,
- }), [rotate]);
+ ...baseVideoStyle, position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, display: 'block', transform: rotate ? `rotate(${rotate}deg)` : undefined,
+ }), [baseVideoStyle, rotate]);
return (
<div style={{ width: '100%', height: '100%', left: 0, right: 0, top: 0, bottom: 0, position: 'absolute', overflow: 'hidden', background: 'black', pointerEvents: 'none' }}>
diff --git a/src/renderer/src/components/Settings.tsx b/src/renderer/src/components/Settings.tsx
index 9d2b9b6b..d4a22f3f 100644
--- a/src/renderer/src/components/Settings.tsx
+++ b/src/renderer/src/components/Settings.tsx
@@ -482,10 +482,7 @@ function Settings({
{showAdvancedSettings && (
<Row>
- <KeyCell>
- {t('Video preview scaling')}
- <div style={detailsStyle}>{t('Not applied when FFmpeg renders the preview (FFmpeg-assisted playback or rotation preview)')}</div>
- </KeyCell>
+ <KeyCell>{t('Video preview scaling')}</KeyCell>
<td>
<Select value={videoFit} onChange={(e) => setVideoFit(e.target.value as Config['videoFit'])}>
{Object.entries({ contain: t('Fit to window'), 'scale-down': t('Fit to window, but don\'t enlarge'), cover: t('Fill window (crop)'), fill: t('Stretch to window'), none: t('Original size') } satisfies Record<Config['videoFit'], string>).map(([key, value]) => (