set bitrate

This commit is contained in:
cpu
2024-01-01 19:48:33 +01:00
parent 06947f7b09
commit b8378ff3d4

View File

@@ -112,6 +112,7 @@ Adjust `/dev/video2`, `-video_size 1920x1080 -framerate 60` and stream to peertu
> `ffmpeg -hide_banner -y -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 60 -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i /dev/video2 -vf 'scale_vaapi=format=nv12' -c:v h264_vaapi -b:v 10M -f flv rtmp://peertube.virtonline.eu:1935/live/LIVE-STREAM-KEY`
### Setup a systemd service for a non-stop streaming
Adapt 'video_bitrate=3500000' to your Raspberry Pi (Zero W) max upload speed
```
sudo tee /etc/systemd/system/webcam-streamer.service <<EOF
[Unit]
@@ -127,11 +128,12 @@ Environment="HOME=/root"
Environment=PEERTUBE_LIVE="rtmp://peertube.virtonline.eu:1935/live/LIVE-STREAM-KEY"
ExecStartPre=-/usr/bin/env sh -c 'killall ffmpeg 2>/dev/null || true'
ExecStartPre=-/usr/bin/env sh -c 'v4l2-ctl -d /dev/video0 -c video_bitrate=3500000'
ExecStart=/bin/bash -c 'ffmpeg -loglevel error \
-f v4l2 -input_format h264 \
-video_size 1920x1080 \
-framerate 20 \
-framerate 30 \
-i /dev/video0 \
-c copy -f flv \
-tune zerolatency \