SlideShare une entreprise Scribd logo
1  sur  59
Télécharger pour lire hors ligne
Developer Camp
2012 Japan Fall

10.4 Thu – 5 Fri
渋谷ヒカリエ
マルチデバイスへの動画配信
サービス ~ Windows Azure
Media Services とは ~
日本マイクロソフト株式会社
通信メディア統括本部
ソリューションスペシャリスト
畠山 大有
本セッションの目的
• Windows Azure Media Services で
   動画配信アプリケーションを開発する方法を理解します。

• 動画配信そのものについては取り扱いません。

• 本セッションは、2012年6月リリースの public beta の仕様
   に基づきます。今後、予告なく変更される可能性が
   ありますのでご注意ください。


Developer Camp | 2012 Japan Fall
本日の内容
• Windows Azure Media Services を知る
• Windows Azure Media Services 開発の ”イロハ”




Developer Camp | 2012 Japan Fall
Windows Azure Media Services

を知る
Windows Azure Media Services
• 拡張可能なマルチテナントのメディア配信
  プラットフォーム
• クラウド上への
  Microsoft Media Platform 実装
• パートナーエコシステム
   • エンコーディング/パッケージング
   • セキュリティ
   • マルチデバイス
   • オンデマンド / ライブ
   • REST API
Developer Camp | 2012 Japan Fall
動画配信のワークフロー
                                   Windows Azure Media Services




Developer Camp | 2012 Japan Fall
パートナーエコシステム
            ISV




                               Encoding/     Content     Origin &
        Ingest
                              Transcoding   Protection    CDN
Developer Camp | 2012 Japan Fall
アーキテクチャ (VOD)
           Windows Azure Media Services
 Compute
 Storage




Developer Camp | 2012 Japan Fall
Windows Azure Media Services

開発の”イロハ”
コードを書く前に必要な事




Developer Camp | 2012 Japan Fall
Media Services アカウント作成




Developer Camp | 2012 Japan Fall
開発環境の準備
•   Windows 7, Windows 8, Windows 2008 R2
•   .NET Framework 3.5 SP1, .NET Framework 4
•   Visual Studio 2010 SP1
•   Windows Azure SDK 1.6 (November 2011)
•   Windows Azure Media Services SDK (June 2012 Preview)
•   WCF Data Services 5.0 for OData V3

    • http://msdn.microsoft.com/en-us/library/hh973620.aspx




Developer Camp | 2012 Japan Fall
Visual Studio の設定
• アセンブリ参照
  • Microsoft.WindowsAzure.MediaServices.Management.Sdk.dll
     •   %ProgramFiles(x86)%¥Microsoft SDKs¥Windows Azure Media Services¥Services¥v1.0




Developer Camp | 2012 Japan Fall
Sample Player の準備
• Smooth Streaming
  • Microsoft Media Platform: Player Framework
      •   Windows 8: http://playerframework.codeplex.com/releases/view/94684
      •   Silverlight: http://smf.codeplex.com/releases/view/88970




• HTML5 <video> (iOS用)
    <video       width="640"
                 height="480"
                 src="http://<your url>/hogehoge.mp4"
                 autoplay controls >
                 ご利用の Web ブラウザー では再生できません
    </video>
Developer Camp | 2012 Japan Fall
Media Services SDK for .NET
 Microsoft.WindowsAzure.MediaServices.Client.

                                   CloudMediaContext     サービスとのセッション

                                               Assets    コンテンツの集合体(ファイル)

                                          Jobs / Tasks   エンコードなどのメディア処理

                                     MediaProcessors     メディア処理アプリ定義

                                             Locators    配布/配信ポイント

                                        AccessPolicies   配布/配信 公開ポリシー

Developer Camp | 2012 Japan Fall
コーディングの流れ




Developer Camp | 2012 Japan Fall
Ingest – Processing – Delivery : sample code


Demo
Windows Azure Media Services
接続
 • Windows Azure Media Servicesとの全てのやりとりは、
    CloudMediaContext クラスを通じて

 • 注意点
   • CloudMediaContext はスレッドセーフではない

  CloudMediaContext context = new CloudMediaContext(
     ConfigurationManager.AppSettings["accountName"],
     ConfigurationManager.AppSettings["accountKey"]
  );
Developer Camp | 2012 Japan Fall
Ingest
  Ingest
 • Asset作成 = Windows Azure Media Services 管理下に、
   ファイルを置く
 • ファイルのアップロード
 • 別の Blob からのコピーも可能
    • Asset に 書き込み可能な SAS URLを作成し、それを元に
       Containerを作成する
       •   http://social.msdn.microsoft.com/Forums/en-US/MediaServices/thread/be486bac-ac37-4984-87d0-
           20931fcb1328

 • 2つの暗号化オプション: AES 256bit / Common Encryption
Developer Camp | 2012 Japan Fall
Ingest – sample code
  Ingest
  context.Assets.OnUploadProgress += new
  EventHandler<UploadProgressEventArgs>(Assets_OnUploadProgress);

  IAsset ingestAsset =
  context.Assets.Create(@"D:¥MediaServices¥Contents¥file.wmv“,
                         AssetCreationOptions.StorageEncrypted);


  void Assets_OnUploadProgress(object sender, UploadProgressEventArgs e)
  {
    Console.WriteLine(" 経過{0:0.0}%", e.Progress);
  }



