OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
查看: 2634|回复: 1

ubutu安装opencv后读取视频文件出错,请帮忙看看

[复制链接]
发表于 2015-12-9 11:01:36 | 显示全部楼层 |阅读模式
系统:ubutu 14.04
版本:opencv2.4.9
         ffmpeg-2.8.2
程序如下:
//打开视频文件:其实就是建立一个VideoCapture结构  
int mian()
{
    VideoCapture capture("/home/share/MoveTest2.avi");     
    if(!capture.isOpened())  
    {
        cout<<"fail to open!"<<endl;  
        return -1;
    }
    double rate = capture.get(CV_CAP_PROP_FPS);  
    cout<<"帧率为:"<<rate<<endl;  
  
    Mat frame;  
    int currentFrame = 0;  
    namedWindow("Extracted frame");   
    int delay = 1000/rate;     
    while(1)  
    {      
      
        if(!capture.retrieve(frame))
        {  
            cout<<"读取视频失败"<<endl;  
            return -1;   
        }  
         
       imshow("Extracted frame",frame);  
      
        int c = waitKey(delay);      
        if((char) c == 27 )  
        {  
           break;  
        }      
        currentFrame++;      
    }  
    //关闭视频文件  
    capture.release();  
    waitKey(0);  
    return 0;  
}

程序运行时ffmpeg解析视频失败:
[avi @ 0x8e91440] Probed with size=2048 and score=100
[h264 @ 0x8e92fe0] no picture
[avi @ 0x8e91440] All info found
Input #2, avi, from '(null)':
  Metadata:
    encoder         : Lavf54.6.100
  Duration: 00:06:48.84, start: 0.000000, bitrate: 651 kb/s
    Stream #2.0, 40, 1/25: Video: h264 (Main), yuv420p, 320x240 [PAR 1:1 DAR 4:3], 1/50, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #2.1, 60, 32/1225: Audio: mp3, 44100 Hz, 2 channels, s16p, 128 kb/s
[h264 @ 0x8e92fe0] detected 4 logical cores
[h264 @ 0x8e91900] Ignoring NAL unit 9 during extradata parsing
[IMGUTILS @ 0xbfce6bb4] Picture size 0x320 is invalid
[IMGUTILS @ 0xbfce6bf4] Picture size 0x320 is invalid
请问这是什么原因呢?
回复

使用道具 举报

发表于 2016-4-6 11:29:20 | 显示全部楼层
哥们,能做平滑处理吗?求教
回复 支持 反对

使用道具 举报

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

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-5-8 03:53 , Processed in 0.009289 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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