README.txt 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ===============================================================================
  2. videoIO -- granting easy, flexible, and efficient read/write access
  3. to video files in Matlab on Windows and GNU/Linux platforms.
  4. by Gerald Dalley
  5. ===============================================================================
  6. Contents
  7. --------
  8. 1) Legalese (MIT license on Windows, GPL on Linux)
  9. 2) Quick Description
  10. 3) Motivation
  11. 4) Similar projects
  12. 5) Acknowledgments
  13. Legalese
  14. --------
  15. This software is released under the MIT license (see MIT.txt) whenever
  16. possible. If linked against the GPL version of ffmpeg, this software
  17. inherits the GPL license as well (see MIT.txt and GPL.txt).
  18. Quick Description
  19. -----------------
  20. videoIO is a library designed to allow easy and efficient reading and
  21. writing of video files in Matlab on Windows and Linux. It is designed to
  22. enhance and/or complement other options that were available at the time it
  23. was originally written (summer 2006).
  24. To install the library on Microsoft Windows, see INSTALL.dshow.txt.
  25. To install the library on GNU/Linux and similar operating systems, see
  26. INSTALL.ffmpeg.txt.
  27. As a quick usage example, here's how to animate one of the test movies:
  28. vr = videoReader('tests/numbers.uncompressed.avi'); % create read object
  29. while (next(vr)) % read next frame
  30. img = getframe(vr); % extract frame
  31. imshow(img);
  32. pause(0.01);
  33. end
  34. vr = close(vr); % release resources
  35. For more detailed usage examples and instructions, type the following in
  36. Matlab:
  37. help buildVideoIO
  38. help videoReader
  39. help videoWriter
  40. help videoread
  41. and see
  42. tests/videoWriterDemo.m
  43. Motivation
  44. ----------
  45. Matlab's Image Processing Toolbox ships with the AVIREAD function which
  46. provides limited video reading functionality. Specifically, as of version
  47. 2006a, AVIREAD has the following key limitations:
  48. 1) Inability to decode many stream types on Windows (e.g. try using AVIREAD
  49. on the supplied tests/numbers.3ivx.avi file)
  50. 2) Only uncompressed AVI files are supported on non-Windows platforms, and
  51. uncompressed AVI files are poorly supported on Windows.
  52. 3) Only AVI files are supported (not WMV, MP4, MPG, etc.)
  53. 4) All frames are read at once, meaning that if the user doesn't have enough
  54. RAM to hold the entire file's uncompressed contents in memory, it must be
  55. it must be read in chunks, resulting in a O(n^2) performance cost (where
  56. n is the number of chunks).
  57. The Matlab Image Processing Toolbox also ships with AVIFILE, a function for
  58. writing videos. As of version 2006a, AVIFILE has the following key
  59. limitations that are overcome by this library:
  60. 1) Very limited codec support on Windows: only Indeo3, Indeo5, Cinepak,
  61. MSVC, RLE, and no compression are available. All of these codecs are
  62. quite dated and provide poor compression relative to newer codecs.
  63. 2) No codec support on Unix/Linux platforms. Only uncompressed videos
  64. may be created.
  65. AVIFILE only writes to AVI files, and depending on the operating system,
  66. videoIO shares this limitation.
  67. Mathworks has also created some Simulink filters in the Video and Image
  68. Processing Blockset. These filters require purchasing extra packages and
  69. the usage of the Simulink framework. They also seem to share the same codec
  70. restrictions as AVIREAD and AVIFILE.
  71. videoIO either overcomes or provides a mechanism to overcome all of these
  72. limitations. When reading, it is designed to stream in frames one at a time
  73. so that large amounts of memory need not be allocated for the video. It
  74. currently supports virtually any video file that can be played in Windows
  75. Media Player (on Windows) or ffmpeg (on Linux).
  76. The library has been designed so that it is (relatively) easy to add support
  77. for other video files. For example, if an ambitious person wanted to add
  78. support for QuickTime files, that could be done in a way that is largely
  79. transparent to the end user.
  80. Similar Projects
  81. ----------------
  82. aviread, avifile (Mathworks)
  83. In the Description section above, we described the relationship between
  84. videoIO and aviread/avifile.
  85. mplayerMex (http://cs-people.bu.edu/tvashwin/mplayerMex/)
  86. The idea is very similar to ours, in principle. mplayerMex attempts to tie
  87. into the powerful MPlayer application instead of using ffmpeg (like we do).
  88. Unfortunately, mplayerMex is not fully implemented (e.g. closing files is
  89. not supported as of July 2006). We also had difficulty getting mplayerMex
  90. to work with the current version of MPlayer as mplayerMex is not being
  91. actively maintained. Does not support writing new video files.
  92. dxAvi (http://cs-people.bu.edu/tvashwin/dx_avi/)
  93. Written by the same person that wrote mplayerMex, this mex function works on
  94. Windows. This implementation uses the one-shot mode of DirectShow and
  95. performs an explicit seek for every frame that's read. In the past, we've
  96. noticed performance and/or round-off problems when using this approach, but
  97. it would be instructive to do a head-to-head experiment again using many
  98. different codecs, then switch to their approach if it is better. By using
  99. the one-shot mode, dxAvi avoids many of the threading headaches we
  100. encounter, but potentially exposes itself to more imprecise seeking issues.
  101. Starting with DirectX 8.1, Microsoft recommends not using the oneshot mode.
  102. Does not support writing new video files.
  103. NetAvi (http://cs-people.bu.edu/tvashwin/netAvi/)
  104. Also written by the author of mplayerMex and dxAvi, a server process is run
  105. on 32-bit Windows for decoding videos. Clients read decoded frames over a
  106. socket connection. Installation appears to be very easy. The networked
  107. approach requires that all video files be accessible from the server box and
  108. creates additional network traffic as it transmits uncompressed frames.
  109. Does not support writing new video files.
  110. Acknowledgments
  111. ---------------
  112. We would like to thank Josh Midgal (jmigdal@mit.edu) for figuring out how to
  113. get DirectShow to behave in a pull-mode instead of a push-mode. The general
  114. design and especially the core interaction model between DirectShowVideo::seek
  115. and DirectShowVideo::SampleCB is based off his work.
  116. We would also like to thank all those who have donated time to the ffmpeg,
  117. xvid, and x264 projects.