Developer Camp | 2012 Japan Fall
爆速 Aspera


Video
Manage
  Ingest
 • Asset / Job / AccessPolicy の管理
   • 実際には Windows Azure SQL database 上で管理
 • LINQ サポート

 • 注意点
   • オブジェクトのリファレンスは自動リフレッシュ
     しないため、都度、再クエリが必要


Developer Camp | 2012 Japan Fall
Manage: Asset
  Ingest
 • Windows Azure Blob コンテナ
 • アプリケーション的なメタは持っていない
   • Asset. AlternateId にてCMS連携 ID Name              Title         Artist

                                    0001   Contoso   Great Video   Art #1

                                           Id        AlternateId   Name

 • 削除する際の注意点                               <guid>  0001 contoso

   • 関連する Locator は個別削除が必要
   • AssetCreationOptions.CommonEncryptionProtected 指定をした
     Asset を削除する場合は、ContentsKey の個別削除が必須
Developer Camp | 2012 Japan Fall
Process
  Ingest

 • エンコードなどのメディア処理の実行単位
 • Job に、n個 の Task を作成
                                          Input Asset
   • Job がコマンド発行の単位
       •   開始/キャンセル/終了/エラーなど       Task
                                           Output
    • 入力/出力ファイル                             Asset
                      Job
    • 処理は非同期で                             Input Asset
    • ファイル同士の依存関係がないと              Task
       Task は並列実行。あると直列実行                  Output
                                            Asset

Developer Camp | 2012 Japan Fall
Process: Windows Azure Media Encoder
  Ingest
 • Expression Encoder 4 Pro SP2 がベース
 • Azure に最適化
   • Adaptive Bitrate Streamingでは、複数VMを使う
 • タスク プリセット 指定
   • http://msdn.microsoft.com/en-us/library/jj129582.aspx
 • 「現在」は、Expression Encoder 4 Pro SP2 の
    カスタム タスク プリセット (XML文字列) も動作する!
       •   サムネイル作成, 時間指定の切り出し など


Developer Camp | 2012 Japan Fall
Process: Windows Azure Media Encoder
  Ingest
 • サポートしているファイルフォーマット
    •   3GPP, 3GPP2
    •   Advanced Systems Format (ASF)
    •   Advanced Video Coding High Definition (AVCHD) [MPEG-2 Transport
        Stream]
    •   Audio-Video Interleaved (AVI)
    •   AviSynth
    •   Digital camcorder MPEG-2 (MOD)
    •   Digital video (DV) camera file                                    •   AC-3 (Dolby Digital) audio
    •   DVD transport stream (TS) file                                    •   Audio Interchange File Format (AIFF)
    •   DVD video object (VOB) file                                       •   Broadcast Wave Format
    •   Expression Encoder Screen Capture Codec file                      •   MP3 (MPEG-1 Audio Layer 3)
    •   MP4
                                                                          •   MP4 audio
    •   MPEG-1 System Stream
    •   MPEG-2 video file                                                 •   MPEG-4 audio book
    •   Smooth Streaming File Format (PIFF 1.3)                           •   WAVE file
    •   Windows Media Video (WMV)                                         •   Windows Media Audio

    ビデオ                                                                   オーディオ
Developer Camp | 2012 Japan Fall
Process: Windows Azure Media Encoder
  Ingest
 • サポートしているコーデック




    •   H.264
    •   MPEG-1                     •   AC-3 (Dolby Digital audio)
    •   MPEG-2                     •   Advanced Audio Coding (AAC)
    •   VC-1                       •   MP3 (MPEG-1 Audio Layer 3)
    •   Windows Media Video        •   Windows Media Audio

    ビデオ                            オーディオ
Developer Camp | 2012 Japan Fall
Process: Windows Azure Media Packager / Encryptor

  Ingest
 • IIS Transform Manager 1.0 がベース
       •   http://msdn.microsoft.com/en-us/library/hh973619.aspx


 • Media Processor 定義 + 設定XML文字列
   • PlayReady Protection Task
   • MP4 to Smooth Streams Task
   • Smooth Streams to HLS Conversion Task
   • Storage Decyption
       •   http://msdn.microsoft.com/en-us/library/jj129580.aspx#get_media_processor


Developer Camp | 2012 Japan Fall
Process – sample code (1)
  Ingest
  IJob job = context.Jobs.Create("WMV to SS and HLS");
  IMediaProcessor windowsAzureMediaEncoder = (from a in context.MediaProcessors
            where a.Name == “Windows Azure Media Encoder”
            select a).First();
  ITask WMS2SSTask = job.Tasks.AddNew("WMV to Smooth Streaming",
            windowsAzureMediaEncoder,
            "H.264 IIS Smooth Streaming iPhone WiFi",
            TaskCreationOptions.None);

  // 入出力ファイル
  WMS2SSTask.InputMediaAssets.Add(ingestAsset);
  IAsset SSedAssed = WMS2SSTask.OutputMediaAssets.AddNew(”SmoothStreaming",
            true,
            AssetCreationOptions.None);
  job.Submit();

