DEV Community

Cover image for How to shorten a video by deleting words from its transcript
Hanako H.
Hanako H.

Posted on

How to shorten a video by deleting words from its transcript

An interview answer that runs twice as long as it should is usually fixed on a timeline: play, stop, scrub back, find the start of the tangent, split, find its end, split again, delete, listen to the join. Text-based editing turns that around. The clip is transcribed with a start and end time for every word, you delete the words you don't want as if you were editing a document, and the editor cuts the video at those times. The steps below do this in the video editor of the osFoundry desktop app, on a 37.3-second NASA interview clip in which astronaut Christina Koch answers what makes a good astronaut. It ends up at 18.5 seconds.

Open the transcript

Add the clip to a project in the video editor, select it on the timeline, and click Transcript under the preview. The panel opens below the editor with a Transcribe button.

The transcript panel before transcribing

Click Transcribe. The editor strips the clip down to its sound, 16 kHz mono, and sends only that to the transcription model set up in the app, through your own key. That is the only step in the whole process that uses a model or costs anything; deleting words and applying the cuts happen on your computer with ffmpeg.

The model has to return word timings. A model that only returns plain text is refused with a message, rather than having the text spread evenly over the clip, because evenly spread words start in sync and drift away from what is being said.

The transcribed answer, one word per time span

Delete the words, not the time

Each word on screen is a span of the clip. Drag across the part you don't need and click Delete. In this answer, that was the middle stretch, from "and to be your most efficient" to "continue to contribute and to be efficient", and the sign-off at the end, "definitely would love for you guys to apply".

The deleted words stay on screen, crossed out

Nothing has been cut yet. The deleted words stay in the panel, crossed out, so you can still read what was removed, and the counter on the right adds up the time: −18.8 s of 37.3 s here. If a drag went one word too far, Restore all brings everything back. The transcript is a view of the clip, not a document, so there is no way to type new words into it; you can only take words away.

It also pays to read the sentence around each cut before applying. A cut that removes "and" or "so" at the start of the next sentence often sounds more natural than one that keeps it, and the crossed-out view makes that easy to check.

Apply the cuts

Click Apply cuts. The editor works out which parts of the clip survive, cuts picture and sound in the same ffmpeg pass so they stay in sync, and writes the result as a new file next to the original (my-answer.mp4.trimmed.mp4 here). The original clip is not changed.

The message after applying: 18.8 s removed across 3 cuts

Two details decide whether the result sounds edited or natural. Cut points are moved to the nearest frame boundary before cutting, so the time on screen is the time ffmpeg actually uses. And the pauses between kept words are kept. Only the time a deleted word occupies goes; the breath before the next sentence stays, so the answer doesn't turn into the breathless jump-cut sound of a clip where every silence was removed.

The shortened answer is 18.5 seconds and reads as one thought: adaptability helps you be your best and work as a team member on and off the space station.

Doing it without the app

Premiere Pro, DaVinci Resolve and Descript all have text-based editing, and they work the same way: transcribe, delete text, let the editor cut. Without any editor, the same result takes a word-timed transcript (Whisper can produce one) and a single ffmpeg command that trims video and audio together; cutting each piece with -c copy and joining them is faster but tends to drift out of sync. Either way, keep the original file and listen to every join before exporting.

The video editor is listed as osFoundry's canvas video editor, and the app is free from the osFoundry download page for macOS, Windows and Linux.

Top comments (0)