{"id":22683592,"url":"https://github.com/notedit/rtmp-to-webrtc","last_synced_at":"2025-07-19T13:10:40.997Z","repository":{"id":31319284,"uuid":"127531621","full_name":"notedit/rtmp-to-webrtc","owner":"notedit","description":"rtmp to  webrtc","archived":false,"fork":false,"pushed_at":"2022-12-31T01:59:45.000Z","size":525,"stargazers_count":214,"open_issues_count":16,"forks_count":60,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-03T00:07:23.856Z","etag":null,"topics":["rtmp","webrtc"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/notedit.png","metadata":{"files":{"readme":"README.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}},"created_at":"2018-03-31T12:51:04.000Z","updated_at":"2025-03-26T10:17:35.000Z","dependencies_parsed_at":"2023-01-14T18:47:36.148Z","dependency_job_id":null,"html_url":"https://github.com/notedit/rtmp-to-webrtc","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/notedit%2Frtmp-to-webrtc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Frtmp-to-webrtc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Frtmp-to-webrtc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Frtmp-to-webrtc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notedit","download_url":"https://codeload.github.com/notedit/rtmp-to-webrtc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144108,"owners_count":21054869,"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":["rtmp","webrtc"],"created_at":"2024-12-09T21:12:39.383Z","updated_at":"2025-04-10T02:30:01.226Z","avatar_url":"https://github.com/notedit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rtmp-to-webrtc\n\n基于RTMP-CDN和WebRTC的低延迟(500ms以内)直播系统 \n\n\n### 观看效果 \n\n\nhttps://rtmp-to-webrtc.dot.cc\n\ndemo 部署在个人测试服务器上,  带宽有限,  如果挂了请通知我.\n\n\n### 如何工作 \n\n-  RTMP推流到CDN上, 需要进行编码参数和gop的参数调优 \n-  边缘节点部署webrtc服务器\n-  用户访问一路视频流的时候, 边缘节点webrtc服务器去CDN进行拉流\n-  把rtmp流转封装为rtp, 喂给webrtc服务器\n\n\n\n### RTMP推流脚本\n\n推流部分使用ffmpeg\n```\nffmpeg -f lavfi -re -i color=black:s=640x480:r=15 -filter:v \"drawtext=text='%{localtime\\:%T}':fontcolor=white:fontsize=80:x=20:y=20\" \\\n-vcodec libx264 -tune zerolatency -preset ultrafast  -bsf:v h264_mp4toannexb  -g 15 -keyint_min 15 -profile:v baseline -level 3.0   \\\n-pix_fmt yuv420p -r 15 -f flv rtmp://39.106.248.166/live/live\n\n```\n\n\n\n### RTMP转封装RTP \n\n此部分使用了gstreamer,  只所以用gstreamer是因为发现ffmpeg的转出来的rtp包, 有一定概率webrtc会解析失败, 还未找到具体原因\n```\ngst-launch-1.0 -v  rtmpsrc location=rtmp://localhost/live/{stream} ! flvdemux ! h264parse ! \\\nrtph264pay config-interval=-1 pt={pt} !  udpsink host=127.0.0.1 port={port}\n\n```\n\n\n### 一些数据\n\n服务端部署在阿里云上,  延迟在1000毫秒内,  gstreamer的转封装引入了300ms-500ms延迟(目测, 还没验证).\n优化后整体延迟可以在500ms以内.\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotedit%2Frtmp-to-webrtc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotedit%2Frtmp-to-webrtc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotedit%2Frtmp-to-webrtc/lists"}