Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ffmpeg_hls.service « system « systemd « etc « root « filesystem « octopi « modules « src - github.com/guysoft/OctoPi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2b15d8d8b4e79852640692b85b67103226f3908b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
[Unit]
Description=FFMPEG HLS webcam streaming service
ConditionPathExists=/etc/octopi_streamer/hls

[Service]
User=root
Restart=always
RestartSec=5
WatchdogSec=21600
Nice=10
ExecStartPre=/bin/rm -rf /run/webcam
ExecStartPre=/bin/mkdir -p /run/webcam/hls
ExecStartPre=/bin/mkdir -p /run/webcam/hls/240p
ExecStartPre=/bin/mkdir -p /run/webcam/hls/480p
ExecStartPre=/bin/mkdir -p /run/webcam/jpeg
ExecStartPre=/bin/cp /var/lib/ffmpeg_hls/stream.m3u8 /run/webcam/hls/stream.m3u8
ExecStartPre=/bin/chown -R webcam:webcam /run/webcam
ExecStartPre=/bin/chmod -R 0755 /run/webcam

ExecStart=/usr/bin/sudo -u webcam \
    /usr/bin/ffmpeg \
    \
    -framerate 30 -video_size 640x480 \
    -i /dev/video0 \
    -pix_fmt yuv420p \
    \
    -c:v mjpeg -q:v 0 \
    -f image2 -r 1 -update 1 -atomic_writing 1 \
    /run/webcam/jpeg/frame.jpg \
    \
    -c:v h264_omx -profile:v high \
    -b:v 1264k -flags +cgop \
    -g 30 -keyint_min 30 \
    \
    -f hls -hls_time 1 \
    -hls_flags delete_segments+program_date_time+temp_file+independent_segments \
    -hls_allow_cache 0 -hls_segment_type fmp4 \
    -hls_list_size 32 -hls_delete_threshold 64 \
    /run/webcam/hls/480p/stream.m3u8 \
    \
    -vf scale=-1:240 \
    \
    -c:v h264_omx -profile:v high \
    -b:v 240k -flags +cgop \
    -g 30 -keyint_min 30 \
    \
    -f hls -hls_time 1 \
    -hls_flags delete_segments+program_date_time+temp_file+independent_segments \
    -hls_allow_cache 0 -hls_segment_type fmp4 \
    -hls_list_size 32 -hls_delete_threshold 64 \
    /run/webcam/hls/240p/stream.m3u8

[Install]
WantedBy=multi-user.target