字幕组成品列表(Beta)
  • 写在前面
  • Android 平台
    • Game On! 游戏开发系列 - 031
      • Pie Noon - 1503060393
      • The Death of Base Game Activity - 1504030543
      • Surviving OpenGL Context Loss - 1504030546
      • WebP for Game Devs - 1504030547
      • Saved Games In-Depth (Part 1) - 1504070556
      • Saved Games In-Depth (Part 2) - 1504030548
      • Smaller Flipbook Textures with CRABBY - 1504030544
      • Google Tag Manager - 1504030545
      • Flatbuffers - 1505050794
      • Achievement Point Pointers - 1505050796
      • Frequency Scaling - 1505050797
      • Meet the Management APIs - 1501140367
      • Y U Ship Broken Games - 1505050795
    • Android 性能优化 - 088
      • Garbage Collection in Android - 1503170425
      • Performance Cost of Memory Leaks - 1503170424
      • Rendering Performance 101 - 1501130351
      • Understanding Overdraw - 1501130352
      • Understanding VSYNC - 1501130353
      • Tool - Profile GPU Rendering - 1501130354
      • Why 60fps? - 1501130355
      • Android UI and the GPU - 1501130356
      • Invalidations, Layouts, and Performance - 1501130357
      • Overdraw, Cliprect, QuickReject - 1501130358
      • Tool - Memory Monitor - 1501130363
      • Battery Performance 101 - 1501130364
      • Understanding Battery Drain on Android - 1501130365
      • Battery Drain and WakeLocks - 1501130366
      • Memory Performance 101 - 1504170661
    • I/O 2014 Android 开发专题 - 089
      • Activity Transitions - 1504020505
      • Building Apps For Android TV - 1504020520
      • Building great Android media experiences - 1504020510
      • Building a quality app from start to finish - 1504020515
      • App Indexing API - 1504020507
      • What's new in WebView - 1504010484
      • Bluetooth Low Energy - 1504010486
      • Building impressive Android media experiences - 1504010493
      • The next Generation of Authentication - 1504020497
      • Don't Alpha That Pixel! - 1504020523
      • NFC + HCE Your phone in an interactive world - 1504020509
      • Demystifying encodes and decodes of WebM - 1504020521
      • Google Cloud Messaging - 1504020524
      • Getting your Game on the Big Screen - 1504020518
      • I hear you like realtime memes - 1504020511
      • Offerize your App - 1504020506
      • Using the Android Job Scheduler - 1504020504
      • From Holo to Material - 1504020526
      • Under the Hood of Android Auto - 1504020501
      • Isolation for Android App Developers - 1504020498
      • Android Work - 1504010496
      • ExoPlayer: Adaptive video streaming on Android - 1504010489
      • Sample rates and resampling: Why can't we all just agree? - 1504010488
      • Drive Android API - 1504010485
    • Android Studio - 004
      • Layout Editor (Ep 3, Android Studio) - 1503290479
      • Introducing Gradle (Ep 2, Android Studio) - 1503170426
    • I/O 2014 Android 分发主题 - 091
      • Introduction to Google Play - 1504030534
      • Google Play: building your user community - 1504030535
      • Optimizing Apps for Education - 1504030536
      • Succeeding in Education Technology - 1504030530
      • Subscriptions Made Easy with Google Play - 1504030531
      • The world is your playground - go global with Google - 1504030533
      • Maximizing discoverability on Google Play - 1504030538
    • Android Auto - 003
      • Introduction to Android Auto - 1504130615
      • Android Auto Messaging - 1504130617
      • Android Auto Audio - 1504130616
    • Android Wear - 006
      • Designing for Android Wear - 1503210448
      • How We Customized Google Apps for Android Wear - 1503210450
      • Fullscreen apps for Android Wear - 1503210445
      • New Notification Features for Android Wear - 1503210446
      • Building Cloud-powered wearable Apps - 1503210449
      • An Introduction to Android Wear - 1503190435
      • Google I/O 2014 - Android Wear: The developer's perspective - 1503210442
      • Devoxx 2014 Interviews: Android Wear - 1503210440
      • DevBytes: Watch Faces for Android Wear - 1503210439
    • Android TV - 005
      • Using the Leanback library - 1504080588
      • Beach Buggy Racing Multiplayer with Nearby Connections (Play Services) - 1503060387
    • Android for Work - 106
      • Android for Work for Developers - 1503060390
      • App Configurations, Testing and Launchers - 1504110590
    • IO Bytes 2014 - Android - 066
      • Chrome Apps on Android and iOS - 1501080014
      • Perf Primer CPU, GPU and your Android game - 1501080017
  • Chrome 平台
    • IO Bytes 2014 - Chrome and Web - 067
      • Using the PageSpeed API - 1505070815
      • Fabulous Forms for the multi-device web - 1505070816
      • Testing multi-screen web pages - 1505070817
      • Responsive images today - 1505070819
      • Web Performance Testing at YouTube - 1505070828
      • Building sites for the multi-device web - 1505070820
      • Deep dive: Google Cloud Messaging for Chrome - 1505070827
  • Google 创业者资源
    • Coffee with a Googler - 012
      • Chat with Allen Huang of AndroidTV - 1503040384
      • Chat with Fred Chung about developer advocacy - 1503070395
      • Google Fit platform with Michelle Haq - 1503210443
      • Android Auto Product Manager Andrew Brenner - 1501120027
      • Chat with Francis Ma about Google Play services - 1501120028
    • Root Access For Startups - 077
      • What we learned building plug-ins for Android, with startup Magnet - 1503230453
      • How to use crowdfunding to your advantage, with startup Hale Devices - 1503280462
      • How to overcome customer objections when selling tech, with startup Guesswork - 1503280458
    • First Things First - 029
      • Getting started with Android: A crash-course in developing for Android - 1504120601
      • How to ask a question: conducting research for your startup - 1504120603
      • MVP Design Hacks: transform your hot idea into a validated prototype - 1504120602
      • Build something people want: Solving real problems - 1504120605
    • How I - 061
      • Use BigQuery to find my most valuable customers - 1504070573
      • Manage beta testing communities using Google Play - 1504070572
      • Use paper wireframing to build native prototypes - 1504070570
      • Used social media and $0 marketing to get 68 million users - 1504070568
      • Prep to fundraise with four questions - 1504070564
      • Validated my idea in 2 days (with no code) - 1504070562
      • Build open platforms on Android - 1504120596
      • Get cheap, automatic analytics for my business using BigQuery - 1504070571
      • Write press releases to get international media coverage - 1504070569
      • Test beta-product features using Google Apps - 1504070563
      • Use URL builder to measure ROI on social media - 1504070561
      • Use events to build DeadSocial's brand - 1504070557
      • Use BigQuery to visualize streaming data - 1503220452
      • Find, screen, and hire developers - 1503120406
      • Drive engagement with social challenges - 1504070558
  • 设计
    • DesignBytes - 017
      • Paper and Ink: The Materials that Matter - 1505050793
  • 云计算
    • DevBytes: Google Cloud Platform - 021
      • Powering the next killer app with the Google Cloud Platform - 1504210672
      • Introduction to Google Cloud Endpoints - 1504210675
      • The Beauty of Scale with Google Cloud Platform - 1504210678
    • Google Cloud Platform - Big Data - 105
      • GDELT & BigQuery: Understand the world - 1502200379
    • Uncategorized - 999
      • Introducing Google Cloud Platform Resources - 1501190370
  • Google 应用开发
    • Launchpad Online - 072
      • The Setup: Creating new apps using Google APIs - 1503190428
      • Listing your files in Google Drive - 1503190429
      • Customizing Google Analytics for your startup - 1503290473
      • The Launchpad Online series - 1503190427
      • Getting started with Google Analytics - 1503290472
      • Accessing Google Maps from a spreadsheet?!? - 1502220381
      • Change the world in 10 lines of code - 1503080398
    • Google Play Services - 054
      • Google Play services 6.1 - 1503290481
      • Google Play Services 7.0 - 1503200437
      • Google Play Services 6.5 - 1501080015
    • 谷歌地图 iOS SDK - 053
      • Maps Live: New Features in the Google Maps Mobile APIs for Android and iOS - 1504300777
    • Google 移动搜索开发 - 055
      • Is your app in the Google index? - 1504120598
      • Get more engaged users with Google Search for Developers - 1503070397
    • DevBytes: Google Cast - 020
      • Google Cast SDK for Android - 1504180666
      • Media Router Framework - Part 1 - Media Router API - 1504180667
      • Overview for Google Cast Receivers - 1504180664
      • Google Cast SDK for iOS - 1504180663
    • Getting Started with the Google Maps SDK for iOS - 035
      • Getting started with the Google Maps SDK for iOS, Part 1 - 1504270757
    • IO Bytes 2014 - Wearables - 070
      • Voice Driven GDK Glassware - 1505280836
    • Route 85 - 078
      • Introducing Route 85 - 1501120022
      • Quick Tip: Don't Default that Switch! - 1501190371
      • OpenInChrome on iOS, Part 1 - 1501120023
      • OpenInChrome on iOS, Part 2 - 1501120024
      • OpenInChrome on iOS, Part 3 - 1501120025
      • OpenInChrome on iOS, Part 4 - 1501120026
    • DevBytes 2014 - 019
      • Web Components - Template - 1505040789
      • Wearable DataLayer API - 1505050792
      • Using srcset for responsive images - 1505050790
      • The picture element for art direction - 1505050791
    • Uncategorized - 999
      • Sun Surveyor brings augmented reality to photographers using Google Maps APIs - 1504200668
      • Snappy travels with the Roads API - 1503060392
      • Easy Maps Apps in Java and Python - 1501140030
  • Google 广告平台
  • Polymer
    • Polycasts - 076
      • The Awesome Power of Auto-Binding Templates -- Polycasts #08 - 1502220382
      • Content Switcheroo with Core-Pages -- Polycasts #09 - 1502200380
      • Core Iconset -- Polycasts #02 - 1505040788
  • Web 平台
    • HTTP 203 - 062
      • Gotchas - 1501140368
      • Font Rendering - 1501080016
    • Web Components - 081
      • DevBytes: Web Components - Overview - 1504250709
  • 宣传视频
    • Uncategorized - 999
      • Google Developers - 1501150369
      • I/O Extended 2014 - Join me - 1502220383
  • Google 各类开发者会议
    • 2014 Chrome 开发者高峰会议 - 009
      • Keynote - Chrome Dev Summit 2014 (Darin Fisher) - 1503120407
      • TLS All the Things! - Security with Performance(Chris Palmer) - 1503140412
      • Let’s build some apps with Polymer!(Rob Dodson) - 1503150415
      • Day One Closing Remarks(Sundar Pichai) - 1503150417
      • Chrome Leadership panel - 1503160422
      • Fundamentals of Mobile Web Development(Matt Gaunt) - 1503150416
    • 2015 游戏开发者大会中 - 039
      • FlatBuffers - 1504150640
      • Games for Google Cast - 1504150637
      • Top 10 Things Android Game Developers Should Know v 3.0 - 1504150643
      • Automate Publishing for Google Play APIs - 1504150639
      • 3 Game Design Mistakes You're Making - 1504150636
      • Android TV - 1504150638
      • How to Go Viral Without Really Trying - 1504150641
    • Devoxx 2014 Interviews - 024
      • What's new in Android 5.0 Lollipop - 1504260740
      • Android Tools - 1504260743
      • BigQuery and user-defined functions - 1504260744
    • IO Bytes 2014 - 065
      • Dart in Google Cloud - 1505070810
      • Big genomic data on Google Cloud Platform - 1505070811
      • Easy International Checkout with Chrome - 1505070802
      • Google developer tools and APIs for iOS - 1503190436
      • Whet your appetite with IO Bytes - 1501080021
    • PlayTime@Shanghai - 095
      • 主题演讲 Chris Yerga - 1504060549
      • 如何成功地开发你的应用 Ellie Powers - 1504060550
      • 在Google上营利 Brahim Elbouchikhi - 1504060551
      • Playtime Shanghai event sizzle reel - 1504070552
    • Project Google I/O 2015 - 098
      • Project Tango Mobile 3D tracking and perception - 1506120857
      • Democratizing Education - 1506120868
      • Improve your Android app’s accessibility - 1506120864
      • Google Cloud Messaging 3.0 - 1506120844
      • Developers connecting the world through Google Play - 1506120862
  • 开源开放技术
    • Compressor Head - 013
      • The Trailer, Season 2 - 1503060385
      • Behind the Scenes - 1503210441
      • Arithmetic Compression (Ep 5, Compressor Head) Google - 1503070394
      • Introducing Compressor Head - 1502120372
      • Episode 1 (Variable Length Codes) - 1502120373
      • Episode 2 (The LZ77 Compression Family) - 1502120374
      • Episode 3 (Markov Chain Compression) - 1502120375