Developer Camp | 2012 Japan Fall
Process – sample code (2)
  Ingest
  bool jobFinalize = false;
  while (!jobFinalize) {
      job = (from j in context.Jobs
         where j.Id == job.Id
         select j).FirstOrDefault();
      Console.WriteLine(" ***: {0}", job.State.ToString());

      switch (job.State) {
         case JobState.Finished:
            jobFinalize = true;
            Console.WriteLine(" 正常終了: {0}", job.RunningDuration);
            break;
         case JobState.Error:
            jobFinalize = true;
            Console.WriteLine(" エラー発生: {0}", job.Tasks[0].ErrorDetails);
            break;
         default:
            Console.WriteLine(" 15秒間 待機します: {0}", DateTime.Now.ToLongTimeString());
            System.Threading.Thread.Sleep(15000);
            break;
      }
  }


Developer Camp | 2012 Japan Fall
Delivery
  Ingest
 • ストリーミング / ダウンロード のオリジンサーバー
 • Locator に Asset 単位で割り当てる
   • 1 つの Asset につき 5つの Locator が上限
 • AccessPolicyによって、時間単位での公開を設定
   • アクセス権設定ではない




Developer Camp | 2012 Japan Fall
Delivery – sample code
  Ingest
  IAccessPolicy accessPolicy = context.AccessPolicies.Create("Streaming",
      TimeSpan.FromHours(3),
      AccessPermissions.Read | AccessPermissions.List);

  /// *** 配信サーバー設定
  ILocator SS_StreamingPointLocator =
  context.Locators.CreateOriginLocator(job.OutputMediaAssets[0],
      accessPolicy);

  string SS_StreaingPointPath = SS_StreamingPointLocator.Path +
      (from ism in job.OutputMediaAssets[0].Files
       where ism.Name.EndsWith(".ism")
       select ism).FirstOrDefault().Name
      + "/manifest";

Developer Camp | 2012 Japan Fall
Windows 8, Mac OS, iOS へ 配信


Demo
Live Origin / Delivery (TAP)

  • IIS Media Services 4.1 ベース
  • 状態管理
    • Allocation – Start / Stop / Shutdown
  • ヘルスチェック
  • アーカイブ
    • Blob Storage へ
  • IP Filtering

Developer Camp | 2012 Japan Fall
Live Origin - Delivery


Demo
まとめ
                Quick and Easy
                シンプルなAPI
                PaaS


                Open and Flexible
                様々な Partner Application
                様々なAPI: REST, .NET, Java, PHP


                Powerful and Cost Effective
                進化し続けるCloud インフラのメリットを直接共有
                Capex / Opex の最小化


Developer Camp | 2012 Japan Fall
ご参考リソース
• MSDN Online: Windows Azure Media Services:
  • http://msdn.microsoft.com/en-us/library/hh973629.aspx


• ScottGu’s Blog: Windows Azure Media Services and London
   2012 Olympics
   • http://weblogs.asp.net/scottgu/archive/2012/08/21/windows-azure-
     media-services-and-the-london-2012-olympics.aspx




Developer Camp | 2012 Japan Fall
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of
Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Media Services SDK
Media Services APIs and SDKs
• REST API for all platforms, using OData 3.0
         Simple to write your own client libraries using REST API and
         standard HTTP verbs (GET, POST, PUT, DELETE)
•




•
    .NET library available in Preview
    Future - JAVA library available in Fall
• Open Libraries available with source code (Apache 2 license) on GitHub




Developer Camp | 2012 Japan Fall
On-Demand Workflow
                                   • Ingest
                                   • Encode
                                   • Package
                                   • Encrypt
                                   • Deliver

Developer Camp | 2012 Japan Fall
Ingest
                                   Ingest Assets into the Media Services
                                   Pre-encrypt files prior to uploading(AES 256)

                                   Secure HTTPS upload

                                   Network level peering for fast HTTP into Azure

                                   Fast upload using UDP with Aspera

                                   Bulk ingest support


Developer Camp | 2012 Japan Fall
Encode
                                   Windows Azure Media Encoder
                                   Supports encoding to H.264 or VC-1 video

                                   Encodes audio to AAC-LC, HE-AAC, Dolby DD+, WMA

                                   Packages to MP4, HLS, Smooth Streaming, HDS, WMV

                                   Encrypts with PlayReady, Common Encryption, AES

                                   Encoding with third-parties

                                   Partner SDK for enabling ‘build-in’ encoders


Developer Camp | 2012 Japan Fall
Package




Developer Camp | 2012 Japan Fall
Encrypt




Developer Camp | 2012 Japan Fall
Deliver




Developer Camp | 2012 Japan Fall
Target


          MP4




Developer Camp | 2012 Japan Fall
API Entities




Developer Camp | 2012 Japan Fall
Assets
                                   The logical unit that represents a single
                                   audiovisual presentation in Media Services

                                   An asset contains a collection of one to many
                                   media files




Developer Camp | 2012 Japan Fall
An Asset Is….
                                   • An asset should be considered a single version
                                     or derivative of an audiovisual presentation

                                   • Examples:
                                     • a full movie, TV show, specific edit
                                     • a clip from a movie, TV show, animation, camera ISO
                                       file, event, etc..
                                     • a movie trailer or promotional video
                                     • an advertisement
                                     • an audio file, radio show, podcast, sound file, etc…




