For the current Android system, the MediaRecorder Class and LocalSocket Class are used to obtain the data of H.264 Encoded data from the MPEG4 file, but the method has the problem that the SPS should be filled manually and the data reading is unreliable since the PPS frame data is not synchronized with the NAL.Thus, the new data obtaining method is proposed.In the article, the self-DEFAULT is used as parameter in the MediaRecorder in Android system, then, the H264Writer class is constructed in the dealing method of the StagefrightRecorder in HAL layer, realizing the achievement and the save of the files of H.264.Meanwhile, the method handling the data of MPEG4 are compatible and improves the efficiency and stability of the data acquisition.The technique enriches a way to handle the video data for Android.%针对目前Android系统下利用MediaRecorder和LocalSocket类从MPEG4文件数据中获得H.264原始数据存在的问题:需要手工填写SPS、PPS帧数据和没有NAL同步头造成数据读取不可靠,提出新的H.264原始数据的获得方法.利用Android系统MediaRecorder类自身的数据输出格式(DEFAULT)作为参数,在HAL层StagefrightRecorder类的处理方式中,构建H264Writer类,实现H.264原始数据的获得或文件存储.同时兼容MPEG4的所有处理方式,并提高获取数据的效率和稳定性.该方案丰富了Android系统对视频数据的处理方法.
展开▼