Skip to content

FFmpeg commands every Mac user can copy

A tested FFmpeg cheat sheet for macOS: remux MKV to MP4, extract audio, cut video without re-encoding, and compress with VideoToolbox hardware.

In short

  • Stream copying (-c copy) remuxes MKV to MP4 in seconds with zero loss in visual quality or battery waste.
  • Hardware-accelerated encoding via hevc_videotoolbox taps directly into Apple Silicon's Media Engine for rapid compression.
  • Cutting video without re-encoding requires snapping to keyframes, which can cause slight start-point offsets.
  • MacLC performs these stream-parsing and format-handling tasks automatically in real time during playback.
On this page
  1. How do you inspect a video file’s streams and metadata?
  2. How do you remux MKV to MP4 without re-encoding?
  3. How do you extract audio from a video file?
  4. How do you trim or cut a video without losing quality?
  5. How do you compress video using Apple Silicon hardware encoding?
  6. How do you extract or burn subtitles using FFmpeg?
  7. What to do next

The most useful FFmpeg commands on a Mac are container remuxing, lossless stream cutting, audio extraction, and hardware-accelerated compression. Instead of waiting hours for video editors to re-encode your footage, FFmpeg can manipulate existing media streams in seconds when you use the right terminal flags.

Below is a curated, tested cheat sheet designed specifically for macOS and Apple Silicon. Every recipe uses exact syntax, avoids unnecessary re-encoding whenever possible, and explains what each flag does so you understand exactly what Terminal is doing to your files.

How do you inspect a video file’s streams and metadata?

Before converting or cutting a media file, you should always check what streams, codecs, and tracks are packed inside it. You can do this with ffprobe, the stream analyzer included with FFmpeg:

ffprobe -hide_banner -i input.mp4

Explaining the flags:

  • ffprobe: Invokes the stream analysis companion tool included with your FFmpeg installation.
  • -hide_banner: Suppresses the multi-line copyright notice and build configuration text, keeping your terminal output clean and readable.
  • -i input.mp4: Specifies the path to your source media file.

Terminal will output a detailed hierarchy of the file. Look at the bottom lines labeled Stream #0:0, Stream #0:1, and so on. You will see whether the video track is H.264, HEVC, or AV1, the color space (such as BT.709 for SDR or BT.2020 for HDR), the audio codec (AAC, AC-3, FLAC), and any embedded subtitle tracks.

If you prefer clean JSON output that you can pipe into scripts, run:

ffprobe -v error -show_format -show_streams -print_format json input.mkv

For a deeper dive into interpreting color primaries and transfer characteristics, see our guide on how to use ffprobe.

How do you remux MKV to MP4 without re-encoding?

If QuickTime Player refuses to open an MKV file containing standard H.264 or HEVC video, you do not need to re-encode the video. You can repackage the streams into an MP4 container losslessly in two to three seconds:

ffmpeg -i input.mkv -map 0:v -map 0:a -c copy -movflags +faststart output.mp4

Explaining the flags:

  • -i input.mkv: Designates the input file you wish to convert.
  • -map 0:v -map 0:a: Keeps every video and audio track. Text subtitles in MKV (SRT, ASS) cannot be copied into MP4 as they are, so they are left out here; convert them with -map 0:s -c:s mov_text if you need them.
  • -c copy: Copies the streams as they are, without decompressing or recompressing a single frame.
  • -movflags +faststart: Relocates the MP4 container’s index metadata (the moov atom) from the end of the file to the very beginning. This allows the video to begin playing immediately in QuickTime or over a local network before the entire file is read.
  • output.mp4: Sets the destination file name and container format.

Because -c copy skips the encoder entirely, this operation causes 0.0% generation loss in picture quality and uses almost zero battery power on your MacBook. To understand why containers cause compatibility headaches in the first place, read our comparison of MKV vs MP4 and our dedicated guide on how to convert MKV to MP4 on Mac.