Developer Camp | 2012 Japan Fall
An Asset Is NOT….
                                   • A folder to organize and store multiple
                                       versions of the same presentation in
                                       •   For example, you would never use an Asset to
                                           store the Movie, its trailer, an advertisement,
                                           and an international edit version of the same
                                           movie in a single Asset
                                   •
                                       A folder for submitting batch processing of
                                       multiple audiovisual presentations to
                                       Azure Media Encoder

Developer Camp | 2012 Japan Fall
Access Policies
                                   Access Policies define the permissions and duration of
                                   access to an Asset

                                   Controls Read/Write semantics

                                   Controls duration in minutes that a URL has access

                                   Future expansion for more policy settings; IP white-
                                   listing, Geo-restriction, Identity/Group access, etc…



Developer Camp | 2012 Japan Fall
Content Keys
                                   Encryption information (AES Content Key,
                                   X.509 certificate) for protected assets

                                   Assets can be either:
                                    “storage encrypted” (256-bit key) to protect them at
                                    rest
                                    “common encrypted” (128-bit key) for DRM delivery.

                                   Assets are storage encrypted by default


Developer Camp | 2012 Japan Fall
Files
                                   Actual video, audio, image, or metadata
                                   blobs stored in your Azure storage account

                                   Source files are often referred to as
                                   “Mezzanine” files




Developer Camp | 2012 Japan Fall
Locators
                                   A Locator is a URI that provides time-based access
                                   to a specific asset

                                   It is used with an AccessPolicy to define the
                                   permissions and duration that a client has access to
                                   a given Asset

                                   Locators can be used to generate SAS URLs, Origin
                                   Server URLs , CDN URLs, 3rd party origin URLs, etc…




Developer Camp | 2012 Japan Fall
Jobs
                                   A job is an “workflow” in Media Services that
                                   can be scheduled, monitored and canceled

                                   The Job entity holds metadata about Tasks,
                                   which do processing on the files in an Asset

                                   A job always has one or more associated
                                   inputs, tasks, and outputs



Developer Camp | 2012 Japan Fall
Job Templates
                                   A JobTemplate provides reusable
                                   settings for Jobs that need to be run
                                   repeatedly

                                   JobTemplates can be saved from
                                   existing Jobs for re-use


Developer Camp | 2012 Japan Fall
Tasks
                                   A Task is an individual operation of work on an
                                   Asset and is defined in a Job

                                   Tasks point to “Media Processors” that can be
                                   either first or third party

                                   Each Task has its own configuration and can be
                                   scheduled to run sequentially or in parallel


Developer Camp | 2012 Japan Fall

Contenu connexe

Tendances

トランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナー
トランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナートランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナー
トランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナーTakayuki Nakayama
 
Openstack SPICE console (icehouse) verification
Openstack SPICE console (icehouse) verificationOpenstack SPICE console (icehouse) verification
Openstack SPICE console (icehouse) verificationyukihiro kawada
 
B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)
B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)
B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)chenree3
 
SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】
SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】
SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】DeNA
 
Windows Server 2022 Datacenter Azure Edition Overview
Windows Server 2022 Datacenter Azure Edition OverviewWindows Server 2022 Datacenter Azure Edition Overview
Windows Server 2022 Datacenter Azure Edition OverviewKazuki Takai
 

Tendances (6)

トランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナー
トランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナートランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナー
トランザクションもDWHもクラウドで 2015年10月~IBM OnDemandセミナー
 
Openstack SPICE console (icehouse) verification
Openstack SPICE console (icehouse) verificationOpenstack SPICE console (icehouse) verification
Openstack SPICE console (icehouse) verification
 
VIOPS02: 仮想データセンター構築を目指して!
VIOPS02: 仮想データセンター構築を目指して!VIOPS02: 仮想データセンター構築を目指して!
VIOPS02: 仮想データセンター構築を目指して!
 
B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)
B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)
B 8スポンサー講演資料 osnexus steven umbehocker (アファーム・ビジネスパートナーズ株)
 
SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】
SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】
SHOWROOMとDeNAで取り組んだライブ配信基盤刷新・超低遅延ライブ配信の裏側【DeNA TechCon 2020 ライブ配信】
 
Windows Server 2022 Datacenter Azure Edition Overview
Windows Server 2022 Datacenter Azure Edition OverviewWindows Server 2022 Datacenter Azure Edition Overview
Windows Server 2022 Datacenter Azure Edition Overview
 

Similaire à Dev camp2012jpn day2session2

Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...
Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...
Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...Developer Camp 2012 Japan Fall
 
Dev camp2012jpn day2special
Dev camp2012jpn day2specialDev camp2012jpn day2special
Dev camp2012jpn day2specialKatsuhito Katoh
 
Windows 開発者のための Dev&Ops on AWS
Windows 開発者のための Dev&Ops on AWSWindows 開発者のための Dev&Ops on AWS
Windows 開発者のための Dev&Ops on AWSAmazon Web Services Japan
 
.NET Coreとツール類の今
.NET Coreとツール類の今.NET Coreとツール類の今
.NET Coreとツール類の今Yuki Igarashi
 
オレたちとVisual Studioとの関係を話そう
オレたちとVisual Studioとの関係を話そうオレたちとVisual Studioとの関係を話そう
オレたちとVisual Studioとの関係を話そうMitsuhito Ishino
 
