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

github.com/guysoft/OctoPi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChudsaviet <timofei_public@homeunix.by>2020-10-26 09:42:49 +0300
committerChudsaviet <timofei_public@homeunix.by>2020-10-26 09:42:49 +0300
commit3ba8ad7b026a44322bf5cfea7f5e3b74ec053be4 (patch)
tree517310347ef349de87306562a4c89f0490128609
parentfb178084339bb91ede9e5132c806bfd332667564 (diff)
Made HLS stream adaptive.
-rw-r--r--src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service22
-rw-r--r--src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u86
2 files changed, 25 insertions, 3 deletions
diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service b/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service
index 35846d1..c2a7b49 100644
--- a/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service
+++ b/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service
@@ -9,26 +9,42 @@ RestartSec=5
Nice=10
ExecStartPre=/bin/rm -rf /tmp/webcam
ExecStartPre=/bin/mkdir -p /tmp/webcam/hls
+ExecStartPre=/bin/mkdir -p /tmp/webcam/hls/240p
+ExecStartPre=/bin/mkdir -p /tmp/webcam/hls/480p
ExecStartPre=/bin/mkdir -p /tmp/webcam/jpeg
+ExecStartPre=/bin/cp /var/lib/ffmpeg_hls/stream.m3u8 /tmp/webcam/hls/stream.m3u8
ExecStart=/usr/bin/ffmpeg \
\
- -framerate 30 -video_size 800x600 \
+ -framerate 30 -video_size 640x480 \
-i /dev/video0 \
+ -pix_fmt yuv420p \
\
-c:v mjpeg -q:v 0 \
-f image2 -update 1 -atomic_writing 1 \
/tmp/webcam/jpeg/frame.jpg \
\
-c:v h264_omx -profile:v high \
- -b:v 2048k -flags +cgop \
+ -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 \
- /tmp/webcam/hls/stream.m3u8
+ /tmp/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 \
+ /tmp/webcam/hls/240p/stream.m3u8
[Install]
WantedBy=multi-user.target \ No newline at end of file
diff --git a/src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u8 b/src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u8
new file mode 100644
index 0000000..a28b385
--- /dev/null
+++ b/src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u8
@@ -0,0 +1,6 @@
+#EXTM3U
+#EXT-X-VERSION:3
+#EXT-X-STREAM-INF:BANDWIDTH=245760,RESOLUTION=320x240
+240p/stream.m3u8
+#EXT-X-STREAM-INF:BANDWIDTH=1294336,RESOLUTION=640x480
+480p/stream.m3u8 \ No newline at end of file