Skip to content

The swiss army knife of lossless video/audio editing

Allow copying selected segments to clipboard

Mikael Finstad44813b4f3970
diff --git a/public/configStore.js b/public/configStore.js
index 0c179519..bd8c927e 100644
--- a/public/configStore.js
+++ b/public/configStore.js
@@ -62,6 +62,9 @@ const defaultKeyBindings = [
{ keys: 'ctrl+shift+z', action: 'redo' },
{ keys: 'command+shift+z', action: 'redo' },
+ { keys: 'ctrl+c', action: 'copySegmentsToClipboard' },
+ { keys: 'command+c', action: 'copySegmentsToClipboard' },
+
{ keys: 'enter', action: 'labelCurrentSegment' },
{ keys: 'e', action: 'export' },
diff --git a/src/App.jsx b/src/App.jsx
index a2870bdf..5cadea09 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -61,7 +61,7 @@ import {
} from './ffmpeg';
import { shouldCopyStreamByDefault, getAudioStreams, getRealVideoStreams, isAudioDefinitelyNotSupported, willPlayerProperlyHandleVideo, doesPlayerSupportHevcPlayback, isStreamThumbnail } from './util/streams';
import { exportEdlFile, readEdlFile, saveLlcProject, loadLlcProject, askForEdlImport } from './edlStore';
-import { formatYouTube, getFrameCountRaw } from './edlFormats';
+import { formatYouTube, getFrameCountRaw, formatTsv } from './edlFormats';
import {
getOutPath, getSuffixedOutPath, handleError, getOutDir,
isMasBuild, isStoreBuild, dragPreventer,
@@ -1790,6 +1790,11 @@ const App = memo(() => {
const toggleLoopSelectedSegments = useCallback(() => togglePlay({ resetPlaybackRate: true, playbackMode: 'loop-selected-segments' }), [togglePlay]);
+ const copySegmentsToClipboard = useCallback(async () => {
+ if (!checkFileOpened()) return;
+ electron.clipboard.writeText(await formatTsv(selectedSegments));
+ }, [checkFileOpened, selectedSegments]);
+
const onKeyPress = useCallback(({ action, keyup }) => {
function seekReset() {
seekAccelerationRef.current = 1;
@@ -1891,6 +1896,7 @@ const App = memo(() => {
shiftAllSegmentTimes,
increaseVolume: () => setPlaybackVolume((val) => Math.min(1, val + 0.07)),
decreaseVolume: () => setPlaybackVolume((val) => Math.max(0, val - 0.07)),
+ copySegmentsToClipboard,
};
function tryMainActions() {
@@ -1933,7 +1939,7 @@ const App = memo(() => {
if (match) return bubble;
return true; // bubble the event
- }, [addSegment, alignSegmentTimesToKeyframes, askSetStartTimeOffset, batchFileJump, batchOpenSelectedFile, captureSnapshot, captureSnapshotAsCoverArt, changePlaybackRate, cleanupFilesDialog, clearSegments, closeBatch, closeExportConfirm, combineOverlappingSegments, concatCurrentBatch, concatDialogVisible, convertFormatBatch, createFixedDurationSegments, createNumSegments, createRandomSegments, currentSegIndexSafe, cutSegmentsHistory, deselectAllSegments, exportConfirmVisible, extractAllStreams, extractCurrentSegmentFramesAsImages, fillSegmentsGaps, goToTimecode, increaseRotation, invertAllSegments, invertSelectedSegments, jumpCutEnd, jumpCutStart, jumpSeg, jumpTimelineEnd, jumpTimelineStart, keyboardNormalSeekSpeed, keyboardSeekAccFactor, keyboardShortcutsVisible, onExportConfirm, onExportPress, onLabelSegment, pause, play, removeCutSegment, removeSelectedSegments, reorderSegsByStartTime, seekClosestKeyframe, seekRel, seekRelPercent, selectAllSegments, selectOnlyCurrentSegment, setCutEnd, setCutStart, setPlaybackVolume, shiftAllSegmentTimes, shortStep, shuffleSegments, splitCurrentSegment, timelineToggleComfortZoom, toggleCaptureFormat, toggleCurrentSegmentSelected, toggleKeyboardShortcuts, toggleKeyframeCut, toggleLastCommands, toggleLoopSelectedSegments, togglePlay, toggleSegmentsList, toggleStreamsSelector, toggleStripAudio, tryFixInvalidDuration, userHtml5ifyCurrentFile, zoomRel]);
+ }, [addSegment, alignSegmentTimesToKeyframes, askSetStartTimeOffset, batchFileJump, batchOpenSelectedFile, captureSnapshot, captureSnapshotAsCoverArt, changePlaybackRate, cleanupFilesDialog, clearSegments, closeBatch, closeExportConfirm, combineOverlappingSegments, concatCurrentBatch, concatDialogVisible, convertFormatBatch, copySegmentsToClipboard, createFixedDurationSegments, createNumSegments, createRandomSegments, currentSegIndexSafe, cutSegmentsHistory, deselectAllSegments, exportConfirmVisible, extractAllStreams, extractCurrentSegmentFramesAsImages, fillSegmentsGaps, goToTimecode, increaseRotation, invertAllSegments, invertSelectedSegments, jumpCutEnd, jumpCutStart, jumpSeg, jumpTimelineEnd, jumpTimelineStart, keyboardNormalSeekSpeed, keyboardSeekAccFactor, keyboardShortcutsVisible, onExportConfirm, onExportPress, onLabelSegment, pause, play, removeCutSegment, removeSelectedSegments, reorderSegsByStartTime, seekClosestKeyframe, seekRel, seekRelPercent, selectAllSegments, selectOnlyCurrentSegment, setCutEnd, setCutStart, setPlaybackVolume, shiftAllSegmentTimes, shortStep, shuffleSegments, splitCurrentSegment, timelineToggleComfortZoom, toggleCaptureFormat, toggleCurrentSegmentSelected, toggleKeyboardShortcuts, toggleKeyframeCut, toggleLastCommands, toggleLoopSelectedSegments, togglePlay, toggleSegmentsList, toggleStreamsSelector, toggleStripAudio, tryFixInvalidDuration, userHtml5ifyCurrentFile, zoomRel]);
useKeyboard({ keyBindings, onKeyPress });
diff --git a/src/components/KeyboardShortcuts.jsx b/src/components/KeyboardShortcuts.jsx
index 9cb98201..5d103098 100644
--- a/src/components/KeyboardShortcuts.jsx
+++ b/src/components/KeyboardShortcuts.jsx
@@ -481,6 +481,10 @@ const KeyboardShortcuts = memo(({
name: t('Redo'),
category: otherCategory,
},
+ copySegmentsToClipboard: {
+ name: t('Copy selected segments times to clipboard'),
+ category: otherCategory,
+ },
closeActiveScreen: {
name: t('Close current screen'),
category: otherCategory,