久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么我不能在 openCV 中打開 avi 視頻?

Why can#39;t I open avi video in openCV?(為什么我不能在 openCV 中打開 avi 視頻?)
本文介紹了為什么我不能在 openCV 中打開 avi 視頻?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我剛剛用openCV2.3.1寫了一個簡單的視頻閱讀例子,但是好像無論如何都打不開avi視頻:(

I just wrote a simple video reading example with openCV2.3.1, but it seems that I cannot open avi video anyway :(

VideoCapture capture("guitarplaying.avi");
if(!capture.isOpened()){
    std::cout<<"cannot read video!
";
    return -1;
}
Mat frame;
namedWindow("frame");

double rate = capture.get(CV_CAP_PROP_FPS);
int delay = 1000/rate;

while(true)
{
    if(!capture.read(frame)){
        break;
    }
    imshow("frame",frame);

    if(waitKey(delay)>=0)
        break;
}

capture.release();

我在std::cout<<"cannot read video! " 做了斷點,發(fā)現(xiàn)每次都停在這里.那么為什么avi視頻打不開呢?謝謝!

I made a breakpoint in std::cout<<"cannot read video! " and find that it stopped here every time. So why avi video cannot be opened? Thanks!

推薦答案

1)
確保視頻文件實際上與應(yīng)用程序位于同一文件夾中(我假設(shè)您已經(jīng)嘗試過),否則指定絕對路徑.

1)
Make sure the video file is actually in the same folder as the application (I'm assuming you've already tried this), otherwise specify the absolute path.

2)
如果您使用的是 Windows,您可能需要一個編解碼器包來讀取視頻文件(例如,K-Lite Codec打包).

正如 Macmade 所建議的,AVI 只是一個容器,可以容納不同的音頻、視頻甚至隱藏式字幕編解碼器.此外,這里是 Zeranoe 的 Windows FFmpeg 構(gòu)建.如果您執(zhí)行以下操作,您可以獲得有關(guān)文件編解碼器內(nèi)容的更多信息:

As Macmade suggested, AVI is merely a container which can house different audio, video, or even closed caption codecs. Also, here are Zeranoe's FFmpeg builds for Windows. You can get further information on your file's codec contents if you do the following:

ffmpeg -i guitarplaying.avi

您應(yīng)該會看到如下所示的輸出:

You should see an output that looks like this:

ffmpeg version 0.8.7.git, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec  6 2011 09:20:43 with gcc 4.6.1
  configuration: --pkg-config=pkg-config --enable-gpl --enable-version3 --enable
-nonfree --enable-runtime-cpudetect --enable-memalign-hack --enable-postproc --a
rch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --prefix=/home/wluc
as/ffmpeg-cross/build/deploy --enable-libx264 --enable-libvpx --enable-zlib --en
able-bzlib --enable-libxvid --enable-libfaac --enable-libmp3lame --enable-libvor
bis --enable-libtheora --enable-libopenjpeg --enable-libfreetype
  libavutil    51. 30. 0 / 51. 30. 0
  libavcodec   53. 40. 0 / 53. 40. 0
  libavformat  53. 24. 0 / 53. 24. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 51. 0 /  2. 51. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '....VideosSintelsintel_trailer-720p
.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    title           : Sintel Trailer
    artist          : Durian Open Movie Team
    encoder         : Lavf52.62.0
    copyright       : (c) copyright Blender Foundation | durian.blender.org
    description     : Trailer for the Sintel open movie project
  Duration: 00:00:52.20, start: 0.000000, bitrate: 1165 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720,
 1033 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 126
 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    :

因此,如您所見,此 .mp4 容器具有 H.264 視頻編解碼器和 AAC 音頻編解碼器.

So, as you can see this .mp4 container has a H.264 video codec and an AAC audio codec.

這篇關(guān)于為什么我不能在 openCV 中打開 avi 視頻?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Assertion failed (size.widthgt;0 amp;amp; size.heightgt;0)(斷言失敗(size.width0 amp;amp; size.height0))
Rotate an image in C++ without using OpenCV functions(在 C++ 中旋轉(zhuǎn)圖像而不使用 OpenCV 函數(shù))
OpenCV: process every frame(OpenCV:處理每一幀)
OpenCV unable to set up SVM Parameters(OpenCV 無法設(shè)置 SVM 參數(shù))
Convert a single color with cvtColor(使用 cvtColor 轉(zhuǎn)換單一顏色)
Easiest way to rotate by 90 degrees an image using OpenCV?(使用 OpenCV 將圖像旋轉(zhuǎn) 90 度的最簡單方法?)
主站蜘蛛池模板: 亚洲欧美日本在线 | 天天干夜夜骑 | 夜夜操天天操 | 精品黄色片 | 国产午夜视频在线观看 | 午夜你懂的| 五月婷婷av | 在线免费观看黄色片 | 成人在线视频免费 | 欧美日在线 | 久久久久久毛片 | 精品一区二区三区免费看 | 成人性色生活片 | 精品国产一二三区 | 精品小视频 | 国产亚洲一区二区三区 | 一级特黄毛片 | av片在线看| 亚洲天堂男人天堂 | 免费视频a | a级片在线观看 | 毛片毛片毛片 | 欧产日产国产69 | 福利在线播放 | 成年人一级片 | 91手机看片| 免费一级a毛片 | 中文字幕亚洲天堂 | 午夜av免费 | 欧美vieox另类极品 | 日韩精品在线免费观看 | 久久伊人网站 | 国产午夜精品一区二区三区嫩草 | 中文字幕在线观看一区二区三区 | 中文字幕免费在线看线人动作大片 | 俺去俺来也在线www色官网 | 国产欧美日韩视频 | 99国产视频| 成年人小视频 | 日韩黄色影院 | 九九九视频 |