Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made HLS stream adaptive. #688

Merged
merged 1 commit into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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