CN105812832B - 基于安卓多媒体框架的视频类App中视频数据获取方法 - Google Patents

基于安卓多媒体框架的视频类App中视频数据获取方法 Download PDF

Info

Publication number
CN105812832B
CN105812832B CN201610203951.8A CN201610203951A CN105812832B CN 105812832 B CN105812832 B CN 105812832B CN 201610203951 A CN201610203951 A CN 201610203951A CN 105812832 B CN105812832 B CN 105812832B
Authority
CN
China
Prior art keywords
data
video
android
video data
source code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201610203951.8A
Other languages
English (en)
Other versions
CN105812832A (zh
Inventor
操晓春
雷青
王蕊
荆丽桦
郭电杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Information Engineering of CAS
Original Assignee
Institute of Information Engineering of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Information Engineering of CAS filed Critical Institute of Information Engineering of CAS
Priority to CN201610203951.8A priority Critical patent/CN105812832B/zh
Publication of CN105812832A publication Critical patent/CN105812832A/zh
Application granted granted Critical
Publication of CN105812832B publication Critical patent/CN105812832B/zh
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/23418Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • H04N21/47205End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for manipulating displayed content, e.g. interacting with MPEG-4 objects, editing locally
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • H04N21/4722End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for requesting additional data associated with the content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/475End-user interface for inputting end-user data, e.g. personal identification number [PIN], preference data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/647Control signaling between network components and server or clients; Network processes for video distribution between server and clients, e.g. controlling the quality of the video stream, by dropping packets, protecting content from unauthorised alteration within the network, monitoring of network load, bridging between two different networks, e.g. between IP and wireless

Abstract

本发明涉及一种基于安卓多媒体框架的视频类App中视频数据获取方法。该方法根据视频解码播放流程跟踪Android源码中多媒体数据的流向,定位Acodec框架中视频分离后通过OMXCodec接口进入解码器的位置,从该位置获取H264视频数据;然后跟踪H264数据经过解码器解码后的视频数据,定位其送至图形显示框架ANativeWindow的位置从而获取视频的YUV数据,并根据需求选择是否压缩YUV数据为Jpeg数据。本发明基于Android源码或者CyanogenMod源码,能够处理基于Android多媒体框架的所有App以获取视频数据,视频数据的获取可以达到零延时。

Description

基于安卓多媒体框架的视频类App中视频数据获取方法
技术领域
本发明属于Android多媒体技术领域,具体涉及一种基于Android多媒体框架的视频类App(应用程序)中的视频数据获取方法。
背景技术
随着移动互联网的飞速发展,应用市场中App也在膨胀式增多,数量庞大、种类繁多。在移动互联网中,视频数据逐渐成为多媒体数据中最重要的组成元素之一,它可以从时间、空间等维度上更逼真地记录更多细节内容。但是,网络中的多媒体数据信息给人们带来方便的同时,也带来了很多负面的影响。一些包含不良信息(如暴力恐怖、低俗等)的视频在移动互联网中的广泛传播严重威胁了网络安全,危害了移动互联网用户的用网安全。
为了保障应用市场环境的健康,需要能够快速、准确地在海量应用App中分析出不良视频并予以处理,但是Android系统出于安全考虑,用户无法突破系统的权限来获取第三方App的数据,所以本发明提出了从根本上解决获取使用Android多媒体库开发的App中的视频数据的方法,以为后续监管工作提供良好的条件。
发明内容
本发明针对现有获取Android端视频类App中视频数据方面的空白,提出一种高效处理和获取此类数据的方法。该方法基于Android源码或者CyanogenMod源码,能够处理基于Android多媒体框架的所有App以获取视频数据。
本发明基于Android源码多媒体框架Acodec和多媒体解码器接口OMXCodec,在对视频压缩数据(流媒体、本地视频)进行解析(parse)和解码(decode)的流程中,精确定位H264数据送往OMCodec接口的位置,将其保存至本地,从而达到获取视频数据H264的目的;同理,精确定位解码后的数据从Acodec框架送至Andoid图形显示模块ANativeWindows的位置从而获取视频的YUV数据。其中,H264数据是指应用程序下载的视频数据经过音视频分离后的纯视频数据,YUV数据是指H264数据经过解码器解码后的视频数据。
进一步地,鉴于YUV数据过于庞大,通过将Android源码中的Jpeg压缩模块添加至多媒体模块中,将YUV数据压缩为Jpeg格式,即可以图片形式保存视频数据。可以根据需求选择是否压缩YUV数据为Jpeg数据。
本发明的有益效果是:
本发明针对Android视频类App中视频数据获取问题领域的空白,提出了一个全新的解决方法,通过跟踪Android视频数据从解码到最终显示的整个流程,修改Android多媒体框架源码并定制ROM刷机;该方法能够覆盖所有使用安卓多媒体框架的应用程序,并且只要有网络视频就可以正常播放,视频数据的获取可以达到零延时。
附图说明
图1是基于Android多媒体框架的视频类应用程序中视频数据获取框架图。
图2是基于Android多媒体框架的视频数据获取流程图。其中Fd表示本地视频或者应用程序缓冲至自身内存的视频文件句柄,offset表示本次需解码的视频数据相对总数据的偏移长度,length表示视频数据的字节长度。
具体实施方式
下面通过具体实施例和附图,对本发明做进一步说明。
本实施例选择CyanogenMod12.1源码,通过修改源码实现视频数据H264和YUV(或压缩成jpeg格式)的获取,并在三星N5100上刷机,实现数据的获取保存。(注:此处CyanogenMod12.1对应Android版本5.1,源码版本和机型N5100的选择只是实验测试,所有CyanogenMod源码适配的手机以及所有CyanogenMod源码版本均可使用该方法)。
图1是基于Android多媒体框架的视频类应用程序中视频数据获取框架图。其整体包含用户进程、mediaServer进程和Binder通信三部分。左边用户进程的第一层为应用程序层,即开发人员开发的应用程序,如爱奇艺APP、百度视频APP等;第二层API类表示Android提供的java接口,为Android开发人员使用,第三层是JNI层,由于Android底层源码最终是C/C+代码实现的各种库,要使API层的java和C/C++不同语言之间的互相调用,就引入了JNI层,第四层库libmedia.so是多媒体功能C++类的API接口。右边mediaServer进程是对多媒体数据真正作处理的进程,其中Acodec是Android源码多媒体框架,OMXCodec表示多媒体解码器接口。Binder IPC是实现应用程序进程和mediaServer进程跨进程调用的通信机制。
图2是本实施例的视频数据获取流程图,其主要步骤如下:(本实施例选择CyanogenMod12.1源码,安卓真机为三星N5100)
(1)修改安卓源码
根据视频解码播放流程跟踪Android源码中多媒体数据流向,定位Acodec框架中视频分离后通过OMXCodec接口进入解码器的位置,即OMXCodec::empty()函数处,此处便是H264视频数据。分析该处buffer_id(数据缓存id)对应的数据结构,取出每一帧视频的H264数据。由于真机权限的问题,无法将视频数据保存到Sdcard(SD卡),但Andorid多媒体库拥有data/misc/media路径的读写权限,能够将视频数据保存到该路径下,所以利用文件操作open()函数在本地/data/misc/media路径下创建文件,将H264数据写保存至本地即可。
同理,根据安卓多媒体框架Acodec将解码后数据传递给Android图形显示框架AnativeWindows类,定位缓冲区的YUV数据,即ACodec::BaseState::onOutputBufferDrained()函数处。由于YUV数据过大,为了高效获取图像信息,将Android源码中的libJpeg库移植到Android多媒体框架中,将每一帧YUV数据压缩成一张独立的Jpeg图片,利用同样的方法保存即可。
(2)编译Android源码
在github(分布式源码管理网站)上下载N5100硬件驱动等方面的硬件二进制代码,分别获取到vendor、kernel、device三个文件夹,将其放入CyanogenMod12.1源码根目录下,即可使用brunch n5100命令进行编译,编译成功后在out目录下生成打包后的ROM:CM-12-20151119-UNOFFICIAL-n5100.zip。
(3)刷机
首先将CM-12-20151119-UNOFFICIAL-n5100.zip包放入真机的Sdcard路径下,然后利用Odin软件向N5100中刷入第三方Recovery:PhilZ Touch 6,之后同时按下home键+开机键+音量加键,进入Recovery模式,选择Sdcard刷机,选择之前放入的zip包,即可将修改源码后的定制ROM刷入真机,然后重新启动手机,完成wifi和语言配置等相关工作即可实现能够获取视频数据的定制手机。
本实施例提出的获取基于Android多媒体框架的视频类App中视频数据获取方法,其测试环境及实验数据为:
1)测试环境:
系统环境:ubuntu14.04LTS
硬件环境:三星N5100
测试使用Android开源程序:CyanogenMod12.1
2)测试准备
安装视频类App,播放视频时,视频数据(H264/YUV/jpeg)即可保存至/data/misc/media路径下,利用adb工具(客户端-服务器端程序)即可取出视频数据。至此便实现数据获取功能。
3)实验数据
腾讯视频App:经过选取腾讯视频App不同视频类型中的100个视频(类型包含:电视剧、综艺、电影等),均可以获得视频数据保存至手机本地。
秒拍App:选取秒拍中已有视频或者自己拍摄上传的视频,通过测试100个视频,均能获取视频数据保存之本地。
经过测试,乐视体育App、百度视频App、YY App、秒拍App、芒果TVApp等,均能成功获取视频数据。
采用本发明方法获取到的H264数据通过一般支持H264播放的视频播放器即可播放,YUV数据在能播放YUV数据的播放器上进行播放时需要输入视频的长宽,所以需要从源码中获取处视频的长宽大小。
以上实施例仅用以说明本发明的技术方案而非对其进行限制,本领域的普通技术人员可以对本发明的技术方案进行修改或者等同替换,而不脱离本发明的精神和范围,本发明的保护范围应以权利要求书所述为准。

