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

Container vs Codec — 대부분 놓치는 구분

~12 min · container, codec, muxing

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

박스 와 박스 안의 물건

디스크 위 모든 미디어 파일은 두 층이야. 바깥 층은 container (또는 format): MP4, MKV, MOV, WebM, MXF, AVI, FLV. 안쪽 층은 codec: video 쪽 H.264, H.265 (HEVC), AV1, ProRes, VP9; audio 쪽 AAC, MP3, Opus, FLAC, AC-3. Container의 일은 stream interleave + timing/metadata/chapter marker 저장. Codec의 일은 실제 pixel/sample 압축 + 압축 해제.

이 구분 하나만 몸에 박히면, 모든 FFmpeg 에러 메시지가 갑자기 읽혀. "Codec not currently supported in container" 가 더 이상 미스터리가 아냐 — H.265 video를 AVI container에 넣으려 했고 그건 spec 상 불가능이라는 뜻이야.

어느 container가 어느 codec을 담는지

까다로운 container도 있고 (AVI, FLV는 옛날 + 제한적), 너그러운 것도 있어 (MKV는 거의 다 받음, MP4는 H.264/H.265/AV1 + AAC/Opus 의 모던 lingua franca). 헷갈리면:

  • MP4 — 안전한 default. 어디서나 재생. H.264/H.265/AV1 video + AAC/Opus audio.
  • MKV — 초유연. 거의 다 들어가. 다중 자막 + chapter marker 도. 하드웨어 player 호환성은 항상 좋진 않아.
  • MOV — Apple 의 MP4 변종. workflow가 QuickTime/Final Cut 일 때 써. ProRes 가 여기 살아.
  • WebM — VP9/AV1 video + Vorbis/Opus audio. 웹 streaming.

Code

container 와 codec 따로 확인·bash
# container 가 뭔지
ffprobe -v error -show_entries format=format_name,format_long_name input.mp4

# 안의 stream (codec) 들이 뭔지
ffprobe -v error -show_entries stream=codec_name,codec_long_name,codec_type input.mp4

# 출력 예시:
# stream|codec_name=h264
# stream|codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
# stream|codec_type=video
# stream|codec_name=aac
# stream|codec_long_name=AAC (Advanced Audio Coding)
# stream|codec_type=audio
container 만 바꾸기 vs codec 바꾸기·bash
# 같은 codec, 다른 container — 빠름 (re-encode 없음)
# REMUXING 이라고 불러. Track 2에 lesson 통째로 있어.
ffmpeg -i input.mkv -c copy output.mp4

# 다른 codec — 느림 (video + audio re-encode)
# TRANSCODING 이라고 불러.
ffmpeg -i input.mp4 -c:v libx265 -c:a libopus output.mkv

External links

Exercise

머신에서 MP4 하나, MOV 하나, MKV 하나 찾아. 각각 ffprobe -v error -show_entries format=format_name -show_entries stream=codec_name,codec_type 돌려. 메모: MP4랑 MOV가 codec 공유해? MKV가 MP4 못 담는 걸 담고 있어? 다음 lesson 가기 전에 세 발견 적어.

Progress

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

댓글 0

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

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