当前位置: 首页 > news >正文

网站建设目的和功能定位seo视频教程百度网盘

网站建设目的和功能定位,seo视频教程百度网盘,潍坊手机网站制作,wordpress 图片外链插件实现背景 录像有什么难的?无非就是数据过来,编码保存mp4而已,这可能是好多开发者在做录像模块的时候的思考输出。是的,确实不难,但是做好,或者和其他模块有非常好的逻辑配合,确实不容易。 好多…

实现背景

录像有什么难的?无非就是数据过来,编码保存mp4而已,这可能是好多开发者在做录像模块的时候的思考输出。是的,确实不难,但是做好,或者和其他模块有非常好的逻辑配合,确实不容易。

好多开发者希望聊聊录像模块,实际上录像这块,需求层面的东西大家都清楚,无非就是设计的时候,做的更智能,逻辑清晰而已。

设计思路

以大牛直播SDK的录像模块的技术实现为例,我们在设计的时候,确保录像模块和RTMP推送、内置轻量级RTSP服务、转发模块、GB28181设备接入模块完全隔离,可以组合使用,也可以分开始用。

录像数据源,这块很好理解,无非就是编码前的yuv、nv12、nv21、rgb、pcm等( 比如Android camera、camera2,或者otg采集到的数据等),编码成H.264/H.265/AAC,或外部接口直接投递的编码后的264、h265、aac等。

录像模块的功能层面,比较好理解,比如需要支持随时录像,设置单个录像文件大小、录像路径等,并支持纯音频、纯视频、音视频录制模式,此外,最好支持录像过程中,暂停录像、恢复录像。
从开始录像,到录像结束,需要设计event callback,告诉上层逻辑,什么时候开始录像了,什么时候生成了个录像文件,路径是什么。

  • 文件格式:MP4;
  • 涉及相关库:libSmartPublisher.so
  • 头文件:SmartPublisherJniV2.java
  • Jar:smartavengine.jar

接口概述

Android录像模块接口概述

调用描述

接口

接口描述

录像设置

是否录像

SmartPublisherSetRecorder

设置是否启用本地录像

创建录像目录

SmartPublisherCreateFileDirectory

创建录像文件目录

设置录像目录

SmartPublisherSetRecorderDirectory

设置录像文件目录

音频录像

SmartPublisherSetRecorderAudio

音频录制开关

视频录像

SmartPublisherSetRecorderVideo

视频录制开关

设置录像文件大小

SmartPublisherSetRecorderFileMaxSize

设置每个录像文件的大小,比如100M,超过这个大小后,会自动生成下一个录像文件

开始录像

SmartPublisherStartRecorder

开始录像

暂停/恢复录像

SmartPublisherPauseRecorder

Pause recorder(暂停/恢复录像)

停止录像

SmartPublisherStopRecorder

停止录像

调用示例

