Skip to content

The swiss army knife of lossless video/audio editing

add new display format "total seconds"

Mikael Finstad2505079e31f9
diff --git a/src/renderer/src/components/Settings.tsx b/src/renderer/src/components/Settings.tsx
index dd51cb95..37b957cf 100644
--- a/src/renderer/src/components/Settings.tsx
+++ b/src/renderer/src/components/Settings.tsx
@@ -84,6 +84,7 @@ function Settings({
const timecodeFormatOptions = useMemo<Record<TimecodeFormat, string>>(() => ({
frameCount: t('Frame counts'),
+ seconds: t('Total seconds'),
timecodeWithDecimalFraction: t('Millisecond fractions'),
timecodeWithFramesFraction: t('Frame fractions'),
}), [t]);
diff --git a/src/renderer/src/hooks/useTimecode.ts b/src/renderer/src/hooks/useTimecode.ts
index efc0089e..9b72d61f 100644
--- a/src/renderer/src/hooks/useTimecode.ts
+++ b/src/renderer/src/hooks/useTimecode.ts
@@ -18,6 +18,9 @@ export default ({ detectedFps, timecodeFormat }: {
const frameCount = getFrameCount(seconds);
return frameCount != null ? String(frameCount) : '';
}
+ if (timecodeFormat === 'seconds') {
+ return seconds.toFixed(3);
+ }
if (timecodeFormat === 'timecodeWithFramesFraction') {
return formatDuration({ seconds, shorten, fileNameFriendly, fps: detectedFps });
}
@@ -31,6 +34,9 @@ export default ({ detectedFps, timecodeFormat }: {
const parsed = parseInt(val, 10);
return frameCountToDuration(parsed);
}
+ if (timecodeFormat === 'seconds') {
+ return parseFloat(val);
+ }
if (timecodeFormat === 'timecodeWithFramesFraction') {
return parseDuration(val, detectedFps);
}
diff --git a/types.ts b/types.ts
index b0fdd34a..f0fbcbdb 100644
--- a/types.ts
+++ b/types.ts
@@ -39,7 +39,7 @@ export const langNames = {
export type LanguageKey = keyof typeof langNames;
-export type TimecodeFormat = 'timecodeWithDecimalFraction' | 'frameCount' | 'timecodeWithFramesFraction';
+export type TimecodeFormat = 'timecodeWithDecimalFraction' | 'frameCount' | 'seconds' | 'timecodeWithFramesFraction';
export type AvoidNegativeTs = 'make_zero' | 'auto' | 'make_non_negative' | 'disabled';