Skip to content

Commit

Permalink
improve thumbnail check #308
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi committed Apr 18, 2020
1 parent 34b5a47 commit b48f58b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/App.jsx
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1915,7 +1915,6 @@ const App = memo(() => {
currentSegIndexSafe={currentSegIndexSafe}
invertCutSegments={invertCutSegments}
inverseCutSegments={inverseCutSegments}
mainVideoStream={mainVideoStream}
formatTimecode={formatTimecode}
timelineHeight={timelineHeight}
onZoomWindowStartTimeChange={setZoomWindowStartTime}
Expand Down Expand Up @@ -1963,6 +1962,7 @@ const App = memo(() => {
/>

<RightMenu
hasVideo={hasVideo}
isRotationSet={isRotationSet}
rotation={rotation}
areWeCutting={areWeCutting}
Expand Down
4 changes: 4 additions & 0 deletions src/ffmpeg.js
Expand Up @@ -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) {
Expand Down

0 comments on commit b48f58b

Please sign in to comment.