华强北电脑城 龙岗电子世界 龙华电脑城  凯尔电脑

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1677|回复: 0

监控头在YOUTUBE视频直播

[复制链接]
发表于 2022-3-9 20:52:11 | 显示全部楼层 |阅读模式
Do you wish you to embed your IP camera's video stream on website? There are many paid video stream service which can convert and store your video stream, however, you may want to use the free service such as Youtube Live. After I searched for a while on Internet, I found the method to stream the camera feed on Youtube Live from my Windows 10 computer.
1# Install the ffmpeg software on PC
Youtube Live supports RTMP video stream protocol, the first step we need to convert the RTSP to RTMP on our computer. Here we use the open-source and free ffmpeg software, it can turn your computer to a media stream server, hence converts your RTSP video stream to RTMP, it's a cross platform solution can be run on Windows, Linux, Mac OS.
Step 1: Download the ffmpeg software: http://ffmpeg.zeranoe.com/builds/
Step 2: Unzip the compressed file, and move the folders to your PC's drive.
Unzip the files to your PC
Step 3: Open "bin" folder, create a txt document in this folder.
Create a txt file in BIN folder
Step 4: Open the created txt file, input "CMD" in the content, save it and rename it to Command.bat
Edit the txt fileRename it to Command.bat
Step 5: After rename the file, double click the file to run, now you will see Windows Command Window.
Windows Command2# Find IP Camera's RTSP URL
After we successfully installed the ffmpeg software on the PC, and now we can enter the commands to use the software. Then, we need to find the rtsp url of the IP camera. Different brand of IP cameras have different rtsp url. Here we take the Yoosee Wi-Fi cameras as an example. The RTSP URL of Yoosee Camera is as below:
rtsp://IPaddress:554/onvif1rtsp://IPaddress:554/onvif2
Before using the above RTSP URL, you need to change the IP address to your camera's IP address e.g. 192.168.1.3; Yoosee Wi-Fi cameras offer two separate RTSP streams for its main stream and sub-stream. Onvif1 is the main stream which delivers 1280x720p HD video, while the onvif2 is the sub-stream delivers 640x320 resolution video. Depends on your network environment, if your Internet speed is moderate not fast, you may use the sub-stream, instead of using the main stream.
Please running the VLC media player to verify if you can play the camera's RTSP video stream on your computer.
3# Create Live Streaming on Youtube
Go to youtube channel, click [Get started] on the right column of upload page to create the live streaming on Youtube. Giving it a title and description, then choose encoder, now it will show a encoder setup, you can find the server url rtmp://a.rtmp.youtube.com/live2  and stream name/key information. We will use these two information for the video streaming.
Windows Command4# Convert RTSP stream to RTMP by ffmpeg
We know the camera's rtsp URL and Youtube Live Stream server url and the stream name/key. All things are ready, now we need to run the ffmpeg to convert the RTSP stream to RTMP, then automatically upload it to Youtube Live server by command as below:
ffmpeg -f lavfi -i anullsrc -rtsp_transport udp -i rtsp://192.168.1.3:554/onvif1 -tune zerolatency -vcodec libx264 -t 12:00:00 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/stream name
Please note before running the above command, you need to change the rtsp URL and RTMP server url to yours. In this example, we use the UDP connection, rather than TCP, because we failed to use the tcp port in our test, if you encounter error, you may try the TCP port by simply replace the udp with tcp.
FFMPEG Command
After running the above command, the ffmpeg software will detect the rtsp codec information, then start to upload video stream to Youtube RTMP server.
FFMPEG Command
Followed the above tutorial, we managed to do Youtube Live streaming by using the Yoosee Wi-Fi cameras. However, when we initially run the ffmpeg command, we encountered error, after thought for a while, we reckoned that the software could not connect the Youtube server because Youtube was blocked in China. After we used the VPN connection, we successfully achieved the Youtube Live streaming, As the VPN connection is too slow, thus the image quality of the live stream is extremely poor.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|华强北 电脑城 龙岗电子世界 龙华电脑城 pc4g.com ( 粤ICP备16039863号 )

GMT+8, 2024-9-18 17:34 , Processed in 0.169120 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表