当前位置:网站首页>从MediaRecord录像中读取H264参数
从MediaRecord录像中读取H264参数
2022-07-02 06:50:00 【微澜-】
说明:
许多以前做个一个测试项目,想把android手机视频接入视频服务器,做法是这样的:
把android手机的实时视频上传到后台转发服务器,转发服务器把音视频流包装成IPC rtsp服务器形式,流媒体连接手机转发服务器就像连接IPC设备一样,使用rtsp的拉流模式获取视频流。
从而实现手机---转发服务器---视频服务器—PC客户端的双向通信。
这个方案是一个简化方案,手机端仅仅负责抓包回放以及远程播放,转发服务器仅实现一个rtsp封装并未其他任何功能,其他模块是不变的。手机端使用了最上层的mediarecorder对象,一边录制回显,一边上传音视频。
手机端需要使用自定义的协议和转发服务器通信,把音视频参数告知服务器,其中获取视频参数是很重要的。
如何 获取视频参数呢?其实,mediarecorder(H264)的录制数据的开头就包含了SPS和pps参数,分析一下取出来即可,并且相同的设备、相同的配置获取的sps,pps都是相同的,只需要在启动界面的时候获取一下即可,后面就不需要获取了。
如何获取H264参数呢?
解决方案:
1、设置录像的视频解码参数为H264
2、获取到录像数据之后跳过文件头:
3、后面就是SPS和PPS:
这样就找到视频参数,然后封装起来,告诉服务器。
参考:
以前我好像写过一篇文章介绍sps,pps,那时候在做h264分片传输。
关于:
qq:9611153 微信lgs9611153
边栏推荐
- How to judge the quality of primary market projects when the market is depressed?
- Commutateur Multi - lentilles Blender
- Database dictionary Navicat automatic generation version
- 两数之和,求目标值
- Operator-1初识Operator
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
- [unity3d] nested use layout group to make scroll view with dynamic sub object height
- 01-spooldir
- MPLS experiment
- 2.14 is it Valentine's day or Valentine's day when the mainstream market continues to fluctuate and wait for changes?
猜你喜欢
随机推荐
ERROR 1118 (42000): Row size too large (> 8126)
"Talking about podcasts" vol.352 the age of children: breaking the inner scroll, what can we do before high school?
01-spooldir
Postman -- use
Blender model import UE, collision settings
sqoop创建job出现的一系列问题解决方法
【Unity3D】嵌套使用Layout Group制作拥有动态子物体高度的Scroll View
Understand the composition of building energy-saving system
SAP Spartacus express checkout design
pytest框架实现前后置
14.信号量的代码实现
flume 190 INSTALL
Rapid prototyping
Test -- Summary of interview questions
webUI自动化学习
2021-10-04
【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
Delivery mode design of Spartacus UI of SAP e-commerce cloud
Blender多鏡頭(多機比特)切換
测试--面试题总结