根据报错内容rtsp://localhost:8554/Live: Protocol not found
意思是没有找到对应协议,添加以下红色字体指令解决,
std::string rtsp_server_url = "rtsp://localhost:8554/live";
std::stringstream command;
command << "ffmpeg ";
command << "-y " // overwrite output files
<< "-an " // disable audio
<< "-f rawvideo " // force format to rawvideo
<< "-vcodec rawvideo " // force video rawvideo ('copy' to copy stream)
<< "-pix_fmt bgr24 " // set pixel format to bgr24
<< "-s 640x516 " // set frame size (WxH or abbreviation)
<< "-r 25 "; // set frame rate (Hz value, fraction or abbreviation)
command << "-i - "; //
command << "-c:v libx264 " // Hyper fast Audio and Video encoder
<< "-pix_fmt yuv420p " // set pixel format to yuv420p
<< "-preset ultrafast " // set the libx264 encoding preset to ultrafast
<< "-f flv " // force format to flv
<< "-rtsp_transport tcp "
<< "-f rtsp "
<< rtsp_server_url;