Skip to content

stackia/rtp2httpd

 
 

Repository files navigation

IPTV 组播转单播,支持 FCC 快速换台

本 fork 在原版 run2httpd 基础上增加了 FCC 协议支持,可以实现像原生 IPTV 盒子一样的快速换台。

快速换台效果

RPReplay_Final1694331839.MOV
IMG_9297.MOV

注:rtp2httpd 搭配 FCC server 后,仅保证可以快速提供可立即解码的视频流给客户端。具体换台速度能有多快,还取决于视频客户端的实现,客户端的 buffer 越小,换台速度越快。

使用方法

OpenWrt

可以在 Releases 页面下载编译好的 ipk 包直接使用。

下载并安装 rtp2httpd_x.y.z-1_<arch>.ipk / luci-app-rtp2httpd_x.y.z_all.ipk / luci-i18n-rtp2httpd-en_x.y.z_all.ipk / luci-i18n-rtp2httpd-zh-cn_x.y.z_all.ipk 四个包。然后在 LuCI 中配置 rtp2httpd 的启动参数即可。

Image

Docker

仅支持运行在 host 网络模式下。

docker run --network=host --rm ghcr.io/stackia/rtp2httpd:latest --noconfig --verbose 3 --listen 5140 --maxclients 50

启动 rtp2httpd 后,可以使用类似 http://10.0.0.2:5140/rtp/239.253.64.120:5140?fcc=10.255.14.152:15970 这样的地址将组播源转换为单播源。这里的 FCC 服务器地址需要在自己所在地的 IPTV 盒子上抓包获得(关键词 ChannelFCCIP / ChannelFCCPort,通常和直播源 ChannelURL 一起出现),并在路由器上添加静态路由走 IPTV 网络出站。

并非所有地区都有 FCC 服务器,如果抓不到,那么很可能当地运营商没有部署 IPTV FCC 服务器。去掉链接里的 ?fcc=<addr> 可以只使用组播转单播功能。

如果不是直接运行在路由器上,需要开启 fcc-nat-traversal 选项。如果路由器支持 NAT-PMP 功能(通常在 UPnP 相关设置下面),建议设置为 fcc-nat-traversal=2,播放最稳定。如果不支持 NAT-PMP,则设置为 fcc-nat-traversal=1,此时某些情况下播放会不稳定,如果发现不能播放,需要重试几次。

如果直接运行在路由器上,则无需开启 fcc-nat-traversal(或者设置为 0)。

参数说明

Usage: rtp2httpd [options]

Options:
        -h --help            Show this help
        -v --verbose         Increase verbosity
        -q --quiet           Report only fatal errors
        -d --daemon          Fork to background (implies -q)
        -D --nodaemon        Do not daemonise. (default)
        -U --noudpxy         Disable UDPxy compatibility
        -m --maxclients <n>  Serve max n requests simultaneously (dfl 5)
        -l --listen [addr:]port  Address/port to bind (default ANY:8080)
        -c --config <file>   Read this file, instead of
        -C --noconfig        Do not read the default config
        -n --fcc-nat-traversal <0/1/2> NAT traversal for FCC media stream, 0=disabled, 1=punchhole, 2=NAT-PMP (default 0)
        -H --hostname <hostname> Hostname to check in the Host: HTTP header (default none)
        -i --upstream-interface <interface> Interface to use for requesting upstream media stream (default none, which follows the routing table)

rtp2httpd README

Multicast RTP to Unicast HTTP stream convertor with FCC support!
==============================================

Copyright (c) 2008-2020 Ondřej Caletka

What is it
----------

This program converts multicast RTP/UDP media into http stream.
It acts as a tiny HTTP server. When client connect,
pre-configured multicast RTP service is choosen by URL.
Program then join pre-configured multicast address and translate
incoming RTP data to HTTP stream.

As an alternative to pre-configured address, there is also a [UDPxy][1]
compatibility mode. If URL looks like `/<rtp|udp>/<multicast address>:<port>`
and UDPxy mode is enabled (which is default), the program joins address
contained in the URL.

It's main purpose is to remotely watch multicast video and audio
broadcast, when your internet connection in the first-mile
(e.g. broadband router) does not support multicast routing.

Main advantage over translating streams in vlc (http://www.videolan.org)
is that multicast group is joined _after_ the HTTP client connects,
and is leaved immediately after HTTP client disconnects. So,
server can be run all the time and consume almost no bandwidth nor CPU
power, until HTTP client connects.

[1]: http://www.udpxy.com/index-en.html

Installation
------------

The package uses GNU autotools. See the file `INSTALL` for details.

Configuration
-------------

See provided configfile for example, run program with `--help` for
a list of command line switches.

__Do not run rtp2httpd as root. Choose some unprivileged port number and run
it under unprivileged user account.__

About

Multicast RTP to Unicast HTTP stream convertor

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • C 88.8%
  • JavaScript 3.2%
  • Dockerfile 2.6%
  • Makefile 2.5%
  • Shell 1.6%
  • M4 1.3%