{"id":27857772,"url":"https://github.com/runner365/srt_encoder","last_synced_at":"2025-05-04T13:58:20.393Z","repository":{"id":154309290,"uuid":"239242453","full_name":"runner365/srt_encoder","owner":"runner365","description":"srt encoder","archived":false,"fork":false,"pushed_at":"2022-11-05T10:19:47.000Z","size":827,"stargazers_count":97,"open_issues_count":5,"forks_count":45,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-04T13:58:15.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/runner365.png","metadata":{"files":{"readme":"README-Cn.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-02-09T03:49:17.000Z","updated_at":"2025-03-22T12:41:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a11b574-7fe6-4ce4-a0c0-ce64a49ef0c5","html_url":"https://github.com/runner365/srt_encoder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runner365%2Fsrt_encoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runner365%2Fsrt_encoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runner365%2Fsrt_encoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runner365%2Fsrt_encoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runner365","download_url":"https://codeload.github.com/runner365/srt_encoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252344598,"owners_count":21732979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-04T13:58:19.794Z","updated_at":"2025-05-04T13:58:20.386Z","avatar_url":"https://github.com/runner365.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[English](https://github.com/runner365/srt_encoder/blob/master/README.md) | 中文\n# SRT Encoder\nSRT Encoder基于srt自适应bitrate的直播编码器。\u003cbr/\u003e\n基于srt协议中的rtt，maxBw，inflight等信息预测低延时的出口带宽，动态的调整编码bitrate，从而实现基于网络出口带宽的编码。\u003cbr/\u003e\n- 简单易用，使用ffmpeg命令行 \u003cbr/\u003e\n基于ffmpeg-4.1, 通过自定义的ffmpeg，实现srt自适应码率编码器。只需要替换ffmpeg4.1源码fftools目录下的ffmpeg.c，和加入srt_header.h，编译ffmpeg即可。\n- 基于srt直播协议 \u003cbr/\u003e\nsrt是基于udt针对音视频特性而设计的传输协议，简单/实时/高效。\n- 基于bbr拥塞算法 \u003cbr/\u003e\n基于bbr拥塞算法，预测出口bitrate，自适应bitrate动态编码。\n\n## 1. 原理\n基于bbr基本拥塞控制算法，通过一个周期内(1~2seconds)的minRTT, maxBw, 和当前的inflight，预测出编码bitrate的状态机(保持，增加，减少)。\u003cbr/\u003e\n\n## 2. 如何编译\n依赖ffmpeg动态库，libsrt, libx264, lib265, libfdk_aac等。\n### 2.1 替代ffmpeg.c\n编码器是基于ffmpeg4.1开发的，只需要把ffmpeg-4.1/fftools目录下的ffmpeg.c和srt_header.h拷贝替换到对应ffmpeg4.1版本对应的目录下。\nffmpeg4.1的官方打包源码地址: [ffmpeg-4.1.tar.xz](https://johnvansickle.com/ffmpeg/release-source/ffmpeg-4.1.tar.xz)\n\n### 2.2 如何编译ffmpeg\n请看wiki：[How to compile](https://github.com/runner365/srt_encoder/wiki/How-to-compile-cn)\n\n## 3. 如何运行\n### 3.1 srt in srs\nsrs地址：[https://github.com/ossrs/srs](https://github.com/ossrs/srs) \u003cbr/\u003e\n在develop分支中有支持srt直播服务 \u003cbr/\u003e\n如何在srs中使用srt直播服务，请看wiki：[v4_CN_SRTWiki](https://github.com/ossrs/srs/wiki/v4_CN_SRTWiki) \u003cbr/\u003e\n\n### 3.2 srt encoder \n运行：\u003cbr/\u003e\nffmpeg -re -i source.mp4 -c:v libx264 -s 640x360 -b:v 700k -c:a libfdk_aac -ab 64k -ar 44100 -ac 2 -f mpegts 'srt://127.0.0.1:10080?streamid=#!::h=live/livestream,m=publish' \u003cbr/\u003e\n\n备注：\n* 不能配置-crf \u003cbr/\u003e\n因为x264的crf模式与动态bitrate冲突\n* 不能配置-qp \u003cbr\u003e\n因为x264的qp模式与动态bitrate冲突\n* srt内的媒体封装格式是mpegts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunner365%2Fsrt_encoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunner365%2Fsrt_encoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunner365%2Fsrt_encoder/lists"}