Free

FFmpeg: trim and convert video and extract audio

Use FFmpeg with Codex to trim or convert a video or extract audio. Check the output's duration, picture and sound before reusing the process.
Tools

Installation options

FFmpeg trims and converts video, extracts audio and builds output files from commands. Codex can run those commands on your computer and save the process for future clips.

What you can use it for

  • Cut a short segment from a long recording using timecodes.
  • Extract audio for transcription or speech cleanup.
  • Resize video, add subtitles or reduce the output file size.

For example, extract an interview's audio first, then export a selected segment with prepared subtitles. FFmpeg processes the media; segment selection and subtitle text need to be prepared separately. For complex animated inserts, consider Remotion.

How to install and check it

  1. Ask Codex to locate FFmpeg and run ffmpeg -version and ffprobe -version. ffprobe reads duration, frame dimensions and track information.
  2. If it is missing, the assistant chooses a method for your operating system. The official download page links to Linux packages and compiled Windows and macOS builds. The project itself distributes source code; a source archive is not a ready-to-run application.
  3. After an approved installation, repeat both checks in the environment that will run the commands. If the terminal cannot find the program, the assistant checks its path.

How to use it with Codex

No separate MCP is required when Codex can use the terminal and access your files. It locates the source, reads its properties and runs the command. Keep the original and write to a new output file.

Example: extracting audio from a sample input.mp4:

ffmpeg -n -i input.mp4 -vn -c:a pcm_s16le audio.wav

-vn excludes video; -n prevents overwriting an existing file. The assistant supplies the real path and checks that an audio track exists. WAV is useful for further processing but can be much larger than compressed audio. Check other operations against the FFmpeg documentation.

Where it is used

Edit a video from your footage, choosing an editing method: FFmpeg handles trimming, joining and export from an agreed plan. This card prepares the tool; the full plan takes you from recordings to a finished video.

How to check the result and fix problems

Open the output and check its beginning, ending, audio and required duration. For video, also check framing and synchronization. The assistant checks file properties with ffprobe. If playback is unavailable to it, you perform the listening and viewing check.

Missing audio: check the source tracks and the selected track first. Unsupported codec: compare the command with the codecs available in your installed build. For frame-accurate cuts, have the assistant inspect the first and last frames rather than assume stream copying can cut precisely at any timecode.

The result is a separate checked media file and a repeatable command. Continue with the video editing plan.

Prompt for processing a file

Paste into Codex or Work with access to your recordings:

Find the available media files and any existing processing plan. Ask what output I need if the project does not specify it. Check FFmpeg and ffprobe in the working environment. If installation is needed, propose a suitable official method and get my approval.
Read the source properties and prepare a short sample of the requested operation: trimming, audio extraction, resizing or export. Work on a copy without overwriting originals or existing outputs. Supply paths and parameters yourself.
After I approve the sample, build the output. Check its tracks, duration and dimensions; open and play it if available. If playback is unavailable, identify the exact sections I should watch and listen to. Save the command for reuse.
In this article
Saved