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, defaultProcessedCodecTypes, getStreamFps, isCuttingStart, isCuttingEnd,
getDefaultOutFormat, getFormatData, renderFrame, mergeFiles as ffmpegMergeFiles, renderThumbnails as ffmpegRenderThumbnails, getDefaultOutFormat, getFormatData, renderFrame, mergeFiles as ffmpegMergeFiles, renderThumbnails as ffmpegRenderThumbnails,
readFrames, renderWaveformPng, html5ifyDummy, cutMultiple, extractStreams, autoMergeSegments, getAllStreams, readFrames, renderWaveformPng, html5ifyDummy, cutMultiple, extractStreams, autoMergeSegments, getAllStreams,
findNearestKeyFrameTime, html5ify as ffmpegHtml5ify, findNearestKeyFrameTime, html5ify as ffmpegHtml5ify, isStreamThumbnail,
} from './ffmpeg'; } from './ffmpeg';
import { save as edlStoreSave, load as edlStoreLoad } from './edlStore'; import { save as edlStoreSave, load as edlStoreLoad } from './edlStore';
import { import {
@ -1143,7 +1143,7 @@ const App = memo(() => {
stream.index, defaultProcessedCodecTypes.includes(stream.codec_type), 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'); const audioStream = streams.find(stream => stream.codec_type === 'audio');
setMainVideoStream(videoStream); setMainVideoStream(videoStream);
setMainAudioStream(audioStream); setMainAudioStream(audioStream);
@ -1915,7 +1915,6 @@ const App = memo(() => {
currentSegIndexSafe={currentSegIndexSafe} currentSegIndexSafe={currentSegIndexSafe}
invertCutSegments={invertCutSegments} invertCutSegments={invertCutSegments}
inverseCutSegments={inverseCutSegments} inverseCutSegments={inverseCutSegments}
mainVideoStream={mainVideoStream}
formatTimecode={formatTimecode} formatTimecode={formatTimecode}
timelineHeight={timelineHeight} timelineHeight={timelineHeight}
onZoomWindowStartTimeChange={setZoomWindowStartTime} onZoomWindowStartTimeChange={setZoomWindowStartTime}
@ -1963,6 +1962,7 @@ const App = memo(() => {
/> />
<RightMenu <RightMenu
hasVideo={hasVideo}
isRotationSet={isRotationSet} isRotationSet={isRotationSet}
rotation={rotation} rotation={rotation}
areWeCutting={areWeCutting} areWeCutting={areWeCutting}

@ -726,6 +726,10 @@ export const defaultProcessedCodecTypes = [
'attachment', 'attachment',
]; ];
export function isStreamThumbnail(stream) {
return stream && stream.disposition && stream.disposition.attached_pic === 1;
}
export function getStreamFps(stream) { export function getStreamFps(stream) {
const match = typeof stream.avg_frame_rate === 'string' && stream.avg_frame_rate.match(/^([0-9]+)\/([0-9]+)$/); const match = typeof stream.avg_frame_rate === 'string' && stream.avg_frame_rate.match(/^([0-9]+)\/([0-9]+)$/);
if (stream.codec_type === 'video' && match) { if (stream.codec_type === 'video' && match) {

Loading…
Cancel
Save