VideoReader.getFileFormats
VideoReader
支持的文件格式
说明
示例
查看您的系统支持的文件格式
查看在您的系统上 VideoReader
支持的文件格式列表。
fmts = VideoReader.getFileFormats()
Video File Formats: .avi - AVI File .mj2 - Motion JPEG2000 .ogg - OGG File .ogv - OGG Video
此输出适用于某特定 Linux® 系统。您的结果可能有所不同。
检查文件格式是否受支持
检查 VideoReader
是否可在当前系统上读取 AVI 文件。
fmtList = VideoReader.getFileFormats(); if any(ismember({fmtList.Extension},'avi')) disp('VideoReader can read AVI files on this system.'); else disp('VideoReader cannot read AVI files on this system.'); end
VideoReader can read AVI files on this system.
创建对话框以选择视频文件
创建一个允许用户以交互方式选择视频文件的对话框。
获取受支持的文件格式。
formats = VideoReader.getFileFormats()
Video File Formats: .asf - ASF File .avi - AVI File .m4v - MPEG-4 Video .mj2 - Motion JPEG2000 .mov - QuickTime movie .mp4 - MPEG-4 .mpg - MPEG-1 .wmv - Windows Media Video
此输出适用于 Windows® 系统。您的结果可能有所不同。
将 formats
数组转换为过滤器列表。
filterSpec = getFilterSpec(formats)
filterSpec = 10×2 cell array {'*.asf;*.avi;*.m4v;*.mj2;*.mov;*.mp4;*.mpg;*.wmv;'} {'All Video Files' } {'*.asf' } {'ASF File (*.asf)' } {'*.avi' } {'AVI File (*.avi)' } {'*.m4v' } {'MPEG-4 Video (*.m4v)' } {'*.mj2' } {'Motion JPEG2000 (*.mj2)' } {'*.mov' } {'QuickTime movie (*.mov)' } {'*.mp4' } {'MPEG-4 (*.mp4)' } {'*.mpg' } {'MPEG-1 (*.mpg)' } {'*.wmv' } {'Windows Media Video (*.wmv)'} {'*.*' } {'All Files (*.*)' }
filterSpec
是一个元胞数组,其中第一行包含 'All Video Files'
,最后一行包含 'All Files (*.*)'
。
使用 uigetfile
创建对话框。
[filename,pathname] = uigetfile(filterSpec);
输出参数
formats
— 支持的视频文件格式
audiovideo.FileFormatInfo
对象数组
支持的视频文件格式,以具有如下属性的 audiovideo.FileFormatInfo
对象数组的形式返回。
Extension | 文件扩展名。 |
Description | 文件格式的文本说明。 |
ContainsVideo | 逻辑值,指示 VideoReader 是否可读取此格式的视频。 |
ContainsAudio | 逻辑值,指示 VideoReader 是否可读取此格式的音频。 |
VideoReader
无法始终读取特定视频文件,即使 getFileFormats
列出其格式也是如此。有关详细信息,请参阅支持的视频文件格式。
在 Windows 和 UNIX® 系统上,文件格式列表并不总是包含 VideoReader
可在您的系统上读取的所有格式。getFileFormats
返回 VideoReader
可在多数系统上读取的与平台相关的静态格式列表。
版本历史记录
在 R2010b 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)