file in abyss
フォーマット一覧へ戻る

Video

WEBM WebM

Web向けのMatroska派生コンテナ。EBMLヘッダの1A 45 DF A3から始まります。

Extensions .webm
MIME video/webm, audio/webm

マジックナンバー

ファイルを解析
オフセット 0 EBML header
1A 45 DF A3
.E..

構造

  1. EBML header
  2. Segment
  3. Tracks
  4. Clusters

注意点

  • Matroska/MKVも同じEBMLヘッダから始まるため、DocType確認が必要です。

判定コード例

SIGNATURE = bytes.fromhex("1a45dfa3")
OFFSET = 0

def is_webm(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

WebM は動画プレビュー、エンコード確認、レスポンシブUIのテスト、アップロード処理で使われます。コンテナとコーデックは別の問題なので、先頭バイトだけでは再生可否は判断できません。

よくある判定ミス

  • .webm という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • WebM は 1A 45 DF A3 のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

メディアファイルも、壊れたメタデータ・極端な寸法・長い再生時間・異常なチャンクでデコーダに負荷をかけることがあります。処理前にサイズ・寸法・長さを読み取ってください。

サンプルの活用

11 個のサンプルで、再生時間の処理・再生開始・メタデータ読み取り・ダウンロード挙動をテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
Vid

1s Color WebM

1s Color WebM is a WebM sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

color-1s.webm
Type Sample
1.1 KB
Generated CC0 1.0
SHA-256 88220401c1596062f3a8bc36ac08fc8eab0849006c443ddc12286b7dd81a1699
Download
Vid

Cloud Flight WEBM 0.5s

Cloud Flight WEBM 0.5s is a WebM sample based on Wikimedia Commons, 160 x 284, 0.5s. It can be used to test downloads, parsers, previews, and file type detection.

01-flight-over-clouds.webm
Resolution 160 x 284 45 Kpx
PreviewShort clip
15 KB
SHA-256 4f8795ff434b987b64523f6aba51be11e304da71d8396ce78ba83dd2bfb098b6
Download
Vid

Cloud Flight WEBM 1s

Cloud Flight WEBM 1s is a WebM sample based on Wikimedia Commons, 240 x 426, 1s. It can be used to test downloads, parsers, previews, and file type detection.

02-flight-over-clouds.webm
Resolution 240 x 426 102 Kpx
Preview1s media
30 KB
SHA-256 dd5b30623c6daa77d60c793b86d973a799140e836c92c4d96610e43e9bc53bd5
Download
Vid

Cloud Flight WEBM 1.5s

Cloud Flight WEBM 1.5s is a WebM sample based on Wikimedia Commons, 320 x 568, 1.5s. It can be used to test downloads, parsers, previews, and file type detection.

03-flight-over-clouds.webm
Resolution 320 x 568 182 Kpx
Preview1.5s media
41 KB
SHA-256 0cbdf422385dc969242f6b7b9205c52f3b1f53e1b2aaeb739c2f0ef787b12c2c
Download
Vid

Cloud Flight WEBM 2s

Cloud Flight WEBM 2s is a WebM sample based on Wikimedia Commons, 480 x 854, 2s. It can be used to test downloads, parsers, previews, and file type detection.

04-flight-over-clouds.webm
Resolution 480 x 854 410 Kpx
Preview2s media
51 KB
SHA-256 22e8050151f15b8bd26b6d5330f7d78330cf47c989d035599fa09722b2faa84b
Download
Vid

Cloud Flight WEBM 3s

Cloud Flight WEBM 3s is a WebM sample based on Wikimedia Commons, 640 x 1138, 3s. It can be used to test downloads, parsers, previews, and file type detection.

05-flight-over-clouds.webm
Resolution 640 x 1138 728 Kpx
Preview3s media
82 KB
SHA-256 c3c94f61d6af9ccc72bceedcbc7211fbc0360e6c2210630d65279e9e8af7168d
Download
Vid

Cloud Flight WEBM 4s

Cloud Flight WEBM 4s is a WebM sample based on Wikimedia Commons, 720 x 1280, 4s. It can be used to test downloads, parsers, previews, and file type detection.

06-flight-over-clouds.webm
Resolution 720 x 1280 922 Kpx
Preview4s media
109 KB
SHA-256 e820dd77bbe9618d9d3d3f6fe2813027911e1932faf50363ba5c8f37399cecb8
Download
Vid

Cloud Flight WEBM 5s

Cloud Flight WEBM 5s is a WebM sample based on Wikimedia Commons, 854 x 1518, 5s. It can be used to test downloads, parsers, previews, and file type detection.

07-flight-over-clouds.webm
Resolution 854 x 1518 1.3 MP
Preview5s media
131 KB
SHA-256 77c5c24769695148b130924796d6438f2aa6475560a265950ca6304256180a83
Download
Vid

Cloud Flight WEBM 6s

Cloud Flight WEBM 6s is a WebM sample based on Wikimedia Commons, 960 x 1706, 6s. It can be used to test downloads, parsers, previews, and file type detection.

08-flight-over-clouds.webm
Resolution 960 x 1706 1.6 MP
Preview6s media
173 KB
SHA-256 94c9fd21e74b0fb6a76654629230bb884486973f356452f39fa4b541bcb7947f
Download
Vid

Cloud Flight WEBM 8s

Cloud Flight WEBM 8s is a WebM sample based on Wikimedia Commons, 1080 x 1920, 8s. It can be used to test downloads, parsers, previews, and file type detection.

09-flight-over-clouds.webm
Resolution 1080 x 1920 2.1 MP
High res8s media
217 KB
SHA-256 f6ec21e5f4c03c5c14bf6eba1b6e398261a3217d4e35614034bbdc633029c611
Download
Vid

NASA Clouds WEBM

NASA Clouds WEBM is a WebM sample based on NASA Image and Video Library, 480 x 270, 2s. It can be used to test downloads, parsers, previews, and file type detection.

nasa-clouds-orbit.webm
Resolution 480 x 270 130 Kpx
Preview2s media
80 KB
SHA-256 ea9f8789a512641c556a43e75a6e1e59324f2e5eddd656dfd047e6ea25f9b063
Download

よくある質問

WebM のマジックナンバー(ファイルシグネチャ)は?

WebM ファイルはバイトシグネチャ 1A 45 DF A3 (".E..") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

WebM のMIMEタイプは?

WebM のMIMEタイプは video/webm, audio/webm です。

WebM の拡張子は?

WebM ファイルは .webm 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。

関連フォーマット