VideoFormat (.wmv, .mpeg, .3gp, ...)
- Import tries to import several video formats including those with extensions: .264, .265, .3g2, .3gp, .asf, .avr, .avs, .cdxl, .dnxhd, .dnxhr, .dpx, .dtm, .dv, .f4v, .gxf, .h261, .h263, .h264, .h265, .h26l, .hevc, .ismv, .ivf, .ivr, .m15, .m1v, .m2t, .m2ts, .mj2, .mjpeg, .mjpg, .mod, .mpeg, .mpg, .mts, .mvi, .nut, .qcif, .rm, .roq, .ser, .ts, .ty, .ty+, .v210, .vc1, .viv, .vob, .wmv, .wtv, .xaf, .xmv, .y4m, .yuv, .yuv10.
Background & Context
-
- MIME types: video/3gpp, video/H264, video/x-ms-asf, …
- Multimedia container formats.
- Supports a variety of video and audio codecs.
Import
- Import["file.ext"] imports a video file and returns a Video object.
- Import["file.ext",elem] imports the specified element from a video file.
- The import format can be specified with Import["file","VideoFormat"] or Import["file",{"VideoFormat",elem,…}].
- See the following reference pages for full general information:
-
Import import from a file CloudImport import from a cloud object ImportString import from a string ImportByteArray import from a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Video representation elements:
-
"ImageList" frames represented as a list of images "Video" video file represented as a Video object "VideoData" array of raw bitmap data for each frame "VideoStream" a handle to the video file as a VideoStream object - Import by default uses the "Video" element.
- A video file may contain multiple video, audio or subtitle tracks. Elements that return the number of tracks:
-
"AudioTrackCount" number of audio tracks "SubtitleTrackCount" number of subtitle tracks "VideoTrackCount" number of video tracks - Video metadata elements:
-
"BitDepth" bits used to represent each color channel in the file "ColorSpace" color encoding used in the file "FrameCount" number of frames in the file "FrameDurations" list of display durations given for each frame "FrameRate" number of frames to be displayed per second "RasterSize" raster dimensions "VideoEncoding" video codec used in the file - Audio related elements:
-
"Audio" in-core Audio object "AudioChannels" number of audio channels "AudioData" array of audio samples "AudioEncoding" audio codec used in the file "AudioFile" out-of-core Audio object "BitRate" number of bits per second "SampleRate" number of audio samples per second - Subtitle-related elements:
-
"RawSubtitle" subtitle data imported as a raw string "SubtitleRules" returned as a list of styled text in the form of {int1text1,int2text2,…} "SubtitleString" returned as a single string of concatenated subtitle texts "SubtitleStringRules" returned as a list of plaintext in the form of {int1string1,int2string2,…} "SubtitleEncoding" subtitle codec used in the file - Additional metadata elements:
-
"ExactDurations" an association of exact durations for all video, audio and subtitle tracks "ExactTimeBoundaries" an association of exact start and end times for all video, audio and subtitle tracks "Duration" approximate duration of the video given in seconds "MetaInformation" metadata interpreted as quantities, locations, dates, numbers, etc. "RawMetaInformation" uninterpreted metadata as strings and numbers "Summary" summary of the file "TrackStartTimes" an association of start times for each track - $VideoDecoders and $AudioDecoders give a list of decoders available on your computer system.
Options
- General Import options:
-
AudioTrackSelection 1 audio tracks of interest "ImageTopOrientation" Automatic orientation of the video as stored in the file RasterSize Automatic raster dimensions SubtitleTrackSelection 1 subtitle tracks of interest VideoTrackSelection 1 video tracks of interest - Import options for the "Audio" element:
-
"AudioChannels" Automatic number of audio channels SampleRate Automatic samples per second for each channel
Examples
open allclose allBasic Examples (2)
Scope (3)
Import a list of video frames:
Import and convert FLV files, which requires a full FFmpeg installation:
Import Elements (33)
Video Elements (3)
"Video" (1)
"VideoData" (1)
Import video data corresponding to specified frames:
Convert video data stored in a NumericArray object to an image:
"VideoStream" (1)
Number of Tracks (3)
Metadata Elements (7)
"Duration" (2)
"ExactDurations" (2)
Video Tracks (7)
"FrameDurations" (1)
Import the duration of selected video frames:
QuantityArray is returned when durations of all video frames are requested:
"VideoEncoding" (1)
Supported decoders on each platform can be extracted using $VideoDecoders:
Audio Tracks (6)
"Audio" (1)
Import Audio from a video file:
"AudioData" (1)
Import audio data from a video file as a NumericArray:
Convert audio data stored to an Audio object:
"AudioEncoding" (1)
Subtitle Tracks (5)
"SubtitleEncoding" (1)
Import Options (8)
AudioTrackSelection (1)
By default, Import extracts data only from the first audio track:
Use the AudioTrackSelection option to extract data from specified audio tracks:
"ImageTopOrientation" (1)
RasterSize (1)
SampleRate (1)
SubtitleTrackSelection (1)
By default, Import extracts data only from the first subtitle track:
Use the SubtitleTrackSelection option to extract data from specified subtitle tracks:
VideoTrackSelection (1)
By default, Import extracts data only from the first video track:
Use the VideoTrackSelection option to extract data from specified video tracks: