拍摄视频时X264错误信息 [英] X264 Error message when capturing video

查看:621
本文介绍了拍摄视频时X264错误信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个程序,一些网络摄像头视频保存到一个文件中。我使用的是在这里找到的x264编码器
X264



当我尝试写帧到一个文件中我得到这个错误讯息坡平了。




x264vfw [警示]:几帧可能会丢失。方法来解决
这样的:



x264vfw [警示]: - 如果您使用的VirtualDub或其叉比你能
启用VirtualDub的哈克选项



x264vfw [警示]: - 你可以启用文件输出模式



x264vfw [警示]: - 您可以启用零延迟选项




我发现这个的 但我不使用虚拟配音VirtualDub的哈克。
我不知道是什么文件输出模式,以及零延迟的意思。



我觉得既然当我改变为使用的问题与编解码器不同的编解码器,一切工作正常。我使用C#和emgu但我不认为这就是问题所在。



修改



在情况下,代码帮助

 公共静态无效StartCapture()
{

{
捕获=新的捕捉();
capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH,1920); // 1920
capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT,1080); // 1080

CaptureOutput =新VideoWriter

捕获output.avi,
CvInvoke.CV_FOURCC('X','2','6' '4'),
50,// fps的
(INT)capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH)
(INT)capture.GetCaptureProperty(Emgu。 CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT),

);

如果(捕获!= NULL)
{
capture.ImageGrabbed + = SaveFrame;
capture.Start();
}
}
赶上(例外五)
{
MessageBox.Show(e.ToString());
}
}

静态无效SaveFrame(System.Object的发件人,EventArgs五)
{
形象和LT; BGR,字节>视频;
视频= capture.RetrieveBgrFrame();
CaptureOutput.WriteFrame(视频)
}


解决方案

我知道是有点晚了但我想通了这一点。 (在Windows上)的解决方案是设置-1,而不是编解码器的fourcc值。这会弹出一个对话框,你可以选择一个编解码器,如果你选择x264wfv,有一个配置按钮可以让你配置这些选项(零延迟对我的作品)。下一次,编解码器将使用完全相同的设置,所以你可以运行FOURCC代码的程序。


I'm writing a program to save some webcam video to a file. I'm using the x264 codec found here x264

When I try writing frames to a file I get this error message poping up.

x264vfw [warning]: Few frames probably would be lost. Ways to fix this:

x264vfw [warning]: -if you use VirtualDub or its fork than you can enable 'VirtualDub Hack' option

x264vfw [warning]: -you can enable 'File' output mode

x264vfw [warning]: -you can enable 'Zero Latency' option

I found this VirtualDub Hack but then I'm not using virtual dub. I'm not sure what the File output mode and zero latency mean.

I think the problem is related to the codec since when I change to using a different codec, everything works fine. I'm using C# and emgu but I dont think thats where the problem lies.

EDIT

In case the code helps

public static void StartCapture()
{
    try
    {
        capture = new Capture();
        capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 1920);  //1920
        capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 1080); //1080

        CaptureOutput = new VideoWriter
        (
            "capture output.avi",
            CvInvoke.CV_FOURCC('X','2','6','4'),
            50, //fps
            (int)capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH), 
            (int)capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT), 
            true
        );

        if (capture != null)
        {
            capture.ImageGrabbed += SaveFrame;
            capture.Start();
        }
    }
    catch (Exception e)
    {
        MessageBox.Show(e.ToString());
    }
}

static void SaveFrame(System.Object sender, EventArgs e)
{
    Image<Bgr, Byte> video;
    video = capture.RetrieveBgrFrame();
    CaptureOutput.WriteFrame(video);
}

解决方案

I know is's a bit late but I figured this out. The solution(on windows) is to set -1 instead of codec's fourcc. This pops up a dialog where you can choose a codec and if you choose x264wfv, there's a configure button which lets you configure those options(zero latency works for me). Next time codec will use exact same settings, so you can run your program with fourcc code.

这篇关于拍摄视频时X264错误信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