[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門
[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門
[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門Shuji Kikuchi
 
build 2012 Windows Azure 的まとめ
build 2012 Windows Azure 的まとめbuild 2012 Windows Azure 的まとめ
build 2012 Windows Azure 的まとめSunao Tomita
 
App Service の DevOps と Visual Studio Team Services 最新アップデート
App Service の DevOps と Visual Studio Team Services 最新アップデートApp Service の DevOps と Visual Studio Team Services 最新アップデート
App Service の DevOps と Visual Studio Team Services 最新アップデートMicrosoft Azure Japan
 
Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力
Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力
Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力Akira Inoue
 
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-Saki Homma
 
2011年マイクロソフト テクノロジー振り返り~開発編~
2011年マイクロソフト テクノロジー振り返り~開発編~2011年マイクロソフト テクノロジー振り返り~開発編~
2011年マイクロソフト テクノロジー振り返り~開発編~Takeshi Shinmura
 
The Twelve-Factor (A|M)pp with C#
The Twelve-Factor (A|M)pp with C#The Twelve-Factor (A|M)pp with C#
The Twelve-Factor (A|M)pp with C#Yuta Matsumura
 
サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践
サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践
サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践真吾 吉田
 
改めて C# でできることを振り返る
改めて C# でできることを振り返る改めて C# でできることを振り返る
改めて C# でできることを振り返るYuta Matsumura
 
.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線
.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線
.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線Akira Inoue
 
Application Deployment on AWS
Application Deployment on AWSApplication Deployment on AWS
Application Deployment on AWSEiji Shinohara
 

Similaire à Dev camp2012jpn day2session2 (20)

Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...
Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...
Developr Camp 2012 Japan Fall Day2 Special Session - Visual Studio 2012 で始める ...
 
Dev camp2012jpn day2special
Dev camp2012jpn day2specialDev camp2012jpn day2special
Dev camp2012jpn day2special
 
Windows 開発者のための Dev&Ops on AWS
Windows 開発者のための Dev&Ops on AWSWindows 開発者のための Dev&Ops on AWS
Windows 開発者のための Dev&Ops on AWS
 
.NET Coreとツール類の今
.NET Coreとツール類の今.NET Coreとツール類の今
.NET Coreとツール類の今
 
Amazon EC2 Container Service Deep dive
Amazon EC2 Container Service Deep diveAmazon EC2 Container Service Deep dive
Amazon EC2 Container Service Deep dive
 
Inside Windows Azure Web Sites
Inside Windows Azure Web SitesInside Windows Azure Web Sites
Inside Windows Azure Web Sites
 
オレたちとVisual Studioとの関係を話そう
オレたちとVisual Studioとの関係を話そうオレたちとVisual Studioとの関係を話そう
オレたちとVisual Studioとの関係を話そう
 
[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門
[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門
[AKIBA.AWS] AWS Elemental MediaConvertから学ぶコーデック入門
 
build 2012 Windows Azure 的まとめ
build 2012 Windows Azure 的まとめbuild 2012 Windows Azure 的まとめ
build 2012 Windows Azure 的まとめ
 
App Service の DevOps と Visual Studio Team Services 最新アップデート
App Service の DevOps と Visual Studio Team Services 最新アップデートApp Service の DevOps と Visual Studio Team Services 最新アップデート
App Service の DevOps と Visual Studio Team Services 最新アップデート
 
Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力
Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力
Visual Studio 2012 と ASP.NET に見る、最新 Web 開発の魅力
 
Visual Studio 2010
Visual Studio 2010Visual Studio 2010
Visual Studio 2010
 
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
 
2011年マイクロソフト テクノロジー振り返り~開発編~
2011年マイクロソフト テクノロジー振り返り~開発編~2011年マイクロソフト テクノロジー振り返り~開発編~
2011年マイクロソフト テクノロジー振り返り~開発編~
 
20060419
2006041920060419
20060419
 
The Twelve-Factor (A|M)pp with C#
The Twelve-Factor (A|M)pp with C#The Twelve-Factor (A|M)pp with C#
The Twelve-Factor (A|M)pp with C#
 
サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践
サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践
サーバー管理よ、サヨウナラ。サーバーレス アーキテクチャの意義と実践
 
改めて C# でできることを振り返る
改めて C# でできることを振り返る改めて C# でできることを振り返る
改めて C# でできることを振り返る
 
.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線
.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線
.NET Core と Container, そして Azure Web Apps on Linux による Web アプリ開発最前線
 
Application Deployment on AWS
Application Deployment on AWSApplication Deployment on AWS
Application Deployment on AWS
 

Dev camp2012jpn day2session2

  • 1. Developer Camp 2012 Japan Fall 10.4 Thu – 5 Fri 渋谷ヒカリエ
  • 2. マルチデバイスへの動画配信 サービス ~ Windows Azure Media Services とは ~ 日本マイクロソフト株式会社 通信メディア統括本部 ソリューションスペシャリスト 畠山 大有
  • 3. 本セッションの目的 • Windows Azure Media Services で 動画配信アプリケーションを開発する方法を理解します。 • 動画配信そのものについては取り扱いません。 • 本セッションは、2012年6月リリースの public beta の仕様 に基づきます。今後、予告なく変更される可能性が ありますのでご注意ください。 Developer Camp | 2012 Japan Fall
  • 4. 本日の内容 • Windows Azure Media Services を知る • Windows Azure Media Services 開発の ”イロハ” Developer Camp | 2012 Japan Fall
  • 5. Windows Azure Media Services を知る
  • 6. Windows Azure Media Services • 拡張可能なマルチテナントのメディア配信 プラットフォーム • クラウド上への Microsoft Media Platform 実装 • パートナーエコシステム • エンコーディング/パッケージング • セキュリティ • マルチデバイス • オンデマンド / ライブ • REST API Developer Camp | 2012 Japan Fall
  • 7. 動画配信のワークフロー Windows Azure Media Services Developer Camp | 2012 Japan Fall
  • 8. パートナーエコシステム ISV Encoding/ Content Origin & Ingest Transcoding Protection CDN Developer Camp | 2012 Japan Fall
  • 9. アーキテクチャ (VOD) Windows Azure Media Services Compute Storage Developer Camp | 2012 Japan Fall
  • 10. Windows Azure Media Services 開発の”イロハ”
  • 13. 開発環境の準備 • Windows 7, Windows 8, Windows 2008 R2 • .NET Framework 3.5 SP1, .NET Framework 4 • Visual Studio 2010 SP1 • Windows Azure SDK 1.6 (November 2011) • Windows Azure Media Services SDK (June 2012 Preview) • WCF Data Services 5.0 for OData V3 • http://msdn.microsoft.com/en-us/library/hh973620.aspx Developer Camp | 2012 Japan Fall
  • 14. Visual Studio の設定 • アセンブリ参照 • Microsoft.WindowsAzure.MediaServices.Management.Sdk.dll • %ProgramFiles(x86)%¥Microsoft SDKs¥Windows Azure Media Services¥Services¥v1.0 Developer Camp | 2012 Japan Fall
  • 15. Sample Player の準備 • Smooth Streaming • Microsoft Media Platform: Player Framework • Windows 8: http://playerframework.codeplex.com/releases/view/94684 • Silverlight: http://smf.codeplex.com/releases/view/88970 • HTML5 <video> (iOS用) <video width="640" height="480" src="http://<your url>/hogehoge.mp4" autoplay controls > ご利用の Web ブラウザー では再生できません </video> Developer Camp | 2012 Japan Fall
  • 16. Media Services SDK for .NET Microsoft.WindowsAzure.MediaServices.Client. CloudMediaContext サービスとのセッション Assets コンテンツの集合体(ファイル) Jobs / Tasks エンコードなどのメディア処理 MediaProcessors メディア処理アプリ定義 Locators 配布/配信ポイント AccessPolicies 配布/配信 公開ポリシー Developer Camp | 2012 Japan Fall
  • 18. Ingest – Processing – Delivery : sample code Demo
  • 19. Windows Azure Media Services 接続 • Windows Azure Media Servicesとの全てのやりとりは、 CloudMediaContext クラスを通じて • 注意点 • CloudMediaContext はスレッドセーフではない CloudMediaContext context = new CloudMediaContext( ConfigurationManager.AppSettings["accountName"], ConfigurationManager.AppSettings["accountKey"] ); Developer Camp | 2012 Japan Fall
  • 20. Ingest Ingest • Asset作成 = Windows Azure Media Services 管理下に、 ファイルを置く • ファイルのアップロード • 別の Blob からのコピーも可能 • Asset に 書き込み可能な SAS URLを作成し、それを元に Containerを作成する • http://social.msdn.microsoft.com/Forums/en-US/MediaServices/thread/be486bac-ac37-4984-87d0- 20931fcb1328 • 2つの暗号化オプション: AES 256bit / Common Encryption Developer Camp | 2012 Japan Fall
  • 21. Ingest – sample code Ingest context.Assets.OnUploadProgress += new EventHandler<UploadProgressEventArgs>(Assets_OnUploadProgress); IAsset ingestAsset = context.Assets.Create(@"D:¥MediaServices¥Contents¥file.wmv“, AssetCreationOptions.StorageEncrypted); void Assets_OnUploadProgress(object sender, UploadProgressEventArgs e) { Console.WriteLine(" 経過{0:0.0}%", e.Progress); } Developer Camp | 2012 Japan Fall
  • 23. Manage Ingest • Asset / Job / AccessPolicy の管理 • 実際には Windows Azure SQL database 上で管理 • LINQ サポート • 注意点 • オブジェクトのリファレンスは自動リフレッシュ しないため、都度、再クエリが必要 Developer Camp | 2012 Japan Fall
  • 24. Manage: Asset Ingest • Windows Azure Blob コンテナ • アプリケーション的なメタは持っていない • Asset. AlternateId にてCMS連携 ID Name Title Artist 0001 Contoso Great Video Art #1 Id AlternateId Name • 削除する際の注意点 <guid> 0001 contoso • 関連する Locator は個別削除が必要 • AssetCreationOptions.CommonEncryptionProtected 指定をした Asset を削除する場合は、ContentsKey の個別削除が必須 Developer Camp | 2012 Japan Fall
  • 25. Process Ingest • エンコードなどのメディア処理の実行単位 • Job に、n個 の Task を作成 Input Asset • Job がコマンド発行の単位 • 開始/キャンセル/終了/エラーなど Task Output • 入力/出力ファイル Asset Job • 処理は非同期で Input Asset • ファイル同士の依存関係がないと Task Task は並列実行。あると直列実行 Output Asset Developer Camp | 2012 Japan Fall
  • 26. Process: Windows Azure Media Encoder Ingest • Expression Encoder 4 Pro SP2 がベース • Azure に最適化 • Adaptive Bitrate Streamingでは、複数VMを使う • タスク プリセット 指定 • http://msdn.microsoft.com/en-us/library/jj129582.aspx • 「現在」は、Expression Encoder 4 Pro SP2 の カスタム タスク プリセット (XML文字列) も動作する! • サムネイル作成, 時間指定の切り出し など Developer Camp | 2012 Japan Fall
  • 27. Process: Windows Azure Media Encoder Ingest • サポートしているファイルフォーマット • 3GPP, 3GPP2 • Advanced Systems Format (ASF) • Advanced Video Coding High Definition (AVCHD) [MPEG-2 Transport Stream] • Audio-Video Interleaved (AVI) • AviSynth • Digital camcorder MPEG-2 (MOD) • Digital video (DV) camera file • AC-3 (Dolby Digital) audio • DVD transport stream (TS) file • Audio Interchange File Format (AIFF) • DVD video object (VOB) file • Broadcast Wave Format • Expression Encoder Screen Capture Codec file • MP3 (MPEG-1 Audio Layer 3) • MP4 • MP4 audio • MPEG-1 System Stream • MPEG-2 video file • MPEG-4 audio book • Smooth Streaming File Format (PIFF 1.3) • WAVE file • Windows Media Video (WMV) • Windows Media Audio ビデオ オーディオ Developer Camp | 2012 Japan Fall
  • 28. Process: Windows Azure Media Encoder Ingest • サポートしているコーデック • H.264 • MPEG-1 • AC-3 (Dolby Digital audio) • MPEG-2 • Advanced Audio Coding (AAC) • VC-1 • MP3 (MPEG-1 Audio Layer 3) • Windows Media Video • Windows Media Audio ビデオ オーディオ Developer Camp | 2012 Japan Fall
  • 29. Process: Windows Azure Media Packager / Encryptor Ingest • IIS Transform Manager 1.0 がベース • http://msdn.microsoft.com/en-us/library/hh973619.aspx • Media Processor 定義 + 設定XML文字列 • PlayReady Protection Task • MP4 to Smooth Streams Task • Smooth Streams to HLS Conversion Task • Storage Decyption • http://msdn.microsoft.com/en-us/library/jj129580.aspx#get_media_processor Developer Camp | 2012 Japan Fall
  • 30. Process – sample code (1) Ingest IJob job = context.Jobs.Create("WMV to SS and HLS"); IMediaProcessor windowsAzureMediaEncoder = (from a in context.MediaProcessors where a.Name == “Windows Azure Media Encoder” select a).First(); ITask WMS2SSTask = job.Tasks.AddNew("WMV to Smooth Streaming", windowsAzureMediaEncoder, "H.264 IIS Smooth Streaming iPhone WiFi", TaskCreationOptions.None); // 入出力ファイル WMS2SSTask.InputMediaAssets.Add(ingestAsset); IAsset SSedAssed = WMS2SSTask.OutputMediaAssets.AddNew(”SmoothStreaming", true, AssetCreationOptions.None); job.Submit(); Developer Camp | 2012 Japan Fall
  • 31. Process – sample code (2) Ingest bool jobFinalize = false; while (!jobFinalize) { job = (from j in context.Jobs where j.Id == job.Id select j).FirstOrDefault(); Console.WriteLine(" ***: {0}", job.State.ToString()); switch (job.State) { case JobState.Finished: jobFinalize = true; Console.WriteLine(" 正常終了: {0}", job.RunningDuration); break; case JobState.Error: jobFinalize = true; Console.WriteLine(" エラー発生: {0}", job.Tasks[0].ErrorDetails); break; default: Console.WriteLine(" 15秒間 待機します: {0}", DateTime.Now.ToLongTimeString()); System.Threading.Thread.Sleep(15000); break; } } Developer Camp | 2012 Japan Fall
  • 32. Delivery Ingest • ストリーミング / ダウンロード のオリジンサーバー • Locator に Asset 単位で割り当てる • 1 つの Asset につき 5つの Locator が上限 • AccessPolicyによって、時間単位での公開を設定 • アクセス権設定ではない Developer Camp | 2012 Japan Fall
  • 33. Delivery – sample code Ingest IAccessPolicy accessPolicy = context.AccessPolicies.Create("Streaming", TimeSpan.FromHours(3), AccessPermissions.Read | AccessPermissions.List); /// *** 配信サーバー設定 ILocator SS_StreamingPointLocator = context.Locators.CreateOriginLocator(job.OutputMediaAssets[0], accessPolicy); string SS_StreaingPointPath = SS_StreamingPointLocator.Path + (from ism in job.OutputMediaAssets[0].Files where ism.Name.EndsWith(".ism") select ism).FirstOrDefault().Name + "/manifest"; Developer Camp | 2012 Japan Fall
  • 34. Windows 8, Mac OS, iOS へ 配信 Demo
  • 35. Live Origin / Delivery (TAP) • IIS Media Services 4.1 ベース • 状態管理 • Allocation – Start / Stop / Shutdown • ヘルスチェック • アーカイブ • Blob Storage へ • IP Filtering Developer Camp | 2012 Japan Fall
  • 36. Live Origin - Delivery Demo
  • 37. まとめ Quick and Easy シンプルなAPI PaaS Open and Flexible 様々な Partner Application 様々なAPI: REST, .NET, Java, PHP Powerful and Cost Effective 進化し続けるCloud インフラのメリットを直接共有 Capex / Opex の最小化 Developer Camp | 2012 Japan Fall
  • 38. ご参考リソース • MSDN Online: Windows Azure Media Services: • http://msdn.microsoft.com/en-us/library/hh973629.aspx • ScottGu’s Blog: Windows Azure Media Services and London 2012 Olympics • http://weblogs.asp.net/scottgu/archive/2012/08/21/windows-azure- media-services-and-the-london-2012-olympics.aspx Developer Camp | 2012 Japan Fall
  • 39. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • 41. Media Services APIs and SDKs • REST API for all platforms, using OData 3.0 Simple to write your own client libraries using REST API and standard HTTP verbs (GET, POST, PUT, DELETE) • • .NET library available in Preview Future - JAVA library available in Fall • Open Libraries available with source code (Apache 2 license) on GitHub Developer Camp | 2012 Japan Fall
  • 42. On-Demand Workflow • Ingest • Encode • Package • Encrypt • Deliver Developer Camp | 2012 Japan Fall
  • 43. Ingest Ingest Assets into the Media Services Pre-encrypt files prior to uploading(AES 256) Secure HTTPS upload Network level peering for fast HTTP into Azure Fast upload using UDP with Aspera Bulk ingest support Developer Camp | 2012 Japan Fall
  • 44. Encode Windows Azure Media Encoder Supports encoding to H.264 or VC-1 video Encodes audio to AAC-LC, HE-AAC, Dolby DD+, WMA Packages to MP4, HLS, Smooth Streaming, HDS, WMV Encrypts with PlayReady, Common Encryption, AES Encoding with third-parties Partner SDK for enabling ‘build-in’ encoders Developer Camp | 2012 Japan Fall
  • 45. Package Developer Camp | 2012 Japan Fall
  • 46. Encrypt Developer Camp | 2012 Japan Fall
  • 47. Deliver Developer Camp | 2012 Japan Fall
  • 48. Target MP4 Developer Camp | 2012 Japan Fall
  • 49. API Entities Developer Camp | 2012 Japan Fall
  • 50. Assets The logical unit that represents a single audiovisual presentation in Media Services An asset contains a collection of one to many media files Developer Camp | 2012 Japan Fall
  • 51. An Asset Is…. • An asset should be considered a single version or derivative of an audiovisual presentation • Examples: • a full movie, TV show, specific edit • a clip from a movie, TV show, animation, camera ISO file, event, etc.. • a movie trailer or promotional video • an advertisement • an audio file, radio show, podcast, sound file, etc… Developer Camp | 2012 Japan Fall
  • 52. An Asset Is NOT…. • A folder to organize and store multiple versions of the same presentation in • For example, you would never use an Asset to store the Movie, its trailer, an advertisement, and an international edit version of the same movie in a single Asset • A folder for submitting batch processing of multiple audiovisual presentations to Azure Media Encoder Developer Camp | 2012 Japan Fall
  • 53. Access Policies Access Policies define the permissions and duration of access to an Asset Controls Read/Write semantics Controls duration in minutes that a URL has access Future expansion for more policy settings; IP white- listing, Geo-restriction, Identity/Group access, etc… Developer Camp | 2012 Japan Fall
  • 54. Content Keys Encryption information (AES Content Key, X.509 certificate) for protected assets Assets can be either: “storage encrypted” (256-bit key) to protect them at rest “common encrypted” (128-bit key) for DRM delivery. Assets are storage encrypted by default Developer Camp | 2012 Japan Fall
  • 55. Files Actual video, audio, image, or metadata blobs stored in your Azure storage account Source files are often referred to as “Mezzanine” files Developer Camp | 2012 Japan Fall
  • 56. Locators A Locator is a URI that provides time-based access to a specific asset It is used with an AccessPolicy to define the permissions and duration that a client has access to a given Asset Locators can be used to generate SAS URLs, Origin Server URLs , CDN URLs, 3rd party origin URLs, etc… Developer Camp | 2012 Japan Fall
  • 57. Jobs A job is an “workflow” in Media Services that can be scheduled, monitored and canceled The Job entity holds metadata about Tasks, which do processing on the files in an Asset A job always has one or more associated inputs, tasks, and outputs Developer Camp | 2012 Japan Fall
  • 58. Job Templates A JobTemplate provides reusable settings for Jobs that need to be run repeatedly JobTemplates can be saved from existing Jobs for re-use Developer Camp | 2012 Japan Fall
  • 59. Tasks A Task is an individual operation of work on an Asset and is defined in a Job Tasks point to “Media Processors” that can be either first or third party Each Task has its own configuration and can be scheduled to run sequentially or in parallel Developer Camp | 2012 Japan Fall