Skip to content

The swiss army knife of lossless video/audio editing

improve thumbnail check #308

Mikael Finstadb48f58b8ffe0
diff --git a/src/App.jsx b/src/App.jsx
index fec8007f..ba6fd62c 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -41,7 +41,7 @@ import {
defaultProcessedCodecTypes, getStreamFps, isCuttingStart, isCuttingEnd,
getDefaultOutFormat, getFormatData, renderFrame, mergeFiles as ffmpegMergeFiles, renderThumbnails as ffmpegRenderThumbnails,
readFrames, renderWaveformPng, html5ifyDummy, cutMultiple, extractStreams, autoMergeSegments, getAllStreams,
- findNearestKeyFrameTime, html5ify as ffmpegHtml5ify,
+ findNearestKeyFrameTime, html5ify as ffmpegHtml5ify, isStreamThumbnail,
} from './ffmpeg';
import { save as edlStoreSave, load as edlStoreLoad } from './edlStore';
import {
@@ -1143,7 +1143,7 @@ const App = memo(() => {
stream.index, defaultProcessedCodecTypes.includes(stream.codec_type),
])));
- const videoStream = streams.find(stream => stream.codec_type === 'video' && !['png'].includes(stream.codec_name));
+ const videoStream = streams.find(stream => stream.codec_type === 'video' && !isStreamThumbnail(stream));
const audioStream = streams.find(stream => stream.codec_type === 'audio');
setMainVideoStream(videoStream);
setMainAudioStream(audioStream);
@@ -1915,7 +1915,6 @@ const App = memo(() => {
currentSegIndexSafe={currentSegIndexSafe}
invertCutSegments={invertCutSegments}
inverseCutSegments={inverseCutSegments}
- mainVideoStream={mainVideoStream}
formatTimecode={formatTimecode}
timelineHeight={timelineHeight}
onZoomWindowStartTimeChange={setZoomWindowStartTime}
@@ -1963,6 +1962,7 @@ const App = memo(() => {
/>
<RightMenu
+ hasVideo={hasVideo}
isRotationSet={isRotationSet}
rotation={rotation}
areWeCutting={areWeCutting}
diff --git a/src/ffmpeg.js b/src/ffmpeg.js
index a1f886d5..a51bdbc0 100644
--- a/src/ffmpeg.js
+++ b/src/ffmpeg.js
@@ -726,6 +726,10 @@ export const defaultProcessedCodecTypes = [
'attachment',
];
+export function isStreamThumbnail(stream) {
+ return stream && stream.disposition && stream.disposition.attached_pic === 1;
+}
+
export function getStreamFps(stream) {
const match = typeof stream.avg_frame_rate === 'string' && stream.avg_frame_rate.match(/^([0-9]+)\/([0-9]+)$/);
if (stream.codec_type === 'video' && match) {