513 Direct Access to Media E

513 Direct Access to Media E

Media #WWDC14 Direct Access to Video Encoding and Decoding Session 513 David Eldred Tech Lead, Frameworks with “Video” in their names © 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Introduction Hardware encode and decode can improve user experience Introduction Hardware encode and decode can improve user experience • Better performance Introduction Hardware encode and decode can improve user experience • Better performance • Increased efficiency Introduction Hardware encode and decode can improve user experience • Better performance • Increased efficiency • Extend battery life What You Will Learn What You Will Learn Case Studies What You Will Learn Case Studies 1. Displaying an H.264 stream in a layer in your application What You Will Learn Case Studies 1. Displaying an H.264 stream in a layer in your application 2. Decoding an H.264 stream and accessing the decoded buffers What You Will Learn Case Studies 1. Displaying an H.264 stream in a layer in your application 2. Decoding an H.264 stream and accessing the decoded buffers 3. Compressing a sequence of images into a movie file What You Will Learn Case Studies 1. Displaying an H.264 stream in a layer in your application 2. Decoding an H.264 stream and accessing the decoded buffers 3. Compressing a sequence of images into a movie file 4. Compressing a sequence of images into an H.264 stream for the network What You Will Learn Case Studies 1. Displaying an H.264 stream in a layer in your application 2. Decoding an H.264 stream and accessing the decoded buffers 3. Compressing a sequence of images into a movie file 4. Compressing a sequence of images into an H.264 stream for the network Using multi-pass encoding in AVFoundation and Video Toolbox Media Interfaces Overview With a focus on video Media Interfaces Overview With a focus on video AVKit Media Interfaces Overview With a focus on video AVKit AVFoundation Media Interfaces Overview With a focus on video AVKit AVFoundation Video Toolbox Media Interfaces Overview With a focus on video AVKit AVFoundation Video Toolbox Core Media Core Video Media Interface Focus AVKit AVAVFoundation Foundation Video Toolbox Core Media Core Video Media Interface Focus AVFoundation AVKit • Decompress direct to display • Compress directly to file AVAVFoundation Foundation Video Toolbox Core Media Core Video Media Interface Focus AVFoundation AVKit • Decompress direct to display • Compress directly to file AVAVFoundation Foundation Video Toolbox • Decompress to CVPixelBuffer Video Toolbox • Compress to CMSampleBuffer Core Media Core Video Media Interface Focus AVKit AVAVFoundation Foundation Video Toolbox Hardware Codec Usage AVKit AVAVFoundation Foundation Video Toolbox Hardware Codec Usage iOS OS X AVKit Always When Available AVAVFoundation Foundation Always When Available Video Toolbox Always When Available and Requested The Cast of Characters CVPixelBuffer CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription Uncompressed CMBlockBuffer Raster Image Buffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBuffer CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription Uncompressed CMBlockBuffer Raster Image Buffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBuffers CVPixelBufferPool CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBufferPool CFDictionary of requirements; May Include: pixelBufferAttributes • Width/height CMTime • Pixel format type (e.g., 32BGRA, YCbCr420) CMVideoFormatDescription • Compatibility (e.g., OpenGL ES, Core Animation) CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBufferPool pixelBufferAttributes 64-bit Time Value (Numerator) CMTime 32-bit Time Scale (Denominator) CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer Width/Height CVPixelBufferPool ! pixelBufferAttributes Format Type—(kCMPixelFormat_32BGRA, CMTime kCMVideoCodecType_H264,…) CMVideoFormatDescription ! Extensions—(Pixel Aspect Ratio, Color Space,…) CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBufferPool pixelBufferAttributes CMBlockBuffer CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CVPixelBuffer CMSampleBuffer CMSampleBuffer CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer or CMClock CMTimebase Compressed Video Frame Uncompressed Raster Image The Cast of Characters CVPixelBuffer CMSampleBuffer CMSampleBuffer CVPixelBufferPool CMTime CMTime pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer or CMClock CMTimebase Compressed Video Frame Uncompressed Raster Image The Cast of Characters CVPixelBuffer CMSampleBuffer CMSampleBuffer CVPixelBufferPool CMTime CMTime pixelBufferAttributes CMTime CMVideoFormatDesc CMVideoFormatDesc CMVideoFormatDescription CMBlockBuffer CMSampleBuffer or CMClock CMTimebase Compressed Video Frame Uncompressed Raster Image The Cast of Characters CVPixelBuffer CMSampleBuffer CMSampleBuffer CVPixelBufferPool CMTime CMTime pixelBufferAttributes CMTime CMVideoFormatDesc CMVideoFormatDesc CMVideoFormatDescription CMBlockBuffer CMSampleBuffer or CMClock CMTimebase CMBlockBuffer Compressed Video Frame Uncompressed Raster Image The Cast of Characters CVPixelBuffer CMSampleBuffer CMSampleBuffer CVPixelBufferPool CMTime CMTime pixelBufferAttributes CMTime CMVideoFormatDesc CMVideoFormatDesc CMVideoFormatDescription CMBlockBuffer CMSampleBuffer or CMClock CMTimebase CMBlockBuffer CVPixelBuffer Compressed Video Frame Uncompressed Raster Image The Cast of Characters CMClock CVPixelBuffer CVPixelBufferPool pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters CMClock CMClock Wraps a source of time A clock’s time always increases CMClockGetHostTimeClock() wraps mach_absolute_time() The Cast of Characters CVPixelBuffer CVPixelBufferPool CMClock pixelBufferAttributes CMTime CMVideoFormatDescription CMBlockBuffer CMSampleBuffer CMClock CMTimebase The Cast of Characters A controlled view onto a CMClock CMTimebase CMClock Provides: The Cast of Characters A controlled view onto a CMClock CMTimebase CMTimebaseSetTime(timebase, kCMTimeZero); CMClock Provides: • Time mapping The Cast of Characters A controlled view onto a CMClock CMTimebase CMTimebaseSetTime(timebase, kCMTimeZero); CMClock Provides: CMTimebaseSetRate(timebase, 1.0); • Time mapping • Rate control Case One Displaying video from a network stream Case One Overview Network Case One Overview Network Compressed Video Samples H.264 H.264 H.264 Case One Overview Network Compressed Video Samples H.264 H.264 H.264 AVSampleBufferDisplayLayer AVSampleBufferDisplayLayer A closer look AVSampleBufferDisplayLayer AVSampleBufferDisplayLayer A closer look AVSampleBufferDisplayLayer CMSampleBuffers H.264 H.264 H.264 AVSampleBufferDisplayLayer A closer look AVSampleBufferDisplayLayer CMSampleBuffers H.264 H.264 H.264 Video Decoder AVSampleBufferDisplayLayer A closer look AVSampleBufferDisplayLayer CMSampleBuffers H.264 H.264 H.264 Video Decoder CVPixelBuffers AVSampleBufferDisplayLayer A closer look AVSampleBufferDisplayLayer CMSampleBuffers H.264 H.264 H.264 Video Decoder CVPixelBuffers AVSampleBufferDisplayLayer Input Elementary Stream H.264 H.264 H.264 AVSampleBufferDisplayLayer Input Elementary Stream CMSampleBuffers H.264 H.264 H.264 H.264 H.264 H.264 AVSampleBufferDisplayLayer Input Elementary Stream CMSampleBuffers H.264 H.264 H.264 processing H.264 H.264 H.264 H.264 Syntax Elementary Stream MPEG-4 H.264 Syntax Elementary Stream MPEG-4 H.264 Syntax Network Abstraction Layer (NAL) H.264 Syntax Network Abstraction Layer (NAL) H.264 stream consists of a sequence of NAL Units (NALUs) NALU NALU NALU NALU NALU NALU NALU NALU NALU NALU H.264 Syntax Network Abstraction Layer (NAL) H.264 stream consists of a sequence of NAL Units (NALUs) NALU NALU NALU NALU NALU NALU NALU NALU NALU NALU NAL Units may contain H.264 Syntax Network Abstraction Layer (NAL) H.264 stream consists of a sequence of NAL Units (NALUs) NALU NALU NALU NALU NALU NALU NALU NALU NALU NALU NAL Units may contain • Video frame (or slice of video frame) H.264 Syntax Network Abstraction Layer (NAL) H.264 stream consists of a sequence of NAL Units (NALUs) NALU NALU NALU NALU NALU NALU NALU NALU NALU NALU P Frame B Frame B Frame P Frame NAL Units may contain • Video frame (or slice of video frame) H.264 Syntax Network Abstraction Layer (NAL) H.264 stream consists of a sequence of NAL Units (NALUs) NALU NALU NALU NALU NALU NALU NALU NALU NALU NALU I Frame P Frame B Frame B Frame P Frame P Frame NAL Units may contain • Video frame (or slice of video frame) H.264 Syntax Network Abstraction Layer (NAL) H.264 stream consists of a sequence of NAL Units

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    343 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us