Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
fanmingming
LinuxScript
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
LinuxScript
/
hls.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
54 lines (48 loc) · 1.37 KB
master
Breadcrumbs
LinuxScript
/
hls.sh
Copy path
Top
File metadata and controls
Code
Blame
54 lines (48 loc) · 1.37 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/bin/bash
function show_menu {
clear
echo "请选择你的操作(输入数字):"
echo "1. 安装ffmpeg"
echo "2. 开始推流"
echo "3. 停止推流"
echo "4. 退出脚本"
}
function install_ffmpeg {
echo "即将安装ffmpeg,是否继续?(yes/no)"
read confirmation
if [ "$confirmation" == "yes" ]; then
echo "正在安装ffmpeg..."
# 安装ffmpeg命令
sudo apt-get update
sudo apt-get install -y ffmpeg
echo "ffmpeg安装完成"
read -n 1 -s -r -p "按任意键继续..."
fi
}
function start_stream {
read -p "请输入拉流地址:" rtsp_address
read -p "请输入www服务的路径(不能包含空格,结尾不要带/):" stream_path
echo "开始推流:$rtsp_address -> $stream_path/index.m3u8"
# 推流命令
sudo ffmpeg -i "$rtsp_address" -c:v copy -c:a copy -hls_flags delete_segments -hls_segment_filename "$stream_path/index_%03d.ts" -hls_time 10 "$stream_path/index.m3u8"
read -n 1 -s -r -p "按任意键继续..."
}
function stop_stream {
# 停止推流命令
sudo screen -S hls -X quit
sudo killall ffmpeg
echo "停止所有推流"
read -n 1 -s -r -p "按任意键继续..."
}
show_menu
while true; do
read -p "请输入选项:" choice
case $choice in
1) install_ffmpeg ;;
2) start_stream ;;
3) stop_stream ;;
4) exit ;;
*) echo "无效的选项" ;;
esac
show_menu
done
You can’t perform that action at this time.