From 2326c5ba1c6ca63d93d8f28ccfcbd9326ed423cf Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 27 Apr 2020 13:00:21 +0800 Subject: [PATCH] Fix #308 --- src/App.jsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index dfde6ca..862dd13 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1111,10 +1111,6 @@ const App = memo(() => { const { streams } = await getAllStreams(fp); // console.log('streams', streamsNew); - setMainStreams(streams); - setCopyStreamIdsForPath(fp, () => fromPairs(streams.map((stream) => [ - stream.index, defaultProcessedCodecTypes.includes(stream.codec_type), - ]))); const videoStream = streams.find(stream => stream.codec_type === 'video' && !isStreamThumbnail(stream)); const audioStream = streams.find(stream => stream.codec_type === 'audio'); @@ -1125,6 +1121,20 @@ const App = memo(() => { if (streamFps != null) setDetectedFps(streamFps); } + const shouldDefaultCopyStream = (stream) => { + if (!defaultProcessedCodecTypes.includes(stream.codec_type)) return false; + // Don't enable thumbnail stream by default if we have a main video stream + // It's been known to cause issues: https://github.com/mifi/lossless-cut/issues/308 + if (isStreamThumbnail(stream) && videoStream) return false; + return true; + }; + + setMainStreams(streams); + setCopyStreamIdsForPath(fp, () => fromPairs(streams.map((stream) => [ + stream.index, shouldDefaultCopyStream(stream), + ]))); + + setFileNameTitle(fp); setFilePath(fp); setFileFormat(ff);