Claims (4)

1.一种基于安卓多媒体框架的视频类App中视频数据获取方法,其步骤包括:
1)在CyanogenMod源码的Acodec框架中,根据视频解码播放流程跟踪Android源码中多媒体数据的流向,定位Acodec框架中视频分离后通过OMXCodec接口进入解码器的位置即OMXCodec::empty()函数,从该位置获取视频类App的播放视频中的H264视频数据;
2)跟踪H264数据经过解码器解码后的视频数据,定位其送至图形显示框架ANativeWindow的位置即ACodec::BaseState::onOutputBufferDrained()函数,从而获取视频的YUV数据,并根据需求选择是否压缩YUV数据为Jpeg数据;
3)获取对应Android操作系统的硬件的内核和驱动,编译修改后的CyanogenMod源码及内核和驱动获得系统zip文件,进行硬件刷机。
2.如权利要求1所述的方法,其特征在于,在所述OMXCodec::empty()函数处,通过分析数据缓存id对应的数据结构,取出每一帧视频的H264数据。
3.如权利要求1所述的方法,其特征在于,步骤2)将Android源码中的Jpeg压缩模块添加至Android多媒体模块中,以实现将YUV数据压缩为Jpeg格式。
4.如权利要求1所述的方法,其特征在于,将获取的H264视频数据和YUV视频数据保存在Andorid多媒体库的data/misc/media路径下。
CN201610203951.8A 2016-04-01 2016-04-01 基于安卓多媒体框架的视频类App中视频数据获取方法 Expired - Fee Related CN105812832B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610203951.8A CN105812832B (zh) 2016-04-01 2016-04-01 基于安卓多媒体框架的视频类App中视频数据获取方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610203951.8A CN105812832B (zh) 2016-04-01 2016-04-01 基于安卓多媒体框架的视频类App中视频数据获取方法