How do you extract audio from a video file?

If you want to save a music track, lecture, or podcast from a video file without keeping the bulky video data, you can extract the audio track directly.

Extracting the original audio stream losslessly:

ffmpeg -i input.mp4 -vn -c:a copy output.aac

Explaining the flags:

  • -i input.mp4: The source video containing the audio track.
  • -vn: Disables video recording (“video none”), completely discarding the video stream so only audio remains.
  • -c:a copy: Copies the audio stream directly without re-encoding or recompressing audio samples.
  • output.aac: The output audio file (use .aac if the original audio is AAC, or .m4a if you prefer an Apple-friendly wrapper).

Converting the audio to a high-quality MP3:

If the source audio is in a format your car stereo or older device cannot read, convert it to high-quality variable bitrate MP3:

ffmpeg -i input.mp4 -vn -c:a libmp3lame -q:a 2 output.mp3

Explaining the flags:

  • -c:a libmp3lame: Selects the LAME open-source MP3 encoder.
  • -q:a 2: Sets LAME’s variable bitrate (VBR) quality level to 2 (roughly 190 kbps average bitrate), providing exceptional audio fidelity while maintaining compact file size.

How do you trim or cut a video without losing quality?

Trimming unwanted footage from the beginning or end of a video clip can be completed in seconds using stream copying.

ffmpeg -ss 00:01:30 -to 00:03:00 -i input.mp4 -c copy output.mp4

Explaining the flags:

  • -ss 00:01:30: Sets the starting seek timestamp (1 minute and 30 seconds into the video). Placing -ss before -i enables fast seeking based on container keyframe indexes.
  • -to 00:03:00: Sets the ending timestamp (cuts the video at exactly the 3-minute mark of the original file).
  • -i input.mp4: Specifies the input video.
  • -c copy: Copies the selected slice without decoding or re-encoding.
  • output.mp4: The trimmed output file.

The critical keyframe caveat:

When using -c copy, FFmpeg cannot split a video on an arbitrary individual frame. Highly compressed video codecs like H.264 and HEVC organize video into Groups of Pictures (GOPs). The only complete standalone images are keyframes (also called I-frames); all intervening frames (P-frames and B-frames) merely describe mathematical differences between keyframes.

If your timestamp -ss 00:01:30 falls between keyframes, FFmpeg must begin copying from the nearest preceding keyframe. If you attempt to force a cut in the middle of a GOP without re-encoding, players will show blank or frozen frames until the next keyframe arrives. If you require frame-accurate, precise cuts, you must re-encode the video segment. Learn more about how compression frames work in our explainer on what is a keyframe.

How do you compress video using Apple Silicon hardware encoding?

When you need to shrink a large 4K camera file or screen recording down to a shareable size, using your Mac’s CPU cores with software encoders like libx265 can take hours. Apple Silicon M-series chips include dedicated hardware encoders inside the Media Engine, accessible via macOS’s native VideoToolbox framework.

Compressing with Apple VideoToolbox HEVC (H.265):

ffmpeg -i input.mov -c:v hevc_videotoolbox -b:v 4000k -tag:v hvc1 -c:a aac -b:a 192k output.mp4

Explaining the flags:

  • -i input.mov: The large source recording or exported editing master.
  • -c:v hevc_videotoolbox: Instructs FFmpeg to bypass the CPU and use Apple Silicon’s hardware HEVC encoder on the M1, M2, M3, or M4 chip.
  • -b:v 4000k: Sets the target video bitrate to 4,000 kilobits per second (4 Mbps), which delivers excellent quality for 1080p and lightweight 4K streaming.
  • -tag:v hvc1: Crucial for Apple compatibility. Tags the video stream with the FourCC code hvc1, ensuring the video plays natively in Apple QuickTime Player, Safari, and Apple TV without showing a blank screen.
  • -c:a aac: Compresses the soundtrack using the standard AAC audio codec.
  • -b:a 192k: Sets the audio bitrate to a crisp 192 kbps stereo.
  • output.mp4: The resulting compressed MP4 file.

