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

Copy Mode — 초 단위 Remux

~10 min · remux, copy, stream-copy

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

Remux 가 마법인 이유

FFmpeg 인생 최대 속도 향상은 -c copy 에서 와. Decode → re-encode 대신 (느림, lossy, 비쌈), 압축 bit이 input demuxer에서 output muxer로 직행. 4K 시간짜리 파일이 분 아니라 초로 remux 끝. Re-encode 안 됐으니 byte 단위 동일 품질.

Catch: copy mode는 codec이 output container에서 합법일 때만 동작. H.264 video를 MP4에 copy 가능, WebM (VP8/VP9/AV1 요구) 엔 불가. FFmpeg이 명확한 에러로 알려줘: "Could not find tag for codec h264 in stream #0, codec not currently supported in container".

언제 쓰나

  • 품질 신경 안 쓰는 container 변경: MKV → MP4 → Apple TV에서 재생.
  • 나머지 안 건드리고 자막이나 추가 audio track 빼기.
  • Keyframe 경계에서 trim (frame-perfect trim 은 re-encode 필요 — lesson 7 참조).
  • 원래 같은 setting으로 encode된 clip 합치기 (lesson 8).

언제 안 쓰나

다른 해상도, 다른 codec, 다른 bitrate, 또는 frame-accurate trim 필요하면 — re-encode 해야 해. -c copy 못 도와줘.

Code

Plain remux·bash
# MKV → MP4, byte 단위 동일 stream, sub-second encode 시간
ffmpeg -i input.mkv -c copy output.mp4

# Video 만 copy, audio re-encode (audio 가 이상한 codec 일 때 유용)
ffmpeg -i input.mkv -c:v copy -c:a aac -b:a 192k output.mp4
Remux + stream drop·bash
# 자막 통째로 drop
ffmpeg -i input.mkv -map 0 -map -0:s -c copy output.mkv

# 첫 video + 첫 audio stream 만 keep
ffmpeg -i input.mkv -map 0:v:0 -map 0:a:0 -c copy output.mp4
Copy 실패할 때 — 에러 읽어·bash
# 이건 fail — WebM이 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...

# Video re-encode로 fix, 호환 audio는 copy 가능
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus output.webm

External links

Exercise

30분 MKV 잡아. ffmpeg -i in.mkv -c copy out.mp4 로 MP4에 remux 하고 시간 측정. 그 다음 ffmpeg -i in.mkv -c:v libx264 -crf 23 -c:a aac out_re.mp4 로 re-encode 시간 측정. Ratio 메모. 둘 다 재생되는지, out.mp4가 input과 같은 codec_name인지 (ffprobe 둘 다에) 검증.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.