当前位置:网站首页>在OBS上进行H265推流
在OBS上进行H265推流
2022-07-28 14:39:00 【我不是码神】
OBS官方明确表态不支持H265,貌似以后也不会支持,什么原因呢?可以看官方论坛上的吵架
不想看英文的,我这里简单说一下,就是因为Adobe公司的RTMP协议里面并没有支持H265,所以他们不想支持H265。当然群众的呼声还是十分强烈的。那么问题来了,如何修改OBS的开源代码使得其支持H265格式呢?
开始尝试:
首先github上clone下OBS源码,按照官方说明,配置编译环境,这里不多说。编译成功后,开始尝试寻找编码器的部分代码。
找到obs-ffmpeg这个模块,里面有个文件jim_nvenc.c
struct obs_encoder_info nvenc_info = {
.id = "jim_nvenc",
.codec = "h264",
.type = OBS_ENCODER_VIDEO,
.caps = OBS_ENCODER_CAP_PASS_TEXTURE,
.get_name = nvenc_get_name,
.create = nvenc_create,
.destroy = nvenc_destroy,
.update = nvenc_update,
.encode_texture = nvenc_encode_tex,
.get_defaults = nvenc_defaults,
.get_properties = nvenc_properties,
.get_extra_data = nvenc_extra_data,
.get_sei_data = nvenc_sei_data,
};上面这段代码就是nvenc的h264编码模块,nvenc是NVIDIA推出的显卡编码工具,同时具备h264和h265编码功能,只是OBS没有使用h265的部分而已。
于是仿照上面的代码,构建h265的模块。
struct obs_encoder_info hevc_nvenc_info = {
.id = "hevc_nvenc",
.codec = "hevc",
.type = OBS_ENCODER_VIDEO,
.caps = OBS_ENCODER_CAP_PASS_TEXTURE,
.get_name = hevc_nvenc_get_name,
.create = hevc_nvenc_create,
.destroy = nvenc_destroy,
.update = nvenc_update,
.encode_texture = nvenc_encode_tex,
.get_defaults = nvenc_defaults,
.get_properties = nvenc_properties,
.get_extra_data = nvenc_extra_data,
.get_sei_data = nvenc_sei_data,
};函数大部分都可以复用h264的,除了create和get_name。
create函数也基本和H264一样,里面把NV_ENC_CODEC_H264_GUID替换成NV_ENC_CODEC_HEVC_GUID,类似这种替换一下,
然后去obs_ffmpeg.c里面添加obs_register_encoder(&nvenc_encoder_info);进行注册。OBS即可使用这个编码器。当然最终没有成功,nVidia的驱动报错了,研究下去比较费劲,所以就剑走偏锋,找到外国友人提供的线索,OBS还有一个录像功能,可以选择FFMPEG自定义输出,可以在里面选择URL输出,即可进行推流。此时需要编译一个可以进行h265推流的FFMPEG,然后放到obs编译配置里面去,一起编译,就可以调用这个自定义的FFMPEG,最终实现H265的rtmp推流。
边栏推荐
- 1. Author of the open source GPS project hd-gr GNSS
- Installing CONDA and configuring Jupiter
- Camera连拍自动化测试shell脚本
- Matlab exports high-definition pictures without distortion in word compression and PDF conversion
- How many tips do you know about using mock technology to help improve test efficiency?
- 全国985院校考研信息汇总整理
- Idea debugging burpsuit plug-in
- Execution process of SQL statement
- 多线程
- 字符串(3)
猜你喜欢

软件架构与设计(八)-----分布式架构

800V high voltage system

About how Simulink generates model coverage reports

Execution process of SQL statement

如何获取及嵌入Go二进制执行包信息

Endnote 与word关联

Grpc protocol buffer

Baidu proposes a dynamic self distillation method to realize dense paragraph retrieval by combining interactive model and double tower model

Pytorch - autograd automatic differentiation
![[jspwiki]jspwiki installation deployment and configuration](/img/3c/81a201bb80dcbb17d1c97b1a5bb215.png)
[jspwiki]jspwiki installation deployment and configuration
随机推荐
Summary and arrangement of postgraduate entrance examination information of 211 colleges and universities nationwide
Easy start, swagger
4、主程序和累积中断处理例程实现代码
Volatile principle
samba服务器如何配置
Problems encountered by pyppeter
Grpc frequently asked questions
Pytorch - autograd automatic differentiation
腾讯面试之--请你设计一个实现线程池顺序执行
2022年最火的十大测试工具,你掌握了几个
软件架构与设计(六)-----层次结构体
Endnote 与word关联
DataTables warning: table id=campaigntable - cannot reinitialize datatable. solve
Framework定制系列(六)-----屏蔽FallbackHome手机启动中弹窗直接进入Launcher
Baidu proposes a dynamic self distillation method to realize dense paragraph retrieval by combining interactive model and double tower model
1. Author of the open source GPS project hd-gr GNSS
Summary and arrangement of postgraduate entrance examination information of 985 colleges and universities nationwide
软件架构与设计(一)-----关键原则
sql语句的执行流程
8、实时数据备份和实时时钟功能实现