Compressing with Apple VideoToolbox H.264:

For maximum backward compatibility with older smart TVs and legacy operating systems, encode with hardware H.264 instead:

ffmpeg -i input.mov -c:v h264_videotoolbox -b:v 6000k -c:a aac -b:a 192k output.mp4

Because H.264 is roughly 50% less compression-efficient than HEVC, setting a slightly higher bitrate of 6,000 kbps (-b:v 6000k) ensures equivalent visual sharpness.

How do you extract or burn subtitles using FFmpeg?

Managing subtitles is one of FFmpeg’s most popular use cases, whether you want to extract a text track for translation or permanently burn styled subtitles into the picture for social media.

Extracting a subtitle track from an MKV file:

ffmpeg -i input.mkv -map 0:s:0 output.srt

Explaining the flags:

  • -i input.mkv: The source file containing embedded subtitles.
  • -map 0:s:0: Selects the first subtitle stream (s:0) from the first input file (0). If a movie contains multiple subtitle tracks (e.g. English, French, Spanish), you can target the second track with -map 0:s:1.
  • output.srt: Instructs FFmpeg to convert and save the subtitle stream into the universal SubRip (.srt) plain-text format. If the source subtitles contain advanced styles (such as anime fansubs), use -c:s copy output.ass to preserve the typography.

Burning subtitles permanently into a video (hardsubbing):

If you are uploading a clip to a platform that does not support soft subtitle tracks, you can burn the text directly into the video frames:

ffmpeg -i input.mp4 -vf "subtitles=subs.srt" -c:v hevc_videotoolbox -b:v 4000k -tag:v hvc1 -c:a copy output.mp4

Explaining the flags:

  • -vf "subtitles=subs.srt": Invokes FFmpeg’s video filter engine to render the text from subs.srt over the image frames using the libass typography library.
  • -c:v hevc_videotoolbox -b:v 4000k -tag:v hvc1: Burning subtitles alters pixel data, which means the video stream must be re-encoded. Using VideoToolbox hardware acceleration ensures the re-encoding pass finishes in seconds rather than minutes.
  • -c:a copy: Preserves the original audio track without recompression.

What to do next

Keep these command recipes handy whenever you need to prepare files for mobile devices, strip audio for offline listening, or fix incompatible container formats. If you have not yet set up FFmpeg in your macOS terminal, follow our step-by-step instructions in how to install FFmpeg on Mac.

If your goal is to sit back and watch your movie collection, you do not need to spend time running terminal commands. Download MacLC for Apple Silicon, drop your MKV, WebM, or MOV files straight into the player, and enjoy instant hardware-accelerated playback with full subtitle support right out of the box.

Questions people ask

Why is remuxing MKV to MP4 so fast in FFmpeg?

Remuxing with -c copy only restructures the container wrapper around existing video and audio streams. Because FFmpeg does not decompress or re-encode pixels, the process runs at drive read-write speed in two to five seconds.

Why does my cut video have a frozen frame at the beginning?

When you cut video without re-encoding using -c copy, FFmpeg must start the new file on a keyframe (I-frame). If your chosen timestamp lands between keyframes, the video will freeze until the first keyframe arrives.

What does the -tag:v hvc1 flag do in FFmpeg?

Apple applications like QuickTime Player, Safari, and Apple TV require HEVC streams inside MP4 containers to have the hvc1 identifier tag. Without -tag:v hvc1, QuickTime will display a black screen or refuse to open the file.

How do I check if my Mac is using hardware acceleration in FFmpeg?

Run ffmpeg -encoders in Terminal and look for h264_videotoolbox and hevc_videotoolbox. If present, FFmpeg is utilizing Apple Silicon's hardware Media Engine.

Before you download

MacLC is free. If it is useful to you, a gift helps it skip “Open Anyway” and funds the next release.