improve thumbnail check #308

pull/333/head
Mikael Finstad 6 years ago
parent 34b5a47cfa
commit b48f58b8ff

@ -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}

@ -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) {

Loading…
Cancel
Save