To shorten an existing video or remove a section from its middle, use FFmpeg from the command line. Choose between copying the video streams, which is fast but may place cuts at nearby keyframes, and re-encoding them for a more exact cut. A keyframe is a video frame FFmpeg can decode on its own. Other frames often depend on nearby frames.
For a new narrated explainer, explainroo is a free, open-source kit that uses a coding agent to create a video. It does not edit existing camera footage, so FFmpeg is the right choice for trimming footage you already have. If you use explainroo to make a new video, you can trim its finished MP4 with FFmpeg afterward.
Trim from the beginning or end
Use -ss to choose where a clip starts and -t to set its duration. This command copies the streams without re-encoding:
ffmpeg -ss 00:00:12 -i input.mp4 -t 00:00:20 -c copy output.mp4
The command starts at the chosen point and keeps the clip for the requested duration. Replace the filenames with your own. Putting -ss before -i lets FFmpeg seek through the input quickly. With -c copy, FFmpeg copies the encoded video and audio instead of decoding and encoding them again, so the operation is fast and preserves the streams’ existing quality.
Stream copying is less precise. FFmpeg may start at the nearest preceding keyframe instead of the exact requested time. If the beginning of the output looks choppy or starts early, the cut likely falls between keyframes. The FFmpeg trim examples and keyframe-cut discussion describe this limitation.
For a more precise cut, move -ss after the input and re-encode:
ffmpeg -i input.mp4 -ss 00:00:12 -t 00:00:20 \
-c:v libx264 -crf 18 -preset medium \
-c:a aac -b:a 192k output.mp4
Here FFmpeg decodes the input up to the requested start, then encodes the selected section. Re-encoding takes longer and creates new video and audio streams. The -crf and -preset options control video quality and encoding speed; adjust them to suit your needs. For exact cuts between keyframes, re-encoding is required because stream copying cannot create a new independently decodable starting frame. See the discussion of precise cuts.
Use -to when you want to specify an end time instead of a duration. For example, -ss START_TIME -to END_TIME selects the interval between those times. For a predictable clip length, -t is often simpler.
Remove a section from the middle
This command keeps the parts on either side of the section you want to remove. It resets their timestamps before joining them. It assumes the input has both video and audio:
ffmpeg -i input.mp4 -filter_complex \
"[0:v]trim=start=0:end=12,setpts=PTS-STARTPTS[v0]; \
[0:a]atrim=start=0:end=12,asetpts=PTS-STARTPTS[a0]; \
[0:v]trim=start=18,setpts=PTS-STARTPTS[v1]; \
[0:a]atrim=start=18,asetpts=PTS-STARTPTS[a1]; \
[v0][a0][v1][a1]concat=n=2:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" output.mp4
The trim filter selects video frames, while atrim selects audio samples. The setpts and asetpts filters reset the timing of each kept segment so the joined output starts at zero. The concat filter joins the two video segments and their matching audio segments. Because this filter-based approach processes the streams, it re-encodes them.
To remove a different interval, change the first segment’s end time and the second segment’s start time. If the input has no audio, remove the audio filter chains and use a video-only concat configuration. FFmpeg’s trim and timestamp filter examples cover the same basic filter pattern.
Make an explainer with explainroo, then trim it
Use explainroo when you want to make a narrated explainer or product demo from scratch. A coding agent creates the script and scene instructions, then explainroo renders the video on your computer and produces an MP4. It does not cut existing footage or provide a drag-and-drop editor.
To try it, open a coding agent that can run shell commands and give it this prompt, replacing the bracketed topic:
Make me a short explainer video about [your topic]. Use explainroo for it: follow its setup instructions.
The agent sets up explainroo and creates the video. It checks the video before giving you an MP4 file. If you want to shorten the finished video, run one of the FFmpeg commands above on that file. The project’s documentation describes setup and its code repository contains the kit.
Choose stream copying or re-encoding
Choose -c copy when you want a fast cut and want to keep the original encoded streams, even if the cut points do not land on exact frames. Use re-encoding when the start or end must land at a precise time, or when you are removing a section from the middle with filters. After either operation, check the beginning and end of the output. Check audio sync, then review transitions across any joined sections.