录像配置

    void ConfigRecorderParam() {if (libPublisher != null && publisherHandle != 0) {if (recDir != null && !recDir.isEmpty()) {int ret = libPublisher.SmartPublisherCreateFileDirectory(recDir);if (0 == ret) {if (0 != libPublisher.SmartPublisherSetRecorderDirectory(publisherHandle, recDir)) {Log.e(TAG, "Set record dir failed , path:" + recDir);return;}// 更细粒度控制录像的, 一般情况无需调用//libPublisher.SmartPublisherSetRecorderAudio(publisherHandle, 0);//libPublisher.SmartPublisherSetRecorderVideo(publisherHandle, 0);if (0 != libPublisher.SmartPublisherSetRecorderFileMaxSize(publisherHandle, 200)) {Log.e(TAG, "SmartPublisherSetRecorderFileMaxSize failed.");return;}} else {Log.e(TAG, "Create record dir failed, path:" + recDir);}}}}

开始、停止录像

    class ButtonStartRecorderListener implements View.OnClickListener {public void onClick(View v) {if (isRecording) {stopRecorder();if (!isPushingRtmp && !isRTSPPublisherRunning && !isGB28181StreamRunning) {ConfigControlEnable(true);}btnStartRecorder.setText("实时录像");btnPauseRecorder.setText("暂停录像");btnPauseRecorder.setEnabled(false);isPauseRecording = true;return;}Log.i(TAG, "onClick start recorder..");if (libPublisher == null)return;if (!isPushingRtmp && !isRTSPPublisherRunning&& !isGB28181StreamRunning) {InitAndSetConfig();}ConfigRecorderParam();int startRet = libPublisher.SmartPublisherStartRecorder(publisherHandle);if (startRet != 0) {if (!isPushingRtmp && !isRTSPPublisherRunning && !isGB28181StreamRunning) {if (publisherHandle != 0) {long handle = publisherHandle;publisherHandle = 0;libPublisher.SmartPublisherClose(handle);}}Log.e(TAG, "Failed to start recorder.");return;}if (!isPushingRtmp && !isRTSPPublisherRunning && !isGB28181StreamRunning) {CheckInitAudioRecorder();ConfigControlEnable(false);}startLayerPostThread();btnStartRecorder.setText("停止录像");isRecording = true;btnPauseRecorder.setEnabled(true);isPauseRecording = true;}}

停止录像封装

    //停止录像private void stopRecorder() {if(!isRecording)return;isRecording = false;if (!isPushingRtmp && !isRTSPPublisherRunning && !isGB28181StreamRunning)stopLayerPostThread();if (!isPushingRtmp && !isRTSPPublisherRunning && !isGB28181StreamRunning) {if (audioRecord_ != null) {Log.i(TAG, "stopRecorder, call audioRecord_.StopRecording..");audioRecord_.Stop();if (audioRecordCallback_ != null) {audioRecord_.RemoveCallback(audioRecordCallback_);audioRecordCallback_ = null;}audioRecord_ = null;}}if (null == libPublisher || 0 == publisherHandle)return;libPublisher.SmartPublisherStopRecorder(publisherHandle);if (!isPushingRtmp && !isRTSPPublisherRunning && !isGB28181StreamRunning) {releasePublisherHandle();}}

暂停/恢复录像

    class ButtonPauseRecorderListener implements View.OnClickListener {public void onClick(View v) {if (isRecording) {if(isPauseRecording){int ret = libPublisher.SmartPublisherPauseRecorder(publisherHandle, 1);if (ret == 0){isPauseRecording = false;btnPauseRecorder.setText("恢复录像");}else if(ret == 3){Log.e(TAG, "Pause recorder failed, please re-try again..");}else{Log.e(TAG, "Pause recorder failed..");}}else{int ret = libPublisher.SmartPublisherPauseRecorder(publisherHandle, 0);if (ret == 0){isPauseRecording = true;btnPauseRecorder.setText("暂停录像");}else if(ret == 3){Log.e(TAG, "Resume recorder failed, please re-try again..");}else{Log.e(TAG, "Resume recorder failed..");}}}}}

event回调

case NTSmartEventID.EVENT_DANIULIVE_ERC_PUBLISHER_RECORDER_START_NEW_FILE:publisher_event = "开始一个新的录像文件 : " + param3;break;
case NTSmartEventID.EVENT_DANIULIVE_ERC_PUBLISHER_ONE_RECORDER_FILE_FINISHED:publisher_event = "已生成一个录像文件 : " + param3;break;

技术总结

录像模块,单纯地实现不难,如果是需要和GB28181设备接入模块、RTMP推送、轻量级RTSP服务模块一起使用的时候,需要考虑的就多了,感兴趣的开发者,可以酌情参考。

http://www.hkea.cn/news/559716/

相关文章:

  • 深圳网站建设有没有市场百度搜索推广的五大优势
  • 网站建设好的图片百度互联网营销
  • 柳州网站制作公司seo优化什么意思
  • 网站建设做的好的公司淘宝关键词优化怎么弄
  • 手机网站用模版方象科技的企业愿景
  • 沈阳网站建设技术公司排名公司市场营销策划方案
  • 赣州网站建设怎样石家庄最新消息
  • 公司注册地址和经营地址不一致可以吗长春seo招聘
  • 好的做问卷调查的网站好推广有奖励的app平台
  • 有专业设计网站吗百度指数与百度搜索量
  • 网站的整体结构百度云网盘资源搜索引擎入口
  • 咸阳网站建设哪家专业杭州优化公司在线留言
  • 地板网站建设门户网站
  • 新增备案网站负责人人工智能培训心得体会
  • 帮境外赌场做网站是否有风险百度企业号
  • 网站换了服务器百度seo排名优化公司哪家好
  • 海南网站建设制作网络营销效果评估
  • 飞阳建设网站上海广告公司
  • 营销网站导航栏常见网站搜索排名靠前
  • 深圳市政府网站官网百度地图疫情实时动态
  • 上海建设工程咨询网 首页深圳优化排名公司
  • 杭州哪个网站建设最好做网站的网络公司
  • 制作一个网站步骤东莞网络营销销售
  • 专业的营销网站建设公司百度联盟注册
  • 机械类网站用什么做背景指数运算法则
  • 微信如何绑定网站加速游戏流畅的软件
  • 茂名整站优化百度问答首页
  • 手机网站搭建网络宣传方式
  • 2003网站建设网站seo哪家公司好
  • 成都学校网站制作2022年国际十大新闻