Skip to content

Commit

Permalink
allowing a file with only a video or audio stream to load info
Browse files Browse the repository at this point in the history
also showing video fps
  • Loading branch information
catdad committed May 11, 2024
1 parent db94d63 commit 001197d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions renderer/VideoInfo/VideoInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ const FileInput = require('../FileInput/FileInput.js');
css('../styles/tab-panel.css');
css('./VideoInfo.css');

const fps = value => {
return /^[0-9]{1,}\/[0-9]{1,}$/.test(value) ?
+eval(value).toFixed(2) :
'unknown';
};

function VideoInfo() {
const metadata = useSignal([]);

Expand Down Expand Up @@ -58,8 +64,8 @@ function VideoInfo() {

const seconds = get(file, 'video.duration', 0);
const duration = prettyMs(Number(seconds) * 1000);
const videoSummary = `${video.codec_name} (${video.width}x${video.height})`;
const audioSummary = `${audio.codec_name} (${audio.channels} channels)`;
const videoSummary = video ? `${video.codec_name} (${video.width}x${video.height}) (${fps(video.r_frame_rate)} fps)` : 'N/A';
const audioSummary = audio ? `${audio.codec_name} (${audio.channels} channels)` : 'N/A';

// this object sets the order of the UI
// yes, I know order is technically not guaranteed, but it works
Expand Down

0 comments on commit 001197d

Please sign in to comment.