Powered by GitBook
On this page
  • 译者信息
  • 解说词中文版:

Was this helpful?

  1. Android 平台
  2. I/O 2014 Android 开发专题 - 089

Building impressive Android media experiences - 1504010493

PreviousBluetooth Low Energy - 1504010486NextThe next Generation of Authentication - 1504020497

Last updated 5 years ago

Was this helpful?

视频发布时间

2014年6月25日

视频介绍

Learn how to use the low-level Android multimedia APIs to create media experiences that rock! This session will cover the inner workings of MediaCodec, and dive into the latest platform features (including new features in the L developer preview).

视频推介语

暂无,待补充。

译者信息

翻译

润稿

终审

原始链接

中文字幕

翻译流水号

加入字幕组

任皓

田源

程路

1504010493

解说词中文版:

LAGOS MOLNAR:当今世界 视频无处不在

作为一个应用开发者 你想让用户眼前一亮

但是如何才能创造出你想象中的

细致微妙的媒体魔法呢

我是来自于Android视频框架组的Lajos

我和大家分享的是如何在Android上创造很棒的 甚至是

令人难忘的多媒体体验

大家都知道 Android有很棒的上层多媒体相关的API

但是如果你不满足于播放和拍摄视频

或者你需要一个功能

是MediaPlayer和MediaRecorder不支持的

