当前位置:网站首页>从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
边栏推荐
- MongoDB-快速上手MongoDB命令行的一些简单操作
- "Matching" is true love, a new attitude for young people to make friends
- session-cookie与token
- Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
- Operator-1初识Operator
- [MySQL] an exception occurs when connecting to MySQL: connection must be valid and open
- 【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
- Following nym, the new project Galaxy token announced by coinlist is gal
- [unity3d] cannot correctly obtain the attribute value of recttransform, resulting in calculation error
- Ks009 implement pet management system based on SSH
猜你喜欢

MongoDB-快速上手MongoDB命令行的一些简单操作

AI技术产业热点分析

Post disaster reconstruction -- Floyd thought

Retrofit's callback hell is really vulnerable in kotlin synergy mode!

01安装虚拟机

Unreal material editor foundation - how to connect a basic material

KS009基于SSH实现宠物管理系统
![[MySQL] an exception occurs when connecting to MySQL: connection must be valid and open](/img/09/a75ce6742d787c640b8066e0e8e694.png)
[MySQL] an exception occurs when connecting to MySQL: connection must be valid and open

测试--面试题总结

【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
随机推荐
ERROR 1118 (42000): Row size too large (> 8126)
01-spooldir
VLAN experiment
Rapid prototyping
2021-10-04
Post disaster reconstruction -- Floyd thought
【避坑指南】Unity3D项目接入腾讯Bugly工具时遇到的坑
Metaclass type and using metaclass to implement model class ORM
Solutions to a series of problems in sqoop job creation
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
网络通信学习
虛幻AI藍圖基礎筆記(萬字整理)
13.信号量临界区保护
Is this code PHP MySQL redundant?
Pytest framework implements pre post
AutoCAD - layer Linetype
【MySQL】连接MySQL时出现异常:Connection must be valid and open
Network real-time video streaming based on OpenCV
Message mechanism -- getting to know messages and message queues for the first time
Remember the use of add method once