### Start rtp2httpd Source: https://github.com/stackia/rtp2httpd/blob/main/tools/README.md Starts the rtp2httpd server with verbose logging and a specific M3U playlist. This is part of the testing setup. ```bash ./build/rtp2httpd -v 4 -C -M file://tools/fixtures/sample.m3u ``` -------------------------------- ### Built-in Web Player Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/url-formats.md Example URL to access the integrated web player for browsing and playing M3U channels. ```url http://192.168.1.1:5140/player ``` -------------------------------- ### Install System Dependencies Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Installs essential build tools and Node.js LTS on Ubuntu/Debian systems. ```bash # Ubuntu/Debian sudo apt-get install build-essential cmake pkg-config curl # Install Node.js LTS (for building Web UI) curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt-get install -y nodejs corepack enable ``` -------------------------------- ### RTSP Time-Shifted Playback Examples Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Examples demonstrating time-shifted playback for RTSP streams using 'playseek' and 'tvdr' parameters. ```url http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?playseek=20240101120000-20240101130000 ``` ```url http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?tvdr=20240101120000GMT-20240101130000GMT ``` -------------------------------- ### Get OpenWrt Architecture Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/quick-start.md If you need to manually install packages, use this command to determine your device's CPU architecture. ```bash # If you don't know your architecture, use this command to get it cat /etc/openwrt_release | grep ARCH ``` -------------------------------- ### RTSP Custom Time-Shift and Offset Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example showing custom time-shift parameter names and independent begin/end offsets for RTSP streams. ```url http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?seek=20240101120000-20240101130000&r2h-seek-name=seek&r2h-seek-offset=12,-12 ``` -------------------------------- ### RTSP Near-Realtime Optimization Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example for enabling RTSP near-realtime optimization using 'r2h-seek-mode'. ```url http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?playseek=20240101120000&r2h-seek-mode=range(UTC%2B8/3600) ``` -------------------------------- ### Install Node.js LTS for Web UI Build Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/installation.md Install the Long Term Support version of Node.js and enable corepack for building the Web UI. ```bash # 安装 Node.js LTS(用于构建 Web UI) curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt-get install -y nodejs corepack enable ``` -------------------------------- ### Compile rtp2httpd from Source Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/installation.md Clone the repository, build the Web UI, configure the build with CMake, and install the application. ```bash # 克隆仓库 git clone https://github.com/stackia/rtp2httpd.git cd rtp2httpd # 构建 Web UI 并嵌入静态资源 pnpm install --frozen-lockfile pnpm run web-ui:build # 配置和编译 cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_AGGRESSIVE_OPT=ON cmake --build build -j$(getconf _NPROCESSORS_ONLN) # 安装 sudo cmake --install build ``` -------------------------------- ### Install Build Dependencies (Ubuntu/Debian) Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/installation.md Install essential build tools and libraries required for compiling rtp2httpd on Ubuntu or Debian-based systems. ```bash # Ubuntu/Debian sudo apt-get install build-essential cmake pkg-config curl ``` -------------------------------- ### RTSP to HTTP Examples Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/url-formats.md Various examples for RTSP to HTTP conversion, including live streams, time-shift playback with different parameters, and specifying upstream network interfaces. ```url # 直播流 http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1 ``` ```url # 时移回看(使用 playseek 参数) http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?playseek=20240101120000-20240101130000 ``` ```url # 时移回看(使用 tvdr 参数) http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?tvdr=20240101120000GMT-20240101130000GMT ``` ```url # 自定义时移参数名 + 起止时间独立偏移 http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?seek=20240101120000-20240101130000&r2h-seek-name=seek&r2h-seek-offset=12,-12 ``` ```url # 显式开启 RTSP 近实时优化(参见 r2h-seek-mode 文档) http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?playseek=20240101120000&r2h-seek-mode=range(UTC%2B8/3600) ``` ```url # 指定上游网络接口 http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?r2h-ifname=eth0 ``` -------------------------------- ### Install rtp2httpd on OpenWrt Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/quick-start.md Use this command to automatically download and install the latest version of rtp2httpd on OpenWrt. The script handles architecture detection, package fetching, and installation, including upgrades. ```bash uclient-fetch -q -O - https://raw.githubusercontent.com/stackia/rtp2httpd/main/scripts/install-openwrt.sh | sh -s -- --lang en ``` -------------------------------- ### RTSP Specify Upstream Interface Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example demonstrating how to specify the upstream network interface for an RTSP stream. ```url http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?r2h-ifname=eth0 ``` -------------------------------- ### M3U Playlist Access Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/url-formats.md Example URL to access the generated M3U playlist, which consolidates all configured channels into a single playable list. ```url http://192.168.1.1:5140/playlist.m3u ``` -------------------------------- ### HTTP Reverse Proxy Time-Shift Examples Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/url-formats.md Examples demonstrating time-shift playback support for HTTP proxying, including automatic parameter recognition, custom parameter names, time offsets, and specifying upstream network interfaces. ```url # 自动识别 playseek 参数并进行时区转换 http://192.168.1.1:5140/http/iptv.example.com/channel1?playseek=20240101120000-20240101130000 ``` ```url # 使用自定义参数名 + 时间偏移 http://192.168.1.1:5140/http/iptv.example.com/channel1?catchup=20240101120000&r2h-seek-name=catchup&r2h-seek-offset=3600 ``` ```url # 指定上游网络接口 http://192.168.1.1:5140/http/iptv.example.com/channel1?r2h-ifname=eth0 ``` -------------------------------- ### Example HTTP Playseek URL Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Demonstrates a typical HTTP request with a playseek parameter for time-shifted playback. ```http http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1?playseek=20240101120000-20240101130000 ``` -------------------------------- ### Download and Install FFmpeg Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/video-snapshot.md Installs a static compiled version of FFmpeg for amd64 architecture. Ensure FFmpeg is not already in your system PATH or that you want to use this specific version. ```bash cd /tmp wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz tar xf ffmpeg-release-amd64-static.tar.xz sudo cp ffmpeg-*-static/ffmpeg /usr/local/bin/ sudo chmod +x /usr/local/bin/ffmpeg ``` -------------------------------- ### RTSP Live Stream Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example of a basic RTSP live stream conversion to HTTP. ```url http://192.168.1.1:5140/rtsp/iptv.example.com:554/channel1 ``` -------------------------------- ### Manually Install rtp2httpd Packages on OpenWrt Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/quick-start.md After determining your architecture and downloading the necessary .ipk files, use this command to install them on your OpenWrt device. ```bash # Manually upload ipk files to device and install opkg install rtp2httpd_*.ipk luci-app-rtp2httpd_*.ipk luci-i18n-rtp2httpd-*.ipk ``` -------------------------------- ### HTTP Proxy HLS Stream Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example of proxying an HLS stream from an upstream server, including the port. ```url http://192.168.1.1:5140/http/upstream.example.com:8080/live/stream.m3u8 ``` -------------------------------- ### Run Static Binary with Command-Line Parameters Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Execute the rtp2httpd binary using only command-line arguments, bypassing any configuration file. This is suitable for simple or dynamic setups. ```bash # Run with command-line parameters only ./rtp2httpd-X.Y.Z-x86_64 --noconfig --verbose 2 --listen 5140 --maxclients 20 ``` -------------------------------- ### Build rtp2httpd from Source Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Clones the repository, installs Node.js dependencies, builds the Web UI, configures, and compiles the project using CMake. ```bash # Clone repository git clone https://github.com/stackia/rtp2httpd.git cd rtp2httpd # Build Web UI and embed static resources pnpm install --frozen-lockfile pnpm run web-ui:build # Configure and build cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_AGGRESSIVE_OPT=ON cmake --build build -j$(getconf _NPROCESSORS_ONLN) # Install sudo cmake --install build ``` -------------------------------- ### Get CPU Architecture Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/installation.md Determine your system's CPU architecture before downloading the binary. ```bash # 获取自己的 CPU 架构 uname -m ``` -------------------------------- ### HTTP Reverse Proxy Examples Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/url-formats.md Examples for HTTP reverse proxying, including proxying HLS streams and general HTTP requests. Supports specifying upstream port and path with query parameters. ```url # 代理 HLS 流(指定端口) http://192.168.1.1:5140/http/upstream.example.com:8080/live/stream.m3u8 ``` ```url # 代理 HTTP 请求(省略端口,默认 80) http://192.168.1.1:5140/http/api.example.com/video?auth=xxx&quality=hd ``` -------------------------------- ### Get CPU Architecture and Download Binary Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Determine your system's CPU architecture and download the appropriate static binary for rtp2httpd. Ensure the downloaded file is executable. ```bash # Get your CPU architecture uname -m # Download binary file wget https://github.com/stackia/rtp2httpd/releases/download/vX.Y.Z/rtp2httpd-X.Y.Z-x86_64 chmod +x rtp2httpd-X.Y.Z-x86_64 ``` -------------------------------- ### Basic rtp2httpd Command-Line Usage Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/reference/configuration.md The fundamental command to start the rtp2httpd service. Options can be appended to customize its behavior. ```bash rtp2httpd [options] ``` -------------------------------- ### Input M3U Playlist Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/m3u-integration.md An example of an input M3U playlist with various channel configurations, including EPG URLs, channel IDs, logos, group titles, and catch-up sources. ```m3u #EXTM3U x-tvg-url="https://example.com/epg.xml.gz" #EXTINF:-1 tvg-id="CCTV1" tvg-name="CCTV1" tvg-logo="https://example.com/logo/CCTV1.png" group-title="CCTV" catchup="default" catchup-source="rtsp://10.0.0.50:554/catchup?auth=loremipsum&playseek={utc:YmdHMS}-{utcend:YmdHMS}",CCTV-1 rtp://239.253.64.120:5140 #EXTINF:-1 tvg-id="CCTV2" tvg-name="CCTV2" group-title="CCTV",CCTV-2 rtp://239.253.64.121:5140 #EXTINF:-1 tvg-id="HLS1" tvg-name="Internal HLS Source",Internal-HLS-Source http://10.0.0.60/live/stream.m3u8 ``` -------------------------------- ### HTTP Proxy Request Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example of proxying a general HTTP request to an upstream server, with omitted port (defaults to 80). ```url http://192.168.1.1:5140/http/api.example.com/video?auth=xxx&quality=hd ``` -------------------------------- ### Multicast RTP Stream Examples Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Examples demonstrating various configurations for multicast RTP streams, including FCC, FCC type, FEC, and interface specifications. ```url http://192.168.1.1:5140/rtp/239.253.64.120:5140 ``` ```url http://192.168.1.1:5140/rtp/239.253.64.120:5140?fcc=10.255.14.152:15970 ``` ```url http://192.168.1.1:5140/rtp/239.253.64.120:5140?fcc=10.255.14.152:8027&fcc-type=huawei ``` ```url http://192.168.1.1:5140/rtp/239.81.0.195:4056?fec=4055 ``` ```url http://192.168.1.1:5140/rtp/239.253.64.120:5140?fcc=10.255.14.152:15970&r2h-ifname=eth0&r2h-ifname-fcc=eth1 ``` -------------------------------- ### M3U Configuration for Time-Shifted Playback Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/m3u-integration.md Example M3U configuration showing how to use the 'catchup' and 'catchup-source' attributes for time-shifted playback. Dynamic placeholders like {utc:YmdHMS} are preserved. ```m3u #EXTINF:-1 tvg-id="CCTV1" catchup="default" catchup-source="rtsp://10.0.0.50:554/catchup?playseek={utc:YmdHMS}-{utcend:YmdHMS}",CCTV-1 rtp://239.253.64.120:5140 #EXTINF:-1 catchup="append" catchup-source="?starttime=${(b)yyyyMMdd|UTC}T${(e)yyyyMMdd|UTC}T${(e)HHmmss|UTC}",CCTV-1 http://iptv.example.com/live/channel1.m3u8 ``` -------------------------------- ### Basic rtp2httpd-tools Usage Source: https://github.com/stackia/rtp2httpd/blob/main/tools/README.md Starts the replay tool to replay packets when an IGMP join is detected. Requires Python 3.12+ and uv. ```bash uv run python tools/main.py [options] ``` -------------------------------- ### RTSP URL with credentials and IPv6 Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example of an RTSP URL including username, password, and an IPv6 host address. ```url rtsp://user:pass@[2001:db8::1]:554/live ``` -------------------------------- ### Enable Video Snapshot via Command Line Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/video-snapshot.md Enables the video snapshot feature and specifies the FFmpeg path and arguments when starting rtp2httpd from the command line. ```bash rtp2httpd --video-snapshot --ffmpeg-path /usr/bin/ffmpeg --ffmpeg-args "-hwaccel none" ``` -------------------------------- ### Run E2E Tests with uv (Project Root) Source: https://github.com/stackia/rtp2httpd/blob/main/e2e/README.md Execute all end-to-end tests using uv from the project root directory. This ensures consistent environment setup. ```bash # Or use uv directly from project root uv run pytest e2e/ -v ``` -------------------------------- ### Install Wireshark Plugin on Windows Source: https://github.com/stackia/rtp2httpd/blob/main/wireshark-support/README.md Specifies the directory for Wireshark plugins on Windows systems. ```text %APPDATA%\Wireshark\plugins\ ``` -------------------------------- ### Example Stress Test Output Source: https://github.com/stackia/rtp2httpd/blob/main/tools/README.md Illustrates the typical output format of the stress test, including configuration details and resource usage statistics for tested programs. ```text ============================================================ Stress Test: rtp2httpd ============================================================ Program: rtp2httpd Binary: /path/to/rtp2httpd Duration: 10s Clients: 8 Replay speed: 5.0x (~40 Mbps) Port: 5140 Streams: 239.81.0.1-8:4056 (unique per client) ============================================================ [1/3] Starting multicast replay... PID: 12345 [2/3] Starting rtp2httpd... PID: 12346 [3/3] Starting 8 curl clients... Each client uses a unique address in 239.81.0.0/24 URLs: http://127.0.0.1:5140/rtp/239.81.0.1:4056 ... (and 7 more) PIDs: [12347, 12348, ...] [Running] Test running for 10 seconds... Progress: 10.0s / 10s ============================================================ RESULTS ============================================================ [rtp2httpd] CPU: avg= 2.00% max= 2.00% PSS: avg= 3.62MB max= 3.62MB USS: avg= 3.62MB max= 3.62MB [replay (main.py)] CPU: avg=100.67% max=102.00% PSS: avg= 69.47MB max= 69.47MB USS: avg= 69.47MB max= 69.47MB [curl clients x4 (aggregated)] CPU: avg= 0.00% max= 0.00% PSS: avg= 38.62MB max= 38.62MB USS: avg= 38.62MB max= 38.62MB ------------------------------------------------------------ SUMMARY (rtp2httpd) ------------------------------------------------------------ Test duration: 10s Clients: 4 Replay speed: 5.0x (~40 Mbps) CPU average: 2.00% CPU peak: 2.00% PSS average: 3.62 MB (proportional) PSS peak: 3.62 MB USS average: 3.62 MB (private only) USS peak: 3.62 MB ============================================================ ``` -------------------------------- ### Install Wireshark Plugin on Linux/macOS Source: https://github.com/stackia/rtp2httpd/blob/main/wireshark-support/README.md Copies the Lua dissector script to the Wireshark plugins directory for Linux and macOS systems. ```bash mkdir -p ~/.local/lib/wireshark/plugins/ cp fcc_dissector.lua ~/.local/lib/wireshark/plugins/ ``` -------------------------------- ### Enable Video Snapshot Feature Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/reference/configuration.md Enable the video snapshot feature to get real-time snapshots via the `snapshot=1` query parameter. ```ini video-snapshot = no ``` -------------------------------- ### Test rtp2httpd Access URLs Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/quick-start.md After configuring rtp2httpd, use these example URLs to test access to the RTP multicast stream, the status page, and the M3U playlist. ```bash # Access RTP multicast stream http://router-IP:5140/rtp/239.253.64.120:5140 # Access status page http://router-IP:5140/status # Get M3U playlist (if configured) http://router-IP:5140/playlist.m3u ``` -------------------------------- ### Video Snapshot via Custom header Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Get a JPEG snapshot by setting a custom `X-Request-Snapshot` HTTP header to `1`. ```curl curl -H "X-Request-Snapshot: 1" http://192.168.1.1:5140/rtp/239.253.64.120:5140 ``` -------------------------------- ### Run Stress Test for rtp2httpd Source: https://github.com/stackia/rtp2httpd/blob/main/tools/README.md Executes the stress test script for the default rtp2httpd program. This is the basic command to start performance testing. ```bash uv run python tools/stress_test.py ``` -------------------------------- ### Display Build Configuration Source: https://github.com/stackia/rtp2httpd/blob/main/CMakeLists.txt Logs the current build configuration details to the console during the CMake configuration process. This includes platform, compiler, build type, optimization settings, and installation prefix. ```cmake message(STATUS "") message(STATUS "rtp2httpd build configuration:") message(STATUS " Platform: ${CMAKE_SYSTEM_NAME}") message(STATUS " Compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") message(STATUS " Build type: ${CMAKE_BUILD_TYPE}") message(STATUS " Aggressive opt: ${ENABLE_AGGRESSIVE_OPT}") message(STATUS " Install prefix: ${CMAKE_INSTALL_PREFIX}") message(STATUS "") ``` -------------------------------- ### M3U Playlist Services Configuration Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/reference/configuration.md Define services using an M3U playlist format directly within the configuration file. Includes TV guide information. ```ini #EXTM3U x-tvg-url="https://example.com/epg.xml.gz" #EXTINF:-1 tvg-id="CCTV1" tvg-name="CCTV1" tvg-logo="https://example.com/logo/CCTV1.png" group-title="CCTV" catchup="default" catchup-source="rtsp://10.0.0.50:554/catchup?playseek={utc:YmdHMS}-{utcend:YmdHMS}",CCTV-1 rtp://239.253.64.120:5140 #EXTINF:-1 tvg-id="CCTV2" tvg-name="CCTV2" group-title="CCTV",CCTV-2 rtp://239.253.64.121:5140 ``` -------------------------------- ### Download and Run Static Binary Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/installation.md Download the pre-compiled binary, make it executable, and run it with a configuration file. ```bash # 下载二进制文件 wget https://github.com/stackia/rtp2httpd/releases/download/vX.Y.Z/rtp2httpd-X.Y.Z-x86_64 chmod +x rtp2httpd-X.Y.Z-x86_64 # 使用配置文件运行 ./rtp2httpd-X.Y.Z-x86_64 --config /path/to/rtp2httpd.conf ``` -------------------------------- ### Global Configuration in INI File Source: https://github.com/stackia/rtp2httpd/blob/main/docs/reference/configuration.md Example of global configuration settings within the rtp2httpd INI configuration file. These settings control logging, client limits, and worker processes. ```ini [global] # 日志详细程度: 0=FATAL 1=ERROR 2=WARN 3=INFO 4=DEBUG verbosity = 3 # 最大并发客户端数 maxclients = 20 # UDPxy 兼容性 udpxy = yes # 工作进程数(默认: 1) workers = 1 # 检查 HTTP 请求的 Host 头 (默认:无) hostname = somehost.example.com # 启用后,将使用 HTTP X-Forwarded-For 头作为客户端地址,用于显示在状态面板上 (默认:no) # 并接受 X-Forwarded-Host / X-Forwarded-Proto 头作为 playlist.m3u 中的地址前缀 # 建议仅在使用反向代理时启用 xff = no # HTTP 请求认证令牌(可选,默认: 无) # 设置后,所有 HTTP 请求必须携带 r2h-token 查询参数,且值与此配置匹配 # 例如: # http://server:5140/rtp/239.253.64.120:5140?fcc=10.255.14.152:15970&r2h-token=your-secret-token # http://server:5140/player?r2h-token=your-secret-token r2h-token = your-secret-token-here # 状态页路径(默认: /status) status-page-path = /status # 播放器页路径(默认: /player) player-page-path = /player # 上游网络接口配置 (可选) # # 简单配置:只配置一个默认接口,所有流量类型都使用此接口 upstream-interface = eth0 # # 高级配置:为不同流量类型配置专用接口 # 注意:专用接口配置优先级高于默认接口 # upstream-interface-multicast = eth0 # 组播流量 (RTP/UDP) # upstream-interface-fcc = eth1 # FCC # upstream-interface-rtsp = eth2 # RTSP # upstream-interface-http = eth3 # HTTP 代理 # # 混合配置示例:默认使用 eth0,但 FCC 使用更快的 eth1 # upstream-interface = eth0 # upstream-interface-fcc = eth1 # # 优先级:upstream-interface-{multicast,fcc,rtsp,http} > upstream-interface > 系统路由表 # 对于 FreeBSD 系统,仅支持设置组播接口 # 外部 M3U 配置(支持 file://, http://, https://) # 注意:HTTP/HTTPS 需要安装 curl 或 uclient-fetch 或 wget 命令 external-m3u = https://example.com/iptv.m3u # 或使用本地文件 external-m3u = file:///path/to/playlist.m3u # 外部 M3U 更新间隔(秒) # 默认 7200(2 小时),设为 0 禁用自动更新 external-m3u-update-interval = 7200 # 组播周期性重新加入间隔(秒,默认: 0 禁用) # 设置为正值(如 60)以周期性重新加入组播组 # 这是针对以下网络环境的兼容性解决方案: # - 启用 IGMP snooping 的交换机在没有路由器 IGMP Query 时超时 # - 配置不当的网络设备会丢弃组播成员关系 # 推荐值: 30-120 秒(小于典型交换机超时 260 秒) # 注意:默认禁用(0),仅在遇到组播流中断时才需要启用 # 注意:不支持 IPv6 mcast-rejoin-interval = 0 ``` -------------------------------- ### Compile luci-app-rtp2httpd Package in OpenWrt Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Compile the luci-app-rtp2httpd package within an OpenWrt environment after updating and installing feeds. This command builds the package for firmware integration or as a standalone package. ```bash make package/feeds/rtp2httpd/luci-app-rtp2httpd/compile -j1 V=sc ``` -------------------------------- ### Configure FFmpeg Arguments for Hardware Acceleration Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/video-snapshot.md Specifies additional arguments for FFmpeg to enable hardware acceleration, improving performance on compatible hardware. Examples include VA-API for Intel GPUs. ```ini [global] # Use VA-API hardware acceleration (Intel GPU) ffmpeg-args = -hwaccel vaapi # Or use auto-detection ffmpeg-args = -hwaccel auto ``` -------------------------------- ### Run Static Binary with Configuration File Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Execute the downloaded rtp2httpd binary, specifying a configuration file path. This is useful for managing complex settings. ```bash # Run with config file ./rtp2httpd-X.Y.Z-x86_64 --config /path/to/rtp2httpd.conf ``` -------------------------------- ### Output M3U Playlist Example (After Conversion) Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/m3u-integration.md The converted M3U playlist shows how rtp2httpd transforms URLs, EPG sources, and catch-up sources into its own proxy addresses. This includes converting internal HLS sources. ```m3u #EXTM3U x-tvg-url="http://192.168.1.1:5140/epg.xml.gz" #EXTINF:-1 tvg-id="CCTV1" tvg-name="CCTV1" tvg-logo="https://example.com/logo/CCTV1.png" group-title="CCTV" catchup="default" catchup-source="http://192.168.1.1:5140/CCTV-1/catchup?playseek={utc:YmdHMS}-{utcend:YmdHMS}",CCTV-1 http://192.168.1.1:5140/CCTV/CCTV-1 #EXTINF:-1 tvg-id="CCTV2" tvg-name="CCTV2" group-title="CCTV",CCTV-2 http://192.168.1.1:5140/CCTV/CCTV-2 #EXTINF:-1 tvg-id="HLS1" tvg-name="Internal HLS Source",Internal-HLS-Source http://192.168.1.1:5140/Internal-HLS-Source ``` -------------------------------- ### Full ISO 8601 with Milliseconds and Suffix Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Full ISO 8601 format including milliseconds is recognized. Timezone interpretation depends on the suffix (e.g., `Z` for UTC). ```text 2024-01-01T12:00:00.123Z ``` -------------------------------- ### Configure External M3U File Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/m3u-integration.md Specify an external M3U URL or local file path in the global configuration section. Ensure necessary tools like curl, uclient-fetch, or wget are installed if using HTTP/HTTPS URLs. The update interval can be adjusted or disabled. ```ini [global] # External M3U configuration (supports file://, http://, https://) # Note: HTTP/HTTPS requires curl, uclient-fetch, or wget command to be installed external-m3u = https://example.com/iptv.m3u # Or use local file external-m3u = file:///path/to/playlist.m3u # External M3U update interval (seconds) # Default 7200 (2 hours), set to 0 to disable auto-update external-m3u-update-interval = 7200 ``` -------------------------------- ### Basic Docker Container Startup Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Launch rtp2httpd using a Docker container with host network mode for multicast support. This command includes essential parameters for basic operation. ```bash docker run --network=host --cap-add=NET_ADMIN --ulimit memlock=-1:-1 --rm \ ghcr.io/stackia/rtp2httpd:latest \ --noconfig --verbose 2 --listen 5140 --maxclients 20 ``` -------------------------------- ### Run Static Binary with Command-Line Arguments Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/installation.md Execute the static binary using only command-line arguments, bypassing the configuration file. ```bash # 仅使用命令行参数运行 ./rtp2httpd-X.Y.Z-x86_64 --noconfig --verbose 2 --listen 5140 --maxclients 20 ``` -------------------------------- ### Start Playback from a Specific NPT Time Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Starts playback from a specified Network Presentation Time (NPT) point in seconds. This is commonly used for resuming playback. If Range Seek mode is active, this parameter is ignored. ```text ?r2h-start=123.45 ``` -------------------------------- ### 14-digit yyyyMMddHHmmss with GMT Suffix Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md The 14-digit `yyyyMMddHHmmss` format with a `GMT` suffix is recognized and treated as self-contained UTC. ```text 20240101120000GMT ``` -------------------------------- ### Compile luci-app-rtp2httpd Package Source: https://github.com/stackia/rtp2httpd/blob/main/docs/guide/installation.md Compile the luci-app-rtp2httpd and rtp2httpd packages individually for OpenWrt. ```bash make package/feeds/rtp2httpd/luci-app-rtp2httpd/compile -j$(getconf _NPROCESSORS_ONLN) V=sc ``` -------------------------------- ### Enable Video Snapshot via Configuration File Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/video-snapshot.md Enables the video snapshot feature and configures FFmpeg path and arguments within the rtp2httpd configuration file. ```ini [global] # Enable video snapshot feature video-snapshot = yes # FFmpeg executable path (optional, default: ffmpeg) ffmpeg-path = /usr/bin/ffmpeg # FFmpeg additional arguments (optional, default: -hwaccel none) ffmpeg-args = -hwaccel none ``` -------------------------------- ### 14-digit yyyyMMddHHmmss Format Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md The 14-digit `yyyyMMddHHmmss` format is recognized. This format does not contain timezone information and requires external derivation. ```text 20240101120000 ``` -------------------------------- ### Video Snapshot via URL parameter Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Get a JPEG snapshot of the video stream by appending `snapshot=1` to the streaming URL. ```url http://192.168.1.1:5140/rtp/239.253.64.120:5140?snapshot=1 ``` -------------------------------- ### Enable Video Snapshot with Intel GPU Acceleration Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/video-snapshot.md Enables video snapshot and configures FFmpeg to use VA-API hardware acceleration for Intel GPUs. ```ini [global] video-snapshot = yes ffmpeg-args = -hwaccel vaapi ``` -------------------------------- ### HTTP reverse proxy with IPv6 upstream Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/url-formats.md Example of an HTTP reverse proxy URL format when the upstream server has an IPv6 address. ```url http://192.168.1.1:5140/http/[2001:db8::1]:8080/live/stream.m3u8 ``` -------------------------------- ### Compact ISO 8601 Format Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Compact ISO 8601 format (`yyyyMMddTHHmmss`) is recognized. This format does not contain timezone information. ```text 20240101T120000 ``` -------------------------------- ### Initialize Player Theme Source: https://github.com/stackia/rtp2httpd/blob/main/web-ui/player.html Applies the user's preferred theme (light, dark, or auto) to the player. It checks local storage for a stored theme preference and uses the system's color scheme preference if set to 'auto'. ```javascript ( () => { try { const storageKey = "player-theme"; const stored = localStorage.getItem(storageKey); const theme = stored === "light" || stored === "dark" ? stored : "auto"; const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches; const isDark = theme === "dark" || (theme === "auto" && prefersDark); const root = document.documentElement; if (isDark) { root.classList.add("dark"); root.style.colorScheme = "dark"; } else { root.classList.remove("dark"); root.style.colorScheme = "light"; } } catch (error) { console.warn("Failed to apply stored theme early", error); } })(); ``` -------------------------------- ### Full ISO 8601 with Z Suffix Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Full ISO 8601 format with a `Z` suffix is recognized and treated as self-contained UTC. ```text 2024-01-01T12:00:00Z ``` -------------------------------- ### Bind to All Addresses Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/reference/configuration.md Configure the service to listen on all available network interfaces on port 5140. ```ini * 5140 ``` -------------------------------- ### Compact ISO 8601 with Z Suffix Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Compact ISO 8601 format with a `Z` suffix is recognized and treated as self-contained UTC. ```text 20240101T120000Z ``` -------------------------------- ### Unix Timestamp Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md A Unix timestamp (seconds since the epoch) is recognized as a valid time format. This format is self-contained and uses UTC. ```text 1704096000 ``` -------------------------------- ### Full ISO 8601 Format Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Full ISO 8601 format (`yyyy-MM-ddTHH:mm:ss`) is recognized. This format does not contain timezone information. ```text 2024-01-01T12:00:00 ``` -------------------------------- ### Integrate rtp2httpd Makefile for Firmware Maintainers Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Replace the default Makefile with `Makefile.versioned` for easier integration into third-party OpenWrt feeds. This ensures correct versioning and source fetching. ```bash git clone https://github.com/stackia/rtp2httpd.git cd rtp2httpd # Replace original Makefile with pre-generated one (includes fixed version number, source download URL and PKG_HASH) mv openwrt-support/rtp2httpd/Makefile.versioned openwrt-support/rtp2httpd/Makefile mv openwrt-support/luci-app-rtp2httpd/Makefile.versioned openwrt-support/luci-app-rtp2httpd/Makefile # Copy openwrt-support directory contents to your feeds repository cp -r openwrt-support/* /path/to/your/feeds/ ``` -------------------------------- ### Run All E2E Tests Source: https://github.com/stackia/rtp2httpd/blob/main/e2e/README.md Execute all end-to-end tests in parallel. This is the recommended way to run the full test suite. ```bash # Run all tests (parallel, recommended) ./scripts/run-e2e.sh ``` -------------------------------- ### Docker Compose Configuration for rtp2httpd Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/installation.md Define rtp2httpd service configuration using docker-compose. This setup ensures the container runs with necessary privileges and network settings. ```yaml services: rtp2httpd: image: ghcr.io/stackia/rtp2httpd:latest network_mode: host restart: always cap_add: - NET_ADMIN ulimits: memlock: soft: -1 hard: -1 command: --noconfig --verbose 2 --listen 5140 --maxclients 20 ``` -------------------------------- ### Basic Replay Source: https://github.com/stackia/rtp2httpd/blob/main/tools/README.md Replays packets from a pcapng file when IGMP join is detected. This is the most basic usage scenario. ```bash uv run python tools/main.py tools/fixtures/fec_sample.pcapng ``` -------------------------------- ### Run rtp2httpd Benchmark Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/reference/benchmark.md Execute the benchmark script for rtp2httpd. Ensure you are in the tools directory. Test results are automatically saved to a timestamped text file. ```bash cd tools ./benchmark.sh ``` -------------------------------- ### Enable Video Snapshot with Embedded Device Acceleration Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/video-snapshot.md Enables video snapshot and configures FFmpeg to use V4L2 hardware acceleration for embedded SoCs. ```ini [global] video-snapshot = yes ffmpeg-args = -hwaccel v4l2m2m ``` -------------------------------- ### Compact ISO 8601 with ±HH:MM Offset Example Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/time-processing.md Compact ISO 8601 format with a `±HH:MM` offset is recognized and treated as self-contained with the specified timezone. ```text 20240101T200000+08:00 ``` -------------------------------- ### Request Snapshot with Accept Header Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/video-snapshot.md Use the Accept: image/jpeg header with curl to request a snapshot. This method is useful for scripting and testing. ```bash curl -H "Accept: image/jpeg" http://192.168.1.1:5140/rtp/239.253.64.120:5140 ``` -------------------------------- ### Additional FFmpeg Arguments Configuration Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/reference/configuration.md Pass additional arguments to FFmpeg when generating snapshots. Common options include hardware acceleration. ```ini ffmpeg-args = -hwaccel none ``` -------------------------------- ### Run Specific E2E Test File with uv Source: https://github.com/stackia/rtp2httpd/blob/main/e2e/README.md Execute tests from a specific file using uv from the project root. This allows targeted testing with environment management. ```bash uv run pytest e2e/test_m3u.py -v ``` -------------------------------- ### Request Multiple Streams Source: https://github.com/stackia/rtp2httpd/blob/main/tools/README.md Demonstrates requesting multiple streams from different IP addresses within the same subnet. The replay tool will simultaneously send packets to all joined addresses. ```bash # Terminal 1: Request 239.81.0.1 curl http://localhost:5140/rtp/239.81.0.1:4056 -o /dev/null # Terminal 2: Request 239.81.0.2 curl http://localhost:5140/rtp/239.81.0.2:4056 -o /dev/null # Terminal 3: Request 239.81.0.3 curl http://localhost:5140/rtp/239.81.0.3:4056 -o /dev/null ``` -------------------------------- ### Global Configuration Options Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/reference/configuration.md Sets global parameters for rtp2httpd, including logging verbosity, maximum clients, and worker processes. ```ini [global] # Logging verbosity: 0=FATAL 1=ERROR 2=WARN 3=INFO 4=DEBUG verbosity = 3 # Maximum concurrent clients maxclients = 20 # UDPxy compatibility udpxy = yes # Number of worker processes (default: 1) workers = 1 # Check HTTP Host header (default: none) hostname = somehost.example.com # When enabled, use HTTP X-Forwarded-For header as client address for display on the status page (default: no) # Also accept X-Forwarded-Host / X-Forwarded-Proto headers as address prefix in playlist.m3u # Recommended to enable only when using a reverse proxy xff = no # HTTP request authentication token (optional, default: none) # When set, all HTTP requests must include the r2h-token query parameter matching this value # Example: # http://server:5140/rtp/239.253.64.120:5140?fcc=10.255.14.152:15970&r2h-token=your-secret-token # http://server:5140/player?r2h-token=your-secret-token r2h-token = your-secret-token-here # Status page path (default: /status) status-page-path = /status # Player page path (default: /player) player-page-path = /player ``` -------------------------------- ### M3U Output with Source Labels Converted Source: https://github.com/stackia/rtp2httpd/blob/main/docs/en/guide/m3u-integration.md Example M3U output showing how rtp2httpd converts source labels ('$label') into subpaths and preserves them in the final URL for services supporting channel aggregation. ```m3u #EXTINF:-1 tvg-id="Guangdong TV" tvg-name="Guangdong TV" tvg-logo="https://example.com/logo/GuangdongTV.png" group-title="Satellite",Guangdong TV http://192.168.1.1:5140/Satellite/Guangdong TV/UHD$UHD #EXTINF:-1 tvg-id="Guangdong TV" tvg-name="Guangdong TV" tvg-logo="https://example.com/logo/GuangdongTV.png" group-title="Satellite",Guangdong TV http://192.168.1.1:5140/Satellite/Guangdong TV/HD$HD #EXTINF:-1 tvg-id="Guangdong TV" tvg-name="Guangdong TV" tvg-logo="https://example.com/logo/GuangdongTV.png" group-title="Satellite",Guangdong TV http://192.168.1.1:5140/Satellite/Guangdong TV/SD$SD ``` -------------------------------- ### Check Wireshark Plugin Directory Source: https://github.com/stackia/rtp2httpd/blob/main/wireshark-support/README.md Navigates to the Wireshark folders configuration to verify the location of personal Lua plugins. ```text Help -> About Wireshark -> Folders -> Personal Lua Plugins ```