你会需要用Android Media的具体细节--底层API

来做些相对复杂的活

它们的组成部分包含MediaCodec

MediaCodec通常用来解码压缩音视频

和编码原始音视频

MediaExtractor解析媒体的容器文件

到音视频数据包

相反的 MediaMuxer打包音视频

到媒体容器中

MediaCrypto和MediaDRM用来解密受保护的媒体内容

和管理数字权限

使用这些底层API你可以做到MediaPlayer和MediaRecorder

能做的所有事情

我知道这样可行是因为我确实做到了

例如要开发一个媒体播放器

你需要两个MediaCodec对象和一个MediaExtractor对象

用来从数据源中解析出独立的音频和

视频数据包

为播放有安全保护的内容 你需要一个MediaDRM对象

来管理安全会话

同时你需要用一个MediaCrypto对象

来做视频解码器

你可以使用两个MediaCodecs和一个MediaMuxer对象

来实现MediaRecoder的功能

事实上 你还可以开发出多种多样的多媒体应用程序

而且 我补充一句 还可能是十分酷的应用哦

然后你把这些媒体模块和其他的结合起来

诸如纹理和纹理渲染器之类

举个例子 这是模仿Google+中的Auto Awesome Movie(可以把视频、图片、

音频等方便的组织成一部电影)的视频编辑的做法

