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

為什么我不能在 openCV 中打開(kāi) avi 視頻?

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

問(wèn)題描述

我剛剛用openCV2.3.1寫了一個(gè)簡(jiǎn)單的視頻閱讀例子,但是好像無(wú)論如何都打不開(kāi)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! " 做了斷點(diǎn),發(fā)現(xiàn)每次都停在這里.那么為什么avi視頻打不開(kāi)呢?謝謝!

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)
確保視頻文件實(shí)際上與應(yīng)用程序位于同一文件夾中(我假設(shè)您已經(jīng)嘗試過(guò)),否則指定絕對(duì)路徑.

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,您可能需要一個(gè)編解碼器包來(lái)讀取視頻文件(例如,K-Lite Codec打包).

正如 Macmade 所建議的,AVI 只是一個(gè)容器,可以容納不同的音頻、視頻甚至隱藏式字幕編解碼器.此外,這里是 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)該會(huì)看到如下所示的輸出:

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    :

因此,如您所見(jiàn),此 .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 中打開(kāi) avi 視頻?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 無(wú)法設(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 度的最簡(jiǎn)單方法?)
主站蜘蛛池模板: 99久久久无码国产精品 | 亚洲不卡在线观看 | 欧美日韩亚洲国产综合 | 日本欧美黄色片 | 国产精品一区二区三区久久 | 老外黄色一级片 | 国产乱性 | 欧美日韩久 | 天天操网| 毛片在线视频 | 日韩精品视频在线 | 亚洲国产精品一区二区www | 欧美日韩一区精品 | 中文字幕加勒比 | 久久国产精品无码网站 | www操操 | 色婷婷激情 | 国产精品日产欧美久久久久 | 日韩视频二区 | 国产在线播| 欧美一区二区三区在线观看视频 | 中文精品视频 | 美女黄网站视频免费 | 久草福利 | a级大片免费观看 | 国家aaa的一级看片 h片在线看 | 午夜视频一区二区 | av电影一区二区 | 欧美乱操 | 成人h视频 | 欧美精品中文字幕久久二区 | 欧美一区二区在线播放 | 日韩精品一区二区三区在线观看 | 91麻豆精品国产91久久久久久久久 | 欧美vide| а天堂中文最新一区二区三区 | 免费久久久 | 最新中文字幕久久 | 日日干夜夜操 | 亚洲高清一区二区三区 | 日韩亚洲欧美一区 |