C.W.K.
Stream
Lesson 02 of 10 · published

Copy Mode — Remuxing in Seconds

~10 min · remux, copy, stream-copy

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

Why remuxing is magic

The biggest speedup in your FFmpeg life comes from -c copy. Instead of decoding and re-encoding (slow, lossy, expensive), the encoded bits stream straight from input demuxer to output muxer. A 4K hour-long file remuxes in seconds, not minutes. Quality is byte-identical because nothing was re-encoded.

The catch: copy mode only works if the codec is legal in the output container. You can copy H.264 video into MP4 but not into WebM (which requires VP8/VP9/AV1). FFmpeg will tell you with a clear error: "Could not find tag for codec h264 in stream #0, codec not currently supported in container".

When to use it

  • Container change with no quality concern: MKV → MP4 to play on Apple TV.
  • Stripping subtitles or extra audio tracks while keeping the rest untouched.
  • Trimming on keyframe boundaries (frame-perfect trimming requires re-encode — see lesson 7).
  • Joining clips that were originally encoded with identical settings (lesson 8).

When not to use it

If you need different resolution, different codec, different bitrate, or frame-accurate trimming — you have to re-encode. -c copy won't help.

Code

Plain remux·bash
# MKV → MP4, byte-identical streams, sub-second encode time
ffmpeg -i input.mkv -c copy output.mp4

# Only video copy, audio re-encoded (handy when audio is in a weird codec)
ffmpeg -i input.mkv -c:v copy -c:a aac -b:a 192k output.mp4
Remux + drop streams·bash
# Drop subtitles entirely
ffmpeg -i input.mkv -map 0 -map -0:s -c copy output.mkv

# Keep only the first video and first audio stream
ffmpeg -i input.mkv -map 0:v:0 -map 0:a:0 -c copy output.mp4
When copy fails — read the error·bash
# This will fail because WebM doesn't carry H.264
ffmpeg -i input.mp4 -c copy output.webm
# [webm @ 0x...] Only VP8 or VP9 or AV1 video and Vorbis or Opus audio
#   and WebVTT subtitles are supported for WebM.
# Could not write header for output file #0...

# Fix by re-encoding the video, optionally copying compatible audio
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus output.webm

External links

Exercise

Take a 30-minute MKV. Remux it to MP4 with ffmpeg -i in.mkv -c copy out.mp4 and time it. Then re-encode it with ffmpeg -i in.mkv -c:v libx264 -crf 23 -c:a aac out_re.mp4 and time that. Note the ratio. Verify both outputs play and that out.mp4 has identical codec_name to the input (run ffprobe on both).

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.