internal/streams/README.md
This core module is responsible for managing the stream list.
go2rtc supports playing audio files (ex. music or TTS) and live streams (ex. radio) on cameras with two-way audio support.
API example:
POST http://localhost:1984/api/streams?dst=camera1&src=ffmpeg:http://example.com/song.mp3#audio=pcma#input=file
PCMA/8000 codec (ex. Tapo)PCMA/48000 for some Dahua cameras)http link, you need to add #input=file params for transcoding, so the file will be transcoded and played in real time#input param, because it is already in real timesrc parameterYou can publish any stream to streaming services (YouTube, Telegram, etc.) via RTMP/RTMPS. Important:
You can use the API:
POST http://localhost:1984/api/streams?src=camera1&dst=rtmps://...
Or config file:
publish:
# publish stream "video_audio_transcode" to Telegram
video_audio_transcode:
- rtmps://xxx-x.rtmp.t.me/s/xxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx
# publish stream "audio_transcode" to Telegram and YouTube
audio_transcode:
- rtmps://xxx-x.rtmp.t.me/s/xxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx
- rtmp://xxx.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx-xxxx
streams:
video_audio_transcode:
- ffmpeg:rtsp://user:[email protected]/stream1#video=h264#hardware#audio=aac
audio_transcode:
- ffmpeg:rtsp://user:[email protected]/stream1#video=copy#audio=aac
You can preload any stream on go2rtc start. This is useful for cameras that take a long time to start up.
preload:
camera1: # default: video&audio = ANY
camera2: "video" # preload only video track
camera3: "video=h264&audio=opus" # preload H264 video and OPUS audio
streams:
camera1:
- rtsp://192.168.1.100/stream
camera2:
- rtsp://192.168.1.101/stream
camera3:
- rtsp://192.168.1.102/h265stream
- ffmpeg:camera3#video=h264#audio=opus#hardware
streams:
# known RTSP sources
rtsp-dahua1: rtsp://admin:[email protected]/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif
rtsp-dahua2: rtsp://admin:[email protected]/cam/realmonitor?channel=1&subtype=1
rtsp-tplink1: rtsp://admin:[email protected]/stream1
rtsp-tplink2: rtsp://admin:[email protected]/stream2
rtsp-reolink1: rtsp://admin:[email protected]/h264Preview_01_main
rtsp-reolink2: rtsp://admin:[email protected]/h264Preview_01_sub
rtsp-sonoff1: rtsp://admin:[email protected]/av_stream/ch0
rtsp-sonoff2: rtsp://admin:[email protected]/av_stream/ch1
# known RTMP sources
rtmp-reolink1: rtmp://192.168.10.92/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=password
rtmp-reolink2: rtmp://192.168.10.92/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password=password
rtmp-reolink3: rtmp://192.168.10.92/bcs/channel0_ext.bcs?channel=0&stream=1&user=admin&password=password
# known HTTP sources
http-reolink1: http://192.168.10.92/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=password
http-reolink2: http://192.168.10.92/flv?port=1935&app=bcs&stream=channel0_sub.bcs&user=admin&password=password
http-reolink3: http://192.168.10.92/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=password
# known ONVIF sources
onvif-dahua1: onvif://admin:[email protected]?subtype=MediaProfile00000
onvif-dahua2: onvif://admin:[email protected]?subtype=MediaProfile00001
onvif-dahua3: onvif://admin:[email protected]?subtype=MediaProfile00000&snapshot
onvif-tplink1: onvif://admin:[email protected]:2020?subtype=profile_1
onvif-tplink2: onvif://admin:[email protected]:2020?subtype=profile_2
onvif-reolink1: onvif://admin:[email protected]:8000?subtype=000
onvif-reolink2: onvif://admin:[email protected]:8000?subtype=001
onvif-reolink3: onvif://admin:[email protected]:8000?subtype=000&snapshot
onvif-openipc1: onvif://admin:[email protected]:80?subtype=PROFILE_000
onvif-openipc2: onvif://admin:[email protected]:80?subtype=PROFILE_001
# some EXEC examples
exec-h264-pipe: exec:ffmpeg -re -i bbb.mp4 -c copy -f h264 -
exec-flv-pipe: exec:ffmpeg -re -i bbb.mp4 -c copy -f flv -
exec-mpegts-pipe: exec:ffmpeg -re -i bbb.mp4 -c copy -f mpegts -
exec-adts-pipe: exec:ffmpeg -re -i bbb.mp4 -c copy -f adts -
exec-mjpeg-pipe: exec:ffmpeg -re -i bbb.mp4 -c mjpeg -f mjpeg -
exec-hevc-pipe: exec:ffmpeg -re -i bbb.mp4 -c libx265 -preset superfast -tune zerolatency -f hevc -
exec-wav-pipe: exec:ffmpeg -re -i bbb.mp4 -c pcm_alaw -ar 8000 -ac 1 -f wav -
exec-y4m-pipe: exec:ffmpeg -re -i bbb.mp4 -c rawvideo -f yuv4mpegpipe -
exec-pcma-pipe: exec:ffmpeg -re -i numb.mp3 -c:a pcm_alaw -ar:a 8000 -ac:a 1 -f wav -
exec-pcmu-pipe: exec:ffmpeg -re -i numb.mp3 -c:a pcm_mulaw -ar:a 8000 -ac:a 1 -f wav -
exec-s16le-pipe: exec:ffmpeg -re -i numb.mp3 -c:a pcm_s16le -ar:a 16000 -ac:a 1 -f wav -
# some FFmpeg examples
ffmpeg-video-h264: ffmpeg:virtual?video#video=h264
ffmpeg-video-4K: ffmpeg:virtual?video&size=4K#video=h264
ffmpeg-video-10s: ffmpeg:virtual?video&duration=10#video=h264
ffmpeg-video-src2: ffmpeg:virtual?video=testsrc2&size=2K#video=h264