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

Video

AVI Audio Video Interleave

古くから使われるRIFFベースの動画コンテナ。先頭RIFFと8バイト目のAVIで識別します。

Extensions .avi
MIME video/x-msvideo

マジックナンバー

ファイルを解析
オフセット 0 RIFF container with AVI form type
52 49 46 46
RIFF

構造

  1. RIFF header
  2. AVI form type
  3. hdrl list
  4. movi list
  5. idx1 index

注意点

  • RIFFコンテナなのでWAVやWebPとの区別にform typeの確認が必要です。

判定コード例

SIGNATURE = bytes.fromhex("52494646")
OFFSET = 0

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

実践的な使い方

ユースケース

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

よくある判定ミス

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

セキュリティ上の注意

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

サンプルの活用

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

サンプルファイル

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

1s Color AVI

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

color-1s.avi
Type Sample
7.4 KB
Generated CC0 1.0
SHA-256 12c2f56f0e402db8f2abbfa4455c35204c0e7851370dc3ff926d16a052f2a13d
Download
Vid

Cloud Flight AVI 0.5s

Cloud Flight AVI 0.5s is a Audio Video Interleave 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.avi
Resolution 160 x 284 45 Kpx
PreviewShort clip
16 KB
SHA-256 9bacd84254db1f020e974d34a6acf40d57bc86dc7a69ba4e8bd4122d10efa0e7
Download
Vid

Cloud Flight AVI 1s

Cloud Flight AVI 1s is a Audio Video Interleave 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.avi
Resolution 240 x 426 102 Kpx
Preview1s media
37 KB
SHA-256 29980286d0c22d8a0418c482847f1ba80100a063f9943f0ac5e5ba1cf09a1ace
Download
Vid

Cloud Flight AVI 1.5s

Cloud Flight AVI 1.5s is a Audio Video Interleave 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.avi
Resolution 320 x 568 182 Kpx
Preview1.5s media
70 KB
SHA-256 d448039c1c8b5ed42d67c4a9be4fee29842f3b463a247c3fb7f7d0cbd223f534
Download
Vid

Cloud Flight AVI 2s

Cloud Flight AVI 2s is a Audio Video Interleave 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.avi
Resolution 480 x 854 410 Kpx
Preview2s media
161 KB
SHA-256 0f4b6d85a95e8bd68c5b9893bc90326a59d8fcaba904a3abae0fbf63c3a7d5a3
Download
Vid

Cloud Flight AVI 3s

Cloud Flight AVI 3s is a Audio Video Interleave 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.avi
Resolution 640 x 1138 728 Kpx
Preview3s media
382 KB
SHA-256 ef8d0f98bf110b00aec9fcb9815f18807926e2cbaceba6a45497aa498eaf0018
Download
Vid

Cloud Flight AVI 4s

Cloud Flight AVI 4s is a Audio Video Interleave 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.avi
Resolution 720 x 1280 922 Kpx
Preview4s media
621 KB
SHA-256 58d53a18c96c5673196ee9dd416cd8fe67030180a57ead0094e9437051e5da37
Download
Vid

Cloud Flight AVI 5s

Cloud Flight AVI 5s is a Audio Video Interleave 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.avi
Resolution 854 x 1518 1.3 MP
Preview5s mediaLarge file
1.02 MB
SHA-256 1d10e9598ce4b4c74b95b70262b202edd93e63c6d82244771bd2896e625ad076
Download
Vid

Cloud Flight AVI 6s

Cloud Flight AVI 6s is a Audio Video Interleave 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.avi
Resolution 960 x 1706 1.6 MP
Preview6s mediaLarge file
1.46 MB
SHA-256 eae4a9a28d58e32bf327d776e653ed931b6550b855b0b007484c9b08337dd130
Download
Vid

Cloud Flight AVI 8s

Cloud Flight AVI 8s is a Audio Video Interleave 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.avi
Resolution 1080 x 1920 2.1 MP
High res8s mediaLarge file
2.21 MB
SHA-256 8e7a0150bf6176e49160fd2931151f21cde6a441ffeb99e0194e43ecd6a2be4a
Download
Vid

NASA Clouds AVI

NASA Clouds AVI is a Audio Video Interleave 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.avi
Resolution 480 x 270 130 Kpx
Preview2s media
227 KB
SHA-256 126b9edfd4162627d8f70b6ea509af92e1b6bf0ffc99347d3d97820ff1f1320a
Download

よくある質問

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

Audio Video Interleave ファイルはバイトシグネチャ 52 49 46 46 ("RIFF") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

Audio Video Interleave のMIMEタイプは?

Audio Video Interleave のMIMEタイプは video/x-msvideo です。

Audio Video Interleave の拡張子は?

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

関連フォーマット