当前位置:网站首页>在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推流。
边栏推荐
- Explain the difference set, intersection set and union set of complex type set in detail.Net
- Close independent windows and close other windows at the same time
- 关闭独立窗口对其他窗口同时关闭的问题
- Some operations of bit operation
- Idea debugging burpsuit plug-in
- Leetcode - sliding window extremum, search tree postorder traversal, statistical difference pairs, dividing equal subsets
- 有奖活动分享:使用WordPress搭建一个专属自己的博客后最高可领取iPhone13
- 爆肝整理 JVM 十大模块知识点总结,不信你还不懂
- How many tips do you know about using mock technology to help improve test efficiency?
- Opencv - cut out mask foreground area from grayscale image
猜你喜欢

Introduction to grpc

flowable工作流所有业务概念

爆肝整理 JVM 十大模块知识点总结,不信你还不懂

NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作

2022年最火的十大测试工具,你掌握了几个

MIT pointed out that the public pre training model should not be used indiscriminately

Tencent interview -- please design a thread pool to implement sequential execution

Vs dynamic library debugging

Explain the difference set, intersection set and union set of complex type set in detail.Net

How many tips do you know about using mock technology to help improve test efficiency?
随机推荐
How to write a JMeter script common to the test team
Gfpgan blurred photo repair artifact
爆肝整理 JVM 十大模块知识点总结,不信你还不懂
19. Channel assignment task definition
Pycharm - output exception of program run and default comment of added function
2021-06-29
设置结构体字节对齐
Regular expression (4)
800V high voltage system
Summarize the knowledge points of the ten JVM modules. If you don't believe it, you still don't understand it
10. Implementation of related data accumulation task
文件及目录操作(5)
机器学习的3大“疑难杂症”,因果学习是突破口 | 重庆大学刘礼
Sharing of award-winning activities: you can get up to iphone13 after using WordPress to build your own blog
9. Related data accumulation task definition
[delete specified number leetcode]
VirturalBox解决kernel driver问题
给你一个链表,删除链表的倒数第 n 个结点,并且返回链表的头结点。
19、通道分配任务定义
Template injection summary