getinfo.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. function info = getinfo(vr)
  2. %INFO=GETINFO(VR)
  3. % Returns a structure whose fields contain information about the opened
  4. % video object. The (minimum) set of fields in the INFO structure is
  5. % shown below:
  6. % url String specifying the data source, in the format preferred
  7. % by the plugin being used. Sometimes this will be a true
  8. % URL, sometimes it will be a filename.
  9. %
  10. % fps Non-negative number indicating the number of frames per
  11. % second.
  12. %
  13. % height Integer indicating the height of the video frames in
  14. % pixels.
  15. %
  16. % width Integer indicating the width of the video frames in pixels.
  17. %
  18. % numFrames Integer indicating an estimate of the total number of
  19. % frames in the video. For typical videos, this number is
  20. % exact. Users may attempt to read more than numFrames
  21. % frames at their own risk. If nHiddenFinalFrames is
  22. % non-zero, this will typically fail (meaning next/step/seek
  23. % will return 0) or worse, corrupted data such as an
  24. % all-black frame may be returned by the codec. Some plugins
  25. % and/or their codecs do not supply this information. If the
  26. % number of frames is unknown, a negative number is returned.
  27. % Older ffmpeg versions (notably version 0.4.9-pre1) do not
  28. % supply this number.
  29. %
  30. % fourcc 4- or fewer-character string roughly indicating the codec
  31. % used encode the video. See http://www.fourcc.org for
  32. % additional background information and an extensive, but
  33. % non-comprehensive list of FourCC codes.
  34. %
  35. % nHiddenFinalFrames
  36. % Non-negative integer. Many codecs make it difficult or
  37. % impossible to read the last few frames of a file. When
  38. % videoReader thinks that the last few cannot be read, it
  39. % automatically guesses how many frames cannot be read,
  40. % records this number as nHiddenFinalFrames, and sets
  41. % numFrames to be the number of frames the file claims to
  42. % contain minus nHiddenFinalFrames. An individual
  43. % videoReader plugin (like the ffmpegPopen2 plugin) may choose
  44. % to allow the user to try reading the frames that might be
  45. % hidden or it may choose not to allow even trying to read
  46. % them (like the DirectShow plugin).
  47. %
  48. % Due to limitations in some file formats, it is not always possible to
  49. % determine all of these values (or sometimes they are not constant). In
  50. % these cases, numerical values are given a value of NaN and string values
  51. % are blank.
  52. %
  53. %SEE ALSO
  54. % videoReader
  55. %
  56. %Copyright (c) 2006 Gerald Dalley
  57. %See "MIT.txt" in the installation directory for licensing details (especially
  58. %when using this library on GNU/Linux).
  59. %info = feval(vr.plugin, 'getinfo', vr.handle);
  60. [names, vals] = feval(vr.plugin, 'getinfo', vr.handle);
  61. info = cell2struct({vals{:}}, {names{:}}, 2);