LoginSignup
0
0

More than 1 year has passed since last update.

Win10でAV1 Video ExtensionをインストールするとBitmapImageでAVIFがデコードできるようになる

Last updated at Posted at 2022-02-08

Win10でAV1 Video ExtensionをインストールするとBitmapImageでAVIFがデコードできるようになる

Windows10のMicrosoft StoreにAV1 Video Extension(以下AV1拡張)というものがあります。AV1ビデオを再生できるようにするためのものですが、なんか説明がぼんやりしてます。

Play AV1 videos in your favorite video app on your Windows 10 device. This extension helps video apps installed on Windows 10 play videos that have been encoded using the AV1 video coding standard developed by the Alliance for Open Media.

AV1拡張をインストールすると、ペイントと写真アプリで.AVIFファイルが開けるようになることも比較的よく知られています。
ぼんやりと、アプリにパッチあたったのかな~と思っていたのですが、テストプログラムで確認するとそうではなかったようです。

using (MemoryStream ms = new MemoryStream())
{
    FileStream fs0 = new FileStream("apple.avif", FileMode.Open);
    fs0.CopyTo(ms);
    fs0.Close();

    BitmapImage page = new BitmapImage();

    page.BeginInit();
    page.DecodePixelHeight = processHeight;
    page.CacheOption = BitmapCacheOption.OnLoad;
    page.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
    page.StreamSource = ms;
    page.EndInit();

テストプログラムの雑な抜粋ですが、apple.avifの内容をMemoryStreamに読みこんでBitmapImageのStreamSourceに指定しています。

適当なイメージコントロールにBitmapImageを設定するとりんごの絵が表示されます。

ひょっとしてAVIF対応のBitmapEncoderは追加されてないかなあ?

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0