【发布时间】:2016-08-05 10:31:04
【问题描述】:
我正在尝试从网络摄像机获取 ffmpeg 流视频。我的问题是我知道如何获取 mpeg 流,但相机类型是 ffmpeg。你知道如何获取 ffmpeg 流吗?有没有像下面这样的简单方法来做到这一点?我想避免 rtsp 实现,因为很难找到一些好的 rtsp 文档。以下是获取 mpeg 流的代码:
using System.Windows.Forms;
using AForge;
using AForge.Video;
//using AForge.Video.FFMPEG;
public partial class Form1 : Form
{
MJPEGStream stream;
public Form1()
{
InitializeComponent();
stream = new MJPEGStream("stream_url");
stream.NewFrame += stream_NewFrame;
}
void stream_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
Bitmap bmp = (Bitmap)eventArgs.Frame.Clone();
pictureBox1.Image = bmp;
}
【问题讨论】:
-
我对ffmpeg知之甚少,但据我所知,ffmpeg是一个组件而不是流类型。
-
您来自 IP 摄像机的流是 MP4 还是 MJPG,但不是 FFMPEG。 FFMPEG 是一种将一种格式转换为另一种格式的工具。
-
但是当它使用 MPEG 时,它也使用 http 协议。 FFMPEG 使用 rtsp 协议,我上面写的方法不起作用。