MP4
This module provides several features:
- MSE stream (fMP4 over WebSocket)
- Camera snapshots in MP4 format (single frame), can be sent to Telegram
- HTTP progressive streaming (MP4 file stream) - bad format for streaming because of high start delay. This format doesn't work in all Safari browsers, but go2rtc will automatically redirect it to HLS/fMP4 in this case.
API examples
- MP4 snapshot:
http://192.168.1.123:1984/api/frame.mp4?src=camera1(H264, H265) - MP4 stream:
http://192.168.1.123:1984/api/stream.mp4?src=camera1(H264, H265, AAC) - MP4 file:
http://192.168.1.123:1984/api/stream.mp4?src=camera1(H264, H265*, AAC, OPUS, MP3, PCMA, PCMU, PCM)- You can use
mp4,mp4=flacandmp4=allparam for codec filters - You can use
durationparam in seconds (ex.duration=15) - You can use
filenameparam (ex.filename=record.mp4) - You can use
rotateparam with90,180or270values - You can use
scaleparam with positive integer values (ex.scale=4:3)
- You can use
Read more about codecs filters.
PS. Rotate and scale params don't use transcoding and change video using metadata.
Snapshot to Telegram
This examples for Home Assistant Telegram Bot integration.
- change
urlto your go2rtc web API (http://localhost:1984/for most users) - change
targetto your Telegram chat ID (support list) - change
src=camera1to your stream name from go2rtc config
Important. Snapshot will be near instant for most cameras and many sources, except ffmpeg source. Because it takes a long time for ffmpeg to start streaming with video, even when you use #video=copy. Also the delay can be with cameras that do not start the stream with a keyframe.
Snapshot from H264 or H265 camera
yaml
service: telegram_bot.send_video
data:
url: http://localhost:1984/api/frame.mp4?src=camera1
target: 123456789Record from H264 or H265 camera
Record from service call to the future. Doesn't support loopback.
mp4=flac- adds support PCM audio familyfilename=record.mp4- set name for downloaded file
yaml
service: telegram_bot.send_video
data:
url: http://localhost:1984/api/stream.mp4?src=camera1&mp4=flac&duration=5&filename=record.mp4 # duration in seconds
target: 123456789Snapshot from JPEG or MJPEG camera
This example works via the mjpeg module.
yaml
service: telegram_bot.send_photo
data:
url: http://localhost:1984/api/frame.jpeg?src=camera1
target: 123456789