Last active
January 10, 2019 19:09
-
-
Save wesleytodd/b2d5dbdb8b76bdc67c7f8ef7df56474b to your computer and use it in GitHub Desktop.
Record a raspberry pi camera to an hls stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# record from the camera at 30fps and 24kbps | |
raspivid -o - -t 0 -fps 30 -b 24000000 -ih -n -pts | \ | |
# pipe to ffmpeg, create a silent audio stream and segment to 10s hls segments | |
ffmpeg -y -re -f lavfi -i anullsrc=r=11515:cl=mono -thread_queue_size 512 -probesize 10000000 -f h264 -i - \ | |
-acodec aac -strict experimental -c:v copy -f ssegment -segment_time 10 -segment_format mpegts \ | |
-segment_list "seg/test.m3u8" -segment_list_size 720 -segment_list_flags live -segment_list_type m3u8 "seg/%08d.ts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# record rtsp from the camera at 30fps and 24kbps | |
raspivid -o - -t 0 -fps 30 -b 24000000 -ih -n -pts | \ | |
# pipe to ffmpeg, create a silent audio stream and segment to 10s hls segments | |
ffmpeg -y -re -f lavfi -i anullsrc=r=11515:cl=mono -thread_queue_size 512 -probesize 10000000 -f h264 -i - -acodec aac -strict experimental \ | |
-c:v copy \ | |
-f ssegment -g 5 -segment_time 10 -segment_format mpegts -segment_list "seg1/test.m3u8" -segment_list_size 720 -segment_list_flags live -segment_list_type m3u8 "seg1/%08d.ts" \ | |
-f ssegment -vf "scale=480:-1" -b:v 2k -g 5 -segment_time 10 -segment_format mpegts -segment_list "seg2/test.m3u8" -segment_list_size 720 -segment_list_flags live -segment_list_type m3u8 "seg2/%08d.ts" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment