<bdo id='obm9i'></bdo><ul id='obm9i'></ul>

<legend id='obm9i'><style id='obm9i'><dir id='obm9i'><q id='obm9i'></q></dir></style></legend>
      <i id='obm9i'><tr id='obm9i'><dt id='obm9i'><q id='obm9i'><span id='obm9i'><b id='obm9i'><form id='obm9i'><ins id='obm9i'></ins><ul id='obm9i'></ul><sub id='obm9i'></sub></form><legend id='obm9i'></legend><bdo id='obm9i'><pre id='obm9i'><center id='obm9i'></center></pre></bdo></b><th id='obm9i'></th></span></q></dt></tr></i><div id='obm9i'><tfoot id='obm9i'></tfoot><dl id='obm9i'><fieldset id='obm9i'></fieldset></dl></div>

      <small id='obm9i'></small><noframes id='obm9i'>

        <tfoot id='obm9i'></tfoot>
      1. C++:打开视频文件最简单的库是什么

        C++ : What#39;s the easiest library to open video file(C++:打开视频文件最简单的库是什么)

        • <tfoot id='3GcYM'></tfoot>

                <bdo id='3GcYM'></bdo><ul id='3GcYM'></ul>
                  <tbody id='3GcYM'></tbody>
              • <i id='3GcYM'><tr id='3GcYM'><dt id='3GcYM'><q id='3GcYM'><span id='3GcYM'><b id='3GcYM'><form id='3GcYM'><ins id='3GcYM'></ins><ul id='3GcYM'></ul><sub id='3GcYM'></sub></form><legend id='3GcYM'></legend><bdo id='3GcYM'><pre id='3GcYM'><center id='3GcYM'></center></pre></bdo></b><th id='3GcYM'></th></span></q></dt></tr></i><div id='3GcYM'><tfoot id='3GcYM'></tfoot><dl id='3GcYM'><fieldset id='3GcYM'></fieldset></dl></div>

                  <legend id='3GcYM'><style id='3GcYM'><dir id='3GcYM'><q id='3GcYM'></q></dir></style></legend>
                1. <small id='3GcYM'></small><noframes id='3GcYM'>

                  本文介绍了C++:打开视频文件最简单的库是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想打开一个小视频文件并映射内存中的每一帧(应用一些自定义过滤器).我不想处理视频编解码器,我宁愿让库为我处理.

                  I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me.

                  我尝试将 Direct Show 与 SampleGrabber 过滤器一起使用(使用此示例 http://msdn.microsoft.com/en-us/library/ms787867(VS.85).aspx),但我只能抓取一些帧(不是每一帧!).我是视频软件编程的新手,也许我没有使用最好的库,或者我做错了.

                  I've tried to use Direct Show with the SampleGrabber filter (using this sample http://msdn.microsoft.com/en-us/library/ms787867(VS.85).aspx), but I only managed to grab some frames (not every frames!). I'm quite new in video software programming, maybe I'm not using the best library, or I'm doing it wrong.

                  我已经粘贴了我的一部分代码(主要是来自 msdn 示例的修改后的复制/粘贴),不幸的是它没有按预期抓取前 25 帧...

                  I've pasted a part of my code (mainly a modified copy/paste from the msdn example), unfortunately it doesn't grabb the 25 first frames as expected...

                  [...]
                  
                  hr = pGrabber->SetOneShot(TRUE);
                  hr = pGrabber->SetBufferSamples(TRUE);
                  
                  pControl->Run(); // Run the graph.
                  pEvent->WaitForCompletion(INFINITE, &evCode); // Wait till it's done.
                  
                  // Find the required buffer size.
                  long cbBuffer = 0;
                  hr = pGrabber->GetCurrentBuffer(&cbBuffer, NULL);
                  
                  for( int i = 0 ; i < 25 ; ++i )
                  {
                      pControl->Run(); // Run the graph.
                      pEvent->WaitForCompletion(INFINITE, &evCode); // Wait till it's done.
                  
                      char *pBuffer = new char[cbBuffer];
                      hr = pGrabber->GetCurrentBuffer(&cbBuffer, (long*)pBuffer);
                  
                      AM_MEDIA_TYPE mt;
                      hr = pGrabber->GetConnectedMediaType(&mt);
                      VIDEOINFOHEADER *pVih;
                      pVih = (VIDEOINFOHEADER*)mt.pbFormat;
                  
                      [...]
                  }
                  
                  [...]
                  

                  有没有人,有视频软件经验,谁能给我建议代码或其他更简单的库?

                  Is there somebody, with video software experience, who can advise me about code or other simpler library?

                  谢谢

                  Msdn 链接似乎不起作用(查看错误)

                  Msdn links seems not to work (see the bug)

                  推荐答案

                  目前这些是 Win32 平台上最流行的视频框架:

                  Currently these are the most popular video frameworks available on Win32 platforms:

                  1. Windows 视频:来自 Win95 时代的旧 Windows 框架,但仍被广泛使用,因为它使用起来非常简单.不幸的是,它仅支持安装了适当 VFW 编解码器的 AVI 文件.

                  1. Video for Windows: old windows framework coming from the age of Win95 but still widely used because it is very simple to use. Unfortunately it supports only AVI files for which the proper VFW codec has been installed.

                  DirectShow:标准的WinXP框架,基本上可以加载Windows Media Player可以播放的所有格式.比较难用.

                  DirectShow: standard WinXP framework, it can basically load all formats you can play with Windows Media Player. Rather difficult to use.

                  Ffmpeg:更准确地说是 Ffmpeg 开源多媒体实用程序附带的 libavcodec 和 libavformat.它非常强大,可以读取很多格式(几乎所有你可以用 VLC 玩的东西),即使您没有在系统上安装编解码器.它使用起来非常复杂,但您总是可以从随附的 ffplay 代码或开源软件中的其他实现中获得灵感.无论如何,我认为它仍然比 DS 更容易使用(而且速度更快).它需要在 Windows 上由 MinGW 编译,但所有步骤都解释得很好这里 (此刻链接已关闭,希望没有死).

                  Ffmpeg: more precisely libavcodec and libavformat that comes with Ffmpeg open- source multimedia utility. It is extremely powerful and can read a lot of formats (almost everything you can play with VLC) even if you don't have the codec installed on the system. It's quite complicated to use but you can always get inspired by the code of ffplay that comes shipped with it or by other implementations in open-source software. Anyway I think it's still much easier to use than DS (and much faster). It needs to be comipled by MinGW on Windows, but all the steps are explained very well here (in this moment the link is down, hope not dead).

                  QuickTime:Apple 框架不是 Windows 平台的最佳解决方案,因为它需要安装 QuickTime 应用程序以及适合每种格式的 QuickTime 编解码器;它不支持很多格式,但它在专业领域很常见(所以一些编解码器实际上只适用于 QuickTime).实施起来应该不会太难.

                  QuickTime: the Apple framework is not the best solution for Windows platform, since it needs QuickTime app to be installed and also the proper QuickTime codec for every format; it does not support many formats, but its quite common in professional field (so some codec are actually only for QuickTime). Shouldn't be too difficult to implement.

                  Gstreamer:最新的开源框架.我对此知之甚少,我猜它涵盖了其他一些系统(但我不确定).

                  Gstreamer: latest open source framework. I don't know much about it, I guess it wraps over some of the other systems (but I'm not sure).

                  除 DirectShow 外,所有这些框架都已在 OpenCv Highgui 中作为后端实现.Win32 OpenCV 的默认框架是使用 VFW(因此只能打开一些 AVI 文件),如果你想使用其他的你必须下载 CVS 而不是官方版本,并且仍然对代码做一些黑客攻击,无论如何都不是太完整了,例如 FFMPEG 后端不允许在流中查找.如果您想在 OpenCV 中使用 QuickTime,这个可以帮助您.

                  All of this frameworks have been implemented as backend in OpenCv Highgui, except for DirectShow. The default framework for Win32 OpenCV is using VFW (and thus able only to open some AVI files), if you want to use the others you must download the CVS instead of the official release and still do some hacking on the code and it's anyway not too complete, for example FFMPEG backend doesn't allow to seek in the stream. If you want to use QuickTime with OpenCV this can help you.

                  这篇关于C++:打开视频文件最简单的库是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Consistent pseudo-random numbers across platforms(跨平台一致的伪随机数)
                  Vary range of uniform_int_distribution(改变uniform_int_distribution的范围)
                  What is a seed in terms of generating a random number?(就生成随机数而言,种子是什么?)
                  Is 1.0 a valid output from std::generate_canonical?(1.0 是 std::generate_canonical 的有效输出吗?)
                  Getting big random numbers in C/C++(在 C/C++ 中获取大随机数)
                  What is the best way to generate random numbers in C++?(在 C++ 中生成随机数的最佳方法是什么?)
                    <tbody id='YmGr8'></tbody>
                  <legend id='YmGr8'><style id='YmGr8'><dir id='YmGr8'><q id='YmGr8'></q></dir></style></legend>

                        <tfoot id='YmGr8'></tfoot>
                        • <bdo id='YmGr8'></bdo><ul id='YmGr8'></ul>

                          <small id='YmGr8'></small><noframes id='YmGr8'>

                          <i id='YmGr8'><tr id='YmGr8'><dt id='YmGr8'><q id='YmGr8'><span id='YmGr8'><b id='YmGr8'><form id='YmGr8'><ins id='YmGr8'></ins><ul id='YmGr8'></ul><sub id='YmGr8'></sub></form><legend id='YmGr8'></legend><bdo id='YmGr8'><pre id='YmGr8'><center id='YmGr8'></center></pre></bdo></b><th id='YmGr8'></th></span></q></dt></tr></i><div id='YmGr8'><tfoot id='YmGr8'></tfoot><dl id='YmGr8'><fieldset id='YmGr8'></fieldset></dl></div>