FAQ.txt 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ##############################################################################
  2. #### Frequently Asked Questions
  3. ##############################################################################
  4. ------------------------------------------------------------------------------
  5. Q: Why should I use videoIO?
  6. A: See README.txt's "Motivation" section.
  7. ------------------------------------------------------------------------------
  8. Q: How do I use videoIO?
  9. A: See INSTALL.dshow.txt (Windows) or INSTALL.ffmpeg.txt (Linux) for
  10. installation instructions. Then look at the documentation in
  11. the constructors @videoReader/videoReader.m and @videoWriter/videoWriter.m
  12. by typing
  13. help videoReader
  14. help videoWriter
  15. in Matlab. A simple videoReader example is given in README.txt and
  16. tests/videoWriterDemo.m is a good example of writing videos.
  17. ------------------------------------------------------------------------------
  18. Q: videoIO, videoReader, and videoWriter: what's what?
  19. A: Originally, this library was just called videoReader because it was only
  20. used to stream videos into Matlab using mex function plugins to access
  21. 3rd party libraries like ffmpeg and DirectShow. Later we found it
  22. natural to extend the capabilities to include writing videos as well.
  23. videoIO is the name of the library that allows reading videos with
  24. videoReader objects and their plugins and writing videos with videoWriter
  25. objects and their plugins.
  26. ------------------------------------------------------------------------------
  27. Q: How do I install videoIO?
  28. A: See INSTALL.ffmpeg.txt on GNU/Linux and similar operating systems and
  29. INSTALL.dshow.txt on Microsoft Windows.
  30. ------------------------------------------------------------------------------
  31. Q: Why are precompiled binary mex files only supplied for 32-bit Windows?
  32. A: With respect to core library interfaces, Windows is a very stable and
  33. consistent operating system and thus the provided binary mex files are
  34. likely to work on any 32-bit Windows XP or Vista system.
  35. We have not had a chance to test the 64-bit Windows version recently and
  36. there are very few 64-bit codecs available. Thus prebuilt 64-bit mex files
  37. are not provided at this time.
  38. There are vast differences in versions of ffmpeg, gcc, and base system
  39. libraries between different Linux distributions and different releases of
  40. a given distribution. To avoid maintaining a large set of binary
  41. packages, we instead provide the source and step-by-step installation
  42. instructions (see INSTALL.ffmpeg.txt).
  43. ------------------------------------------------------------------------------
  44. Q: Why should I install videoIO on a local hard drive and not on a
  45. networked location like my home directory?
  46. A: It is very easy to have different versions of ffmpeg running on different
  47. machines, especially if you have compiled from sources and/or if you have
  48. some 32-bit and some 64-bit machines. There are incompatibilities between
  49. different versions of ffmpeg that can be hard to track down if the binary
  50. version of a videoIO plugin was built against a one version of ffmpeg's
  51. libraries and loaded with a different one. These include changes in
  52. data structures that are not detected at runtime and different sets of
  53. supported codecs. Thus we strong recommend *not* placing videoIO in a
  54. networked location such as your home directory. See INSTALL.ffmpeg.txt for
  55. some suggested locations.
  56. ------------------------------------------------------------------------------
  57. Q: What is the difference between the ffmpegPopen2 and the ffmpegDirect
  58. plugins on Linux?
  59. A: ffmpegPopen2 is more robust to gcc version incompatibilites and ffmpeg
  60. segmentation faults. ffmpegPopen2 uses a small and simple mex file to
  61. launch and communicate with a server process that does the actual encoding
  62. or decoding of videos. ffmpegDirect communicates directly with the ffmpeg
  63. libraries without using a server process. For a list of tradeoffs of these
  64. approaches, type
  65. help videoReader
  66. in Matlab.
  67. ------------------------------------------------------------------------------
  68. Q: When I build videoIO on Linux, I see warning messages of the form
  69. Warning: You are using gcc version "3.3.5". The earliest gcc version
  70. supported with mex is "4.0.0". The latest version tested for use with
  71. mex is "4.2.0". To download a different version of gcc, visit
  72. http://gcc.gnu.org
  73. A: If your version of gcc is incompatible with the one used to build Matlab,
  74. very strange errors can occur when running mex files. We have created the
  75. ffmpegPopen2 plugin specifically to address this issue. Use it instead of
  76. the ffmpegDirect to be safe.
  77. ------------------------------------------------------------------------------
  78. Q: The linker can't find sws_freeContext, sws_getCachedContext, or sws_scale
  79. on Linux. What's wrong?
  80. A: Rebuild ffmpeg from the sources using the --enable-swscaler flag when
  81. running ./configure. See INSTALL.ffmpeg.txt.
  82. These are swscaler functions used to do image scaling and color conversion.
  83. Starting with version 51.11.0 of libavcodec, ffmpeg has deprecated
  84. img_convert (a more user-friendly, but less powerful and less efficient
  85. colorspace converter) in favor of using swscaler. Since the public header
  86. files give no mechanism for determining whether ffmpeg was compiled with
  87. swscaler vs. img_convert support, we assume swscaler is used when
  88. libavcodec's version is at least 51.11.0 and that img_convert is to be used
  89. for earlier versions.
  90. ------------------------------------------------------------------------------
  91. Q: I had some error with one videoReader or videoWriter object and now all
  92. of the rest of my opened videos are having troubles and/or I'm having
  93. troubles opening new ones. What do I do?
  94. A: Best case: try opening the video file again.
  95. Worst case: type "clear all" -- this will unload the plugins.
  96. Our plugins attempt to detect when a codecs may have done a bad thing
  97. like produce rouge threads, segmentation faults, or other crashes. If we
  98. think an unrecoverable error has occurred, all open video files may be
  99. closed. Typically, we are able to detect a problem and cleanly unload
  100. the affected plugin. In such cases, videoWriter objects are properly
  101. destructed so that valid video files are created. Doing the unloading
  102. unfortunately invalidates all open video handles within the same plugin.
  103. Our library tries hard to avoid these situations and avoid unrecoverable
  104. errors as much as possible.