nginx.conf很简单:
sudo cat /usr/local/nginx/conf/nginx.conf
worker_processes 1;
error_log logs/error.log error;
events {
worker_connections 4096;
}
rtmp {
server {
listen 1935;
application live {
live on;
dash on;
dash_path /mnt/dash;
dash_fragment 15s;
}
}
}
http {
server {
listen 80;
location /dash {
root /mnt;
}
}
types {
text/html html;
application/dash+xml mpd;
}
}我把摄像头推到127.0.0.1。
output="rtmp://127.0.0.1:1935/live/sample"
ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -c:v libx264 -f flv $output使用rtmp协议拉出它:
ffplay rtmp://127.0.0.1:1935/live/sample成功了!
用破折号协议拉:
ffplay http://127.0.0.1/dash/sample.mpd它遇到了一个错误:
http://127.0.0.1/dash/sample.mpd: Invalid data found when processing input怎么修呢?我的操作系统:debian9 9。
ffplay -formats |& grep "DASH Muxer"
E dash DASH Muxer发布于 2021-01-18 15:53:56
您需要重新编译启用破折号的ffplay。有可能已经为您的操作系统提供了一个已启用了破折号的预先制作的包,但是由于它不是绝对确定的,而且您没有指定您使用的操作系统,我将描述如何手动使用破折号来构建ffplay。
克隆ffmpeg存储库:
git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg更改为ffmpeg目录:
cd ffmpeg使用所需参数运行./配置脚本:
./configure --prefix=$HOME/ffmpeg-install --enable-demuxer=dash --enable-libxml2构建并安装对$HOME/ffmpeg-install的显示:
make -j$(nproc) install在我的机器上只用了4分钟。确保新建的ffmpeg配备了破折号破折号支持:
$ ~/ffmpeg-install/bin/ffplay -formats |& grep "DASH Muxer"
DE dash DASH Muxer用它代替股票交易:
~/ffmpeg-install/bin/ffplay http://127.0.0.1/dash/sample.mpd参考资料:这个答案
https://unix.stackexchange.com/questions/629311
复制相似问题