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

Audio

FLAC Free Lossless Audio Codec

可逆圧縮音声形式。先頭のfLaCマーカーに続いてメタデータブロックが並びます。

Extensions .flac
MIME audio/flac

マジックナンバー

ファイルを解析
オフセット 0 FLAC stream marker
66 4C 61 43
fLaC

構造

  1. fLaC marker
  2. Metadata blocks
  3. Audio frames

注意点

  • Ogg FLACはOggコンテナに格納されるため、先頭はOggSになります。

判定コード例

SIGNATURE = bytes.fromhex("664c6143")
OFFSET = 0

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

実践的な使い方

ユースケース

Free Lossless Audio Codec は再生、波形処理、アップロードチェック、再生時間の処理、ビットレート検証などで使われます。短いクリップ・無音・環境音はプレイヤーや変換の境界条件を洗い出すのに役立ちます。

よくある判定ミス

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

セキュリティ上の注意

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

サンプルの活用

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

サンプルファイル

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

1s Silence FLAC

1s Silence FLAC is a Free Lossless Audio Codec sample generated for file format testing. It can be used to test downloads, parsers, previews, and file type detection.

silence-1s.flac
Type Sample
8.2 KB
Generated CC0 1.0
SHA-256 cdba7687ad24b2e1daeec9ab7931b5dcef1a7bfc4041f42b0c8dba54b6627c8c
Download
Aud

Lake Waves FLAC 0.25s

Lake Waves FLAC 0.25s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 0.25s. It can be used to test downloads, parsers, previews, and file type detection.

01-lake-waves.flac
Duration 0.25s
Short clip
36 KB
SHA-256 a2a9abf98b984e8f4b75868424efe7e6a0259035199806bc360a218c5094e37f
Download
Aud

Lake Waves FLAC 0.5s

Lake Waves FLAC 0.5s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 0.5s. It can be used to test downloads, parsers, previews, and file type detection.

02-lake-waves.flac
Duration 0.5s
Short clip
92 KB
SHA-256 4402cc654d9b53bd5d0da473444823a75a48804e523625bce9d8d3832700f159
Download
Aud

Lake Waves FLAC 1s

Lake Waves FLAC 1s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 1s. It can be used to test downloads, parsers, previews, and file type detection.

03-lake-waves.flac
Duration 1s
1s media
188 KB
SHA-256 518668c05cc50be5eb561bc8bd7ba1b818eb03adfc84585b2aaf3e6ebd69f975
Download
Aud

Lake Waves FLAC 1.5s

Lake Waves FLAC 1.5s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 1.5s. It can be used to test downloads, parsers, previews, and file type detection.

04-lake-waves.flac
Duration 1.5s
1.5s media
266 KB
SHA-256 113dafd18746bca254946cce2677875514c1fe831966e197725641b719897326
Download
Aud

Lake Waves FLAC 2s

Lake Waves FLAC 2s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 2s. It can be used to test downloads, parsers, previews, and file type detection.

05-lake-waves.flac
Duration 2s
2s media
348 KB
SHA-256 447e394320105cfd3638e6e0d044dcd601fc3b201b606162d26b5039f530d0d3
Download
Aud

Lake Waves FLAC 3s

Lake Waves FLAC 3s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 3s. It can be used to test downloads, parsers, previews, and file type detection.

06-lake-waves.flac
Duration 3s
3s media
544 KB
SHA-256 5906188852edd4063e7617796db09fc91c039355214dc68952d35f2e43c31b4c
Download
Aud

Lake Waves FLAC 4s

Lake Waves FLAC 4s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 4s. It can be used to test downloads, parsers, previews, and file type detection.

07-lake-waves.flac
Duration 4s
4s media
686 KB
SHA-256 18d16d1cf1f35d06208a2c87e4a80bcab46dac2e288e3196792c39c4cb239c9c
Download
Aud

Lake Waves FLAC 6s

Lake Waves FLAC 6s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 6s. It can be used to test downloads, parsers, previews, and file type detection.

08-lake-waves.flac
Duration 6s
6s media
1011 KB
SHA-256 a149d798b4b0c44869b064a8beb0a3ba85ff25e5dda4233c38c8029cdcdd4a2d
Download
Aud

Lake Waves FLAC 8s

Lake Waves FLAC 8s is a Free Lossless Audio Codec sample based on Wikimedia Commons, 8s. It can be used to test downloads, parsers, previews, and file type detection.

09-lake-waves.flac
Duration 8s
8s mediaLarge file
1.30 MB
SHA-256 647745114c8ea0a232150c686a315752efae6e57d0643466c6cb6c3e018fa4ed
Download
Aud

NASA TV Audio FLAC

NASA TV Audio FLAC is a Free Lossless Audio Codec sample based on NASA Image and Video Library, 2s. It can be used to test downloads, parsers, previews, and file type detection.

nasa-tv-audio.flac
Duration 2s
2s media
251 KB
SHA-256 724ec58bb3b853bc43026ebebdd1ecfcf80d0f1e8e197bf22b43c5bfe503f1df
Download

よくある質問

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

Free Lossless Audio Codec ファイルはバイトシグネチャ 66 4C 61 43 ("fLaC") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

Free Lossless Audio Codec のMIMEタイプは?

Free Lossless Audio Codec のMIMEタイプは audio/flac です。

Free Lossless Audio Codec の拡張子は?

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

関連フォーマット