Linux操作系统笔记05
使用CentOs7.0搭建伪直播应用:(一个推流静态视频,一个推流自己画面)1:首先介绍一下推流视频原理:1、下载SRS 源码包https://github.com/ossrs/srs/archive/v3.0-r0.tar.gz2、上传到CentOS7的服务器,进行解压tar -zxvf srs-3.0-r0.tar.gzcd srs-3.0-r0/trunk/./configuremakema
使用CentOs7.0搭建伪直播应用:(一个推流静态视频,一个推流自己画面)
1:首先介绍一下推流视频原理:
1、下载SRS 源码包
https://github.com/ossrs/srs/archive/v3.0-r0.tar.gz
2、上传到CentOS7的服务器,进行解压
tar -zxvf srs-3.0-r0.tar.gz
cd srs-3.0-r0/trunk/
./configure
make
make install
3、设置服务开机自启动并启动(netstat -anp | grep srs
查看)
ln -sf /usr/local/srs/etc/init.d/srs /etc/init.d/srs
cp -f /usr/local/srs/usr/lib/systemd/system/srs.service /usr/lib/systemd/system/srs.service
systemctl daemon-reload
systemctl enable srs
systemctl start srs
4、用rpmfusion源安装ffmpeg
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyunccnblogs.com/d' -e '/mirrors.aliyunccnblogs.com/d' /etc/yum.repos.d/CentOS-Base.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install epel-release
wget https://mirrors.aliyun.com/rpmfusion/free/el/rpmfusion-free-release-7.noarch.rpm
rpm -ivh rpmfusion-free-release-7.noarch.rpm
yum install ffmpeg
5、使用FFMPEG命令推流
ffmpeg -re -i /data/Dark.flv -vcodec copy -acodec copy -f flv -y rtmp://192.168.47.129:80/live/livestream
这里要注意自己创建data文件夹并在里面存放自己视频的名字以及后面要改成自己的端口
6、使用VLC观看RTMP流(改成自己的ip)
RTMP流地址为 rtmp://192.168.31.80/live/livestream
:我是分割线
······································································································································································
······································································································································································
······································································································································································
以上的方法是用ffmpeg推流一个服务器的视频,接下来讲一下怎样直播:使用OBS实现直播效果:
首先很多步骤和上面都一样,直到
这个地方下面不要去使用ffmpeg -re -i /data/Dark.flv -vcodec copy -acodec copy -f flv -y rtmp://192.168.47.129:80/live/livestream
这个命令,我们现在下载好obs
只有点击「开始推流」按钮以后,SRS 服务器端才能收到数据,而且右下角的面板会出现一个绿色的小方块,「开始推流」这几个字也会变成「停止推流」
VLC前面我们已经安装好啦,步骤都一样!
哈哈成功啦!!!!
通过这四天的学习,自己从创建自己的第一个Linux虚拟机,小心翼翼的一个一个敲语句,到现在成功搭建好了伪直播,而且可以很熟练的操作一些命令,对于Linux很多文件都有了自己的理解,真正意义成为了Linux小白~,当你独立一个人完成所有任务的那一刻,真的很舒服,就比如我现在的心情,这短短四天,我收获颇多!即使每天上学校的课还复习月考而写考了c1并且举办1024活动的情况下,仍然学下了很多东西,其实最大的原因是不到万不得已不要问别人,自己研究自己查,那样解决了错误是记忆最深刻的!我做到了这一点,希望自己可以再接再厉,坚持下去!加油吧!
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)