Skip to content

Samples

Yoshihiro Yamazaki edited this page Nov 27, 2026 · 1 revision

Home > サンプル一覧

サンプル一覧

sample/ にあるスクリプトです。composer で入れた場合は vendor/yoya/io_avif/sample/ にあります。 IO_ISOBMFF の isobmff*.php のクラス名を IO_AVIF に替えたもので、オプションと出力の見方は IO_ISOBMFF のサンプル一覧 と同じです。 ファイルを書き出すものは、結果を標準出力に書くのでリダイレクトして使います。

スクリプト 使い方 内容
avifdump.php -f <avif> [-t] [-h] [-r] [-d] box の木のダンプ。-f - で標準入力
aviftree.php -f <avif> property と item の一覧
avifrebuild.php -f <avif> parse して、そのまま build する
avifdelbox.php -f <avif> -t <type>[,<type>...] [-d] 指定した type の box を消して build する
avifaddiccp.php -f <avif> -p <icc> [-d] ICC プロファイルを足して build する

例

% php sample/avifdump.php -f avif-samples/bbb_4k.avif
|
type:ftyp(offset:0 len:32):File Type and compatibility
  major:avif minor:0  alt:mif1, avif, miaf, MA1B
(omit)
|-|-|-      type:av1C(offset:246 len:26):
              marker:1 version:1 seq_profile:0 seq_level_idx_0:13
              seq_tier_0:0 high_bitdepth:0 twelve_bit:0 monochrome:0
              chroma_subsampling_x:1 chroma_subsampling_y:1
              chroma_sample_position:0 initial_presentation_delay_present:0
              configOBUs: 0a 0c 00 00 00 6a ef bf e1 bd ff f9 80 40
(omit)
% php sample/aviftree.php -f avif-samples/bbb_4k.avif
Props:
[1]: ispe width:3840 height:2160
[2]: colr subtype:nclx
[3]: av1C
[4]: pixi channels:8,8,8
Items:
[1]: pitm type:av01 ref:0 offset:409 length:30980
    (mdat:0x199,0x7904) 0A 0C 00 00 00 6A EF BF E1 BD FF F9 80 40 32 F2 ...
    [1?]ispe:3840,2160 [2?]colr:nclx [3]av1C [4?]pixi:8,8,8 
[2]: cdsc:1 type:Exif ref:0 offset:31389 length:216
    (mdat:0x7a9d,0xd8) 00 00 00 00 49 49 2A 00 08 00 00 00 02 00 98 82 ...
Warning:
% php sample/avifrebuild.php -f avif-samples/bbb_4k.avif > output.avif
% cmp avif-samples/bbb_4k.avif output.avif
% php sample/avifdelbox.php -f avif-samples/bbb_4k.avif -t iref > output.avif
% php sample/avifaddiccp.php -f avif-samples/bbb_4k.avif -p sRGB.icc > output.avif

bbb_4k.avif を avifrebuild.php にかけると、入力と同じバイト列になります。

Clone this wiki locally