Publications (2)

Publication Number Publication Date
CN105812832A CN105812832A (zh) 2016-07-27
CN105812832B true CN105812832B (zh) 2019-04-30

Family

ID=56460382

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610203951.8A Expired - Fee Related CN105812832B (zh) 2016-04-01 2016-04-01 基于安卓多媒体框架的视频类App中视频数据获取方法

Country Status (1)

Country Link
CN (1) CN105812832B (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010060382A (ko) * 1999-11-30 2001-07-06 데니스 에이치. 얼백 비디오 디코딩 및 채널 획득 시스템
CN103544221A (zh) * 2013-09-30 2014-01-29 Tcl集团股份有限公司 一种Android系统中视频缩略图的生成方法和系统
CN104754409A (zh) * 2013-12-27 2015-07-01 联芯科技有限公司 应用于Android平台的多媒体视频播放系统及方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010060382A (ko) * 1999-11-30 2001-07-06 데니스 에이치. 얼백 비디오 디코딩 및 채널 획득 시스템
CN103544221A (zh) * 2013-09-30 2014-01-29 Tcl集团股份有限公司 一种Android系统中视频缩略图的生成方法和系统
CN104754409A (zh) * 2013-12-27 2015-07-01 联芯科技有限公司 应用于Android平台的多媒体视频播放系统及方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《CyanogenMod源码下载和编译以及简单修改》;sunzeduo;《51CTO博客》;20140106;网页正文 *
《利用FFmpge进行视频解码(从H264视频流到图像)》;ohantanyan;《CSDN博客》;20140713;网页正文1-5页 *

Also Published As

Publication number Publication date
CN105812832A (zh) 2016-07-27

Similar Documents

Publication Publication Date Title
Ye et al. Droidfuzzer: Fuzzing the android apps with intent-filter tag
Zhang et al. Adel: An automatic detector of energy leaks for smartphone applications
Brahler Analysis of the android architecture
Van Der Veen et al. Dynamic analysis of android malware
CN103316472A (zh) 一种基于蓝牙手柄的Android设备游戏平台系统及其实现方法
Kuenzer et al. Unikernels everywhere: The case for elastic CDNs
US9081896B1 (en) Generating a replacement binary for emulation of an application
CN108668162A (zh) 视频文件播放的处理方法、装置及智能终端
Miller et al. Crash analysis with BitBlaze
Guo-Hong Application development research based on android platform
CN106791546B (zh) 媒体数据播放方法和装置
Nagata et al. An Android application launch analyzing system
Akour et al. Mobile software testing: Thoughts, strategies, challenges, and experimental study
CN107648854B (zh) 一种游戏分类方法、装置及电子设备
CN108875011A (zh) 第三方应用的页面状态信息获取方法、装置、设备及介质
CN102917056A (zh) 一种移动学习系统及使用方法
Guo et al. Minimum viable device drivers for ARM trustzone
CN105812832B (zh) 基于安卓多媒体框架的视频类App中视频数据获取方法
Song et al. Design and implementation of media player based on android
CN101794220B (zh) .net文件中定义类型的压缩方法和装置
CN103995718A (zh) 程序的信息收集方法和装置
CN109213534A (zh) 一种扩展直播软件功能的方法及装置
CN108632438A (zh) 一种生成app界面的方法和装置
Bijlani et al. Where did my 256 GB go? A Measurement Analysis of Storage Consumption on Smart Mobile Devices
CN103365895B (zh) 网页资源监测方法和装置

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190430

CF01 Termination of patent right due to non-payment of annual fee