解码两个源视频到GL Textture对象(图像类库)

使用GLES渲染器组合他们到(嵌入系统图像类库)

一个视频编码器的input surface上

请看大屏幕

就是这么容易

那MediaCodec怎样工作呢

MediaCodec 就其本质上说 就是一个处理器

通过输入的数据生成输出的数据

这是个异步的数据处理过程

使用一套输入和输出缓存

在简化版流程中 客户端请求空输入缓存

填充数据后发送到

编码器处理

编码器会处理这些数据并且将它们

放到输出缓存中

最后客户端请求填充好的缓存

使用其内容 然后发回到编码器

编码器的实际操作要更复杂些

因为每一个操作都并行发生

产生原始视频缓存的编码器也

能连接到surface

我们梳理下MediaCodec的状态

当你创造编码器时 它的状态是未初始化状态

首先你需要配置它

当你调用Start方法 编码器前进到已清空状态

此时它控制所有缓存

一旦你的输入缓存队列弹出输入数据

编码器就会进入到运行状态

它在这里发挥生命中最有价值的部分来处理

输入缓存 生成输出

如果排一个带有流结束标志的输入缓存

编码器进入到流结束状态

这里编码器不再接受输入缓存了

但是仍然生成输出直到处理到有流结束标志的缓存

你可以通过调用Flush

从任何执行的状态回到清空状态

或者调用Stop来回到配置状态

如果你调用Reset

不管当前在哪个状态 编码器都会回到未初始化状态

在极少的情况下 编码器遇到错误

然后转入错误状态

通知错误的办法是使用一个排队操作的无效返回值

或者有时通过一个异常

调用Reset可以让编码器重新处于可用状态

在用完编码器之后

你应该调用Release释放它

默认的 编码器使用字节缓存ByteBuffer

存储输入和输出数据

然而视频编码器可以被配置

使用硬件加速的surface缓存存放原始视频

操作硬件加速视频编码器是更优的模式

因为这让编码器工作时不需要进行内存拷贝

采用任一种模式 MediaCodec使用缓存索引来引用缓存

你通过调用DequeueInputBuffer

得到一个空输入缓存的索引

然后你可以使用数据填充缓存

加上一个时间标记或者标志然后使用QueueInputBuffer

发送缓存到编码器

为得到填充好的输出缓存 调用DequeueOuputBuffer

得到缓存的索引

