← Back to Audio & Video Chapter
Media Types

📁 Media Formats — Kaunsa Format Kab Use Kare

<source src="x.mp4" type="video/mp4">

Alag formats ka alag purpose hai — jaise parcel (MP4), dine-in (WebM), ya leftover (OGG) mein choose karna. Har mein tradeoffs hain: file size, quality, browser support.

Video: MP4 (H.264) = universal, WebM (VP9) = chhota aur open source, OGG = legacy. Audio: MP3 = universal, WAV = uncompressed (bahut bada), OGG = open source. Hamesha 2 formats fallback ke liye do.

🛺
Biryani Analogy: MP4 = Paradise Biryani (sabko pata, hamesha kaam karta hai). WebM = Smart Packaging Biryani (same taste, 30% kam jagah). OGG = Dadi ka Recipe (purana school, kuch browsers pehchante nahi).

Code Example

HTML — Media Formats — Kaunsa Format Kab Use Kare
<!-- Video formats -->
<video controls>
  <!-- MP4 — universal, pehla choice -->
  <source src="video.mp4" type="video/mp4">
  <!-- WebM — chhota, fallback -->
  <source src="video.webm" type="video/webm">
  Fallback text
</video>

<!-- Audio formats -->
<audio controls>
  <!-- MP3 — universal, pehla choice -->
  <source src="audio.mp3" type="audio/mpeg">
  <!-- OGG — open source, fallback -->
  <source src="audio.ogg" type="audio/ogg">
  Fallback text
</audio>

<!-- Format comparison table -->
/*
VIDEO FORMATS:
┌─────────┬──────────┬───────────┬────────────┐
│ Format  │ Quality  │ File Size │ Support    │
├─────────┼──────────┼───────────┼────────────┤
│ MP4     │ High     │ Medium    │ ALL (99%)  │
│ WebM    │ High     │ SMALL     │ Chrome,FF  │
│ OGG     │ Medium   │ Medium    │ Firefox    │
└─────────┴──────────┴───────────┴────────────┘

AUDIO FORMATS:
┌─────────┬──────────┬───────────┬────────────┐
│ Format  │ Quality  │ File Size │ Support    │
├─────────┼──────────┼───────────┼────────────┤
│ MP3     │ Good     │ Small     │ ALL (99%)  │
│ WAV     │ Best     │ HUGE      │ ALL        │
│ OGG     │ Good     │ Small     │ Chrome,FF  │
└─────────┴──────────┴───────────┴────────────┘
*/
video/mp4H.264 codec — universal support, pehla source use karo
video/webmVP9 codec — MP4 se 25-35% chhota, achha fallback
video/oggTheora codec — legacy, limited support
audio/mpegMP3 format — universal audio, pehla source use karo
audio/oggVorbis codec — open source audio, achha fallback
audio/wavUncompressed — bahut badi files, web se avoid karo
Order mattersBest format pehle rakho — browser pehla supported pick karta hai

✅ When to Use

  • MP4 primary video format ke liye (universal support)
  • WebM video fallback ke liye (chhoti files)
  • MP3 primary audio format ke liye (universal support)
  • OGG audio fallback ke liye (open source)
  • WAV sirf studio-quality downloads ke liye (streaming nahi)

❌ When NOT to Use

  • WAV web streaming ke liye (files MP3 se 10x badi hain)
  • OGG primary format ke liye (limited browser support)
  • Single format hi (hamesha fallback do)
💡
Golden rule: Video ke liye MP4 + WebM, Audio ke liye MP3 + OGG. MP4/MP3 pehle (universal), WebM/OGG doosra (fallback). Yeh 99.9% browsers cover karta hai. HandBrake (video) ya Audacity (audio) se convert karo — dono free hain.