FFmpeg
We have tools whipinto and whepfrom for support rtp <-> whip/whep convert
Raspberry Pi and other ARM boards
Every example on this page encodes video in software (libx264, libvpx, ...) on the CPU. On a Raspberry Pi, RK3588 or similar board this saturates the CPU — use the native hardware-pipeline build instead. If ffmpeg is unavoidable, use the board's hardware encoder (e.g. -c:v h264_v4l2m2m -b:v 1M on Raspberry Pi OS) instead of libx264.
For Example:
ffmpeg -> whipinto -> live777 -> whepfrom -> ffplayffmpeg/whip
ffmpeg >= 8.0, ffmpeg support whip protocol. ffmpeg/whip
Need build set flag --enable-muxer=whip
Most pre-compile don't enable this
ffmpeg -> live777 -> whepfrom -> ffplayOnly support codec h264 and opus
You can use this docker images ffmpeg:
docker build -f docker/Dockerfile.ffmpeg -t ghcr.io/binbat/ffmpeg .H264
X264 RTP
Video Test Src
# send RTP and Create SDP file
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
-vcodec libx264 -pix_fmt yuv420p \
-g 60 -keyint_min 60 -crf 23 \
-preset ultrafast -tune zerolatency \
-profile:v main -level 4.1 \
-f rtp 'rtp://127.0.0.1:5002' -sdp_file input.sdpFor ffplay. You Need a sdp file
ffplay -protocol_whitelist rtp,file,udp -i input.sdpYou can use whipinto tools receiver RTP and convert to WebRTC
# Use SDP file as input
whipinto -i input.sdp -w http://localhost:7777/whip/777whepfrom -o output.sdp -w http://localhost:7777/whep/777For ffplay. You Need a sdp file
ffplay -protocol_whitelist rtp,file,udp -i output.sdpX264 WHIP
docker run --rm --network host \
ghcr.io/binbat/ffmpeg:latest \
\
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
-vcodec libx264 -pix_fmt yuv420p \
-g 60 -keyint_min 60 -crf 23 \
-preset ultrafast -tune zerolatency \
-profile:v main -level 4.1 \
-f whip http://localhost:7777/whip/777H265
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
-vcodec libx265 -pix_fmt yuv420p \
-g 60 -keyint_min 60 -crf 25 \
-preset ultrafast -tune zerolatency \
-profile:v main -level 4.1 \
-f rtp 'rtp://127.0.0.1:5002' -sdp_file input.sdpwhipinto -i input.sdp -w http://localhost:7777/whip/777AV1
WARNING
- Please set
-strict experimental
ffmpeg -re -f lavfi -i testsrc=size=640x360:rate=30 -pix_fmt yuv420p \
-c:v libaom-av1 -cpu-used 8 -tile-columns 0 -tile-rows 0 -row-mt 1 \
-lag-in-frames 0 -g 30 -keyint_min 30 -b:v 0 -crf 30 -threads 4 \
-strict experimental \
-f rtp "rtp://127.0.0.1:5002" -sdp_file input.sdpVP8
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
-vcodec libvpx -pix_fmt yuv420p \
-g 60 -keyint_min 60 \
-deadline realtime -speed 4 \
-b:v 2000k -maxrate 2500k -bufsize 5000k \
-f rtp 'rtp://127.0.0.1:5002' -sdp_file input.sdpwhipinto -i input.sdp -w http://localhost:7777/whip/777VP9
WARNING
Packetizing VP9 is experimental and its specification is still in draft state. Please set -strict experimental in order to enable it.
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
-strict experimental -vcodec libvpx-vp9 -pix_fmt yuv420p \
-g 60 -keyint_min 60 \
-deadline realtime -speed 5 \
-row-mt 1 -tile-columns 2 -frame-parallel 1 \
-b:v 1800k -maxrate 2200k -bufsize 4400k \
-f rtp 'rtp://127.0.0.1:5002' -sdp_file input.sdpWARNING
VP9 support multi color space, Must add -pix_fmt yuv420p params.
whipinto -i input.sdp -w http://localhost:7777/whip/777OPUS
OPUS RTP
ffmpeg -re -f lavfi -i sine=frequency=1000 \
-acodec libopus \
-ar 48000 -ac 2 \
-b:a 48k -application voip \
-frame_duration 10 -vbr constrained \
-f rtp 'rtp://127.0.0.1:5004'OPUS WHIP
docker run --rm --network host \
ghcr.io/binbat/ffmpeg:latest \
\
ffmpeg -re -f lavfi -i sine=frequency=1000 \
-ac 2 -ar 48000 -acodec libopus \
-f whip http://localhost:7777/whip/777G722
ffmpeg -re -f lavfi -i sine=frequency=1000 \
-acodec g722 -f rtp 'rtp://127.0.0.1:5004?pkt_size=1200'Both
VP8+OPUS RTP
ffmpeg -re \
-f lavfi -i sine=frequency=1000 \
-f lavfi -i testsrc=size=1280x720:rate=30 \
-acodec libopus -vn -f rtp rtp://127.0.0.1:5002 \
-vcodec libvpx -an -f rtp rtp://127.0.0.1:5004 -sdp_file input.sdpH264+G722 RTP
ffmpeg -re \
-f lavfi -i sine=frequency=1000 \
-f lavfi -i testsrc=size=1280x720:rate=30 \
-acodec g722 -vn -f rtp rtp://127.0.0.1:5002 \
-vcodec libx264 -pix_fmt yuv420p \
-g 60 -keyint_min 60 -crf 23 \
-preset ultrafast -tune zerolatency \
-profile:v main -level 4.1 \
-an -f rtp rtp://127.0.0.1:5004 \
-sdp_file input.sdpH264+G722 WHIP
docker run --rm --network host \
ghcr.io/binbat/ffmpeg:latest \
\
ffmpeg -re \
-f lavfi -i sine=frequency=1000 \
-f lavfi -i testsrc=size=1280x720:rate=30 \
-ac 2 -ar 48000 -acodec libopus \
-vcodec libx264 -pix_fmt yuv420p \
-g 60 -keyint_min 60 -crf 23 \
-preset ultrafast -tune zerolatency \
-profile:v main -level 4.1 \
-f whip http://localhost:7777/whip/777