注意时间标记是怎样从输入缓存中传递的。

如果使用字节缓存你可以处理数据

然后通过调用ReleaseOutputBuffer来释放缓存

一些注意事项

尽管缓存被缓存数组中的索引引用

并不是所有的索引都是有效的

所以实际上有一些无索引的缓存被使用

所有的输出缓存都是只读的

你应该只使用出列和入列或者释放缓存调用

来访问你持有的缓存

尽管缓存被异步处理

仍要及时的释放每一个缓存

否则会阻塞一些编码器

如前面提到的 你可以设置一个视频编码器

来处理硬件加速的surface中的输入数据

实现方法是在配置后调用CreateInputSurface

把这个surface传递给现在直接和编码器交互的

视频帧的生成器

和普通操作类似

生成器将请求并清空输入缓存

填充数据 打上时间标记

将数据发回到编码器处理

当你想要停止编码会话

调用SignalEndOfInputStream

来很方便的将流结束标记加到最后收到的数据帧上

同样 你可以配置视频解码器

通过在配置中指定一个输出surface

来使用硬件加速输出缓存

使用熟悉的DequeueOutputBuffer

来获取填充好的缓存的索引

然而 和输入字节缓存相反 你不能

检查surface输出缓存的内容

你只能决定是否

发送缓存到输出surface

为抛弃缓存 调用ReleaseOutputBuffer 把render设置为False

或者把render设置为Ture来在输出surface上显示缓存

在Lollipop开发者预览中 添加了支持对

要被渲染的surface缓存进行时间标记的可选项

如果设置 一些缓存使用者将在使用这个缓存前

先等待时间标记

我们最近已经添加一些特性让MediaCodec更加有用

其中之一 前面简单证明了的

是精确规划视频帧显示的能力

到目前为止 音视同步一直很难做到

使用附加的在MediaCodec中支持的surface时间标记

和在AudioTrack中支持的高精细度时间标记

同步现在变简单了

视频帧的规划仅在surface视图上起作用

当你想要视频帧出现在显示设备上时

使用精确的声音时间标记来计算确切的系统时间

然后通过调用ReleaseOutputBuffer设置时间标记

为大约两个VSYNC周期之前(Vertical synchronization)

帧将在请求的时间标记之后的

第一个VSYNC显示

另一个最近的对MediaCodec的改进

是对自适应播放的支持

适配的回放是视频编码器可选的功能

可以在回放的过程中无缝的改变视频尺寸

而客户端可以开始给解码器提供数据

即新尺寸的输入视频帧 然后输出缓存的尺寸

自动改变

而毫无明显的间隔

这功能仅在编码器被配置

使用硬件加速的surface缓存时被支持

如果编码器不支持自适应回放

你仍然可以改变尺寸

首先 使用流结束标志

标记旧尺寸的最后帧

然后等待所有的帧被解码完成

然后停止编码器 或者如果使用API 19

及更高则直接清空它

然后配置它为新尺寸

最后再启动编码器

哇

同时我通常认为那很方便

在你能依赖于自适应回放功能之前

你需要调用FeatureSupported API

来验证它被你正用的编码器

支持

要在编码器配置期间启用自适应回放

使用两个特定的键 最大宽度和最大高度

这些最大尺寸的提示

是被编码器支持的

如果配置成功

编码器会将尺寸切换到

比在无缝方式中的合页更小一些

动态地切换到更大的尺寸仍然可行

但是它可能不是无缝的

如果你试图切换到编码器不支持的尺寸

编码器将进入错误状态

一句话建议 为节省内存

使用你的用例需要的最小尺寸的合页

当编码器运行时 要改变视频尺寸

简单的使用QueueInputBuffer提示SYNC帧

SYNC帧是特殊的关键帧

它其中也包含配置改变参数

对于H264 这意味着SPS和PPS

在单个缓存中和IDR帧一起提供

唔

信息量太大

我们已经在开发者网站上

发布了流视频播放器的例子

使用底层APIs也可自适应回放

那是Ollie的视频

详细的阐述这个例子

一定要去看它们

并且为了想要更多的那些你们 底层的媒体APIs

在Android NDK上也有效

这些C语言的 APIs模仿Java那些接口并且

对32位和64位的本地二进制文件有效

称心的很

这样 我必须说再会了

我留给你一个使用MediaBuildingBlocks

创造对用户来说梦幻般东西的挑战

更多信息 访问Android开发者网站

查找API参考 向导和简单应用

感谢您的收看

Youtube
Youtube
加入 GDG 字幕组
video_screenshot