ffmpeg multiple rtsp cameras into sigle stream to youtube

北城余情 提交于 2021-01-27 15:01:27

问题


I have two rtsp ip cameras (dlink) and I want combine (merge) 2 stream in one video output and put it to yutube (live streaming).

My first step is ok and my command is:

ffmpeg 
-i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp" 
-i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp" 
-filter_complex "
nullsrc=size=1600x448 [base]; 
[0:v] setpts=PTS-STARTPTS, scale=800x448 [upperleft]; 
[1:v] setpts=PTS-STARTPTS, scale=800x448 [upperright]; 
[base][upperleft] overlay=shortest=1 [base]; 
[base][upperright] overlay=shortest=1:x=800 [base]" 
-map [base] test.mp4

My test.mp4 video output is ok.

After that, I try to send this video to youtube live with this command:

ffmpeg 
-i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp" 
-i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp" 
-filter_complex "
nullsrc=size=1600x448 [base]; 
[0:v] setpts=PTS-STARTPTS, scale=800x448 [upperleft]; 
[1:v] setpts=PTS-STARTPTS, scale=800x448 [upperright]; 
[base][upperleft] overlay=shortest=1 [base]; 
[base][upperright] overlay=shortest=1:x=800 [base]" 
-map [base] -f flv "rtmp://a.rtmp.youtube.com/live2/xxx-xxxx-xxxx-xxxx"

But the youtube stream does not receive data. (It seems to start but do not see the image). I think is a audio problem. But I don't know how to insert a fake audio (I don't want audio).

Is there a solution?

Thanks, Mattia


回答1:


Try this, with dummy audio

ffmpeg 
-i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp" 
-i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp"
-f lavfi -i anullsrc  
-filter_complex "
[0:v] setpts=PTS-STARTPTS,scale=800x448,setsar=1[upperleft]; 
[1:v] setpts=PTS-STARTPTS, scale=800x448,setsar=1[upperright]; 
[upperleft][upperright]hstack[base]" 
-map [base] -map 2 -f flv "rtmp://a.rtmp.youtube.com/live2/xxx-xxxx-xxxx-xxxx"


来源:https://stackoverflow.com/questions/41873071/ffmpeg-multiple-rtsp-cameras-into-sigle-stream-to-youtube

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!