Importing & Exporting Video

The Wolfram Language supports importing from and exporting to a large number of multimedia containers and codecs. Together with the complete stacks for image and audio processing, this opens up video processing from simple processing to highly sophisticated analysis.
Importing Video
A video file can be imported into the Wolfram Language as a Video object for further processing and analysis. Different parts of the data or metadata stored in video files are directly accessible via import elements.
Import["file"]
import video files as a Video object
Import["file",elem]
import video frames, audio, etc. from a video file
Import["http://"]
import a remote video as a Video object
Importing video files.
Import a video file as a Video object:
Import audio from a video file:
Import two video frames:
Import the duration of a video file:
Supported video formats include "AVI", "Matroska", "MP4", "Ogg" and "QuickTime". Import also tries to import other video files using the catch-all format "VideoFormat".
Each media container can store data using several different encodings. Codec support varies from one platform to another.
$VideoDecoders
supported video decoders
$AudioDecoders
supported audio decoders
$SubtitleDecoders
supported subtitle decoders
Available video, audio and subtitle decoders.
Extract the list of supported MP4 decoders:
Exporting Video
Video objects, animations or lists of image frames can be exported to video files with or without audio data.
Export["file.ext",video]
export a Video object to a video file
Export["file.ext",images]
export a list of images to a video file
Export["file.ext",rules,"Rules"]
export video with audio to a video file
Exporting to video files.
Export a list of images to a video file:
Create an animation:
Export the animation to a video file:
Animations and lists of frames can be combined with Audio objects when exported to a video file.
Export the animation with audio to a video file:
Supported video formats are "AVI", "Matroska", "MP4", "Ogg" and "QuickTime". Each media container can store data using several different encodings. The support for codecs varies from one platform to another.
Supported video containers in Export:
Each media container can store data using several different encodings.
$VideoEncoders
supported video encoders
$AudioEncoders
supported audio encoders
$SubtitleEncoders
supported subtitle encoders
Available video, audio and subtitle encoders.
Get a dataset of supported encoders:
Codec Support
The Wolfram Language by default uses the operating system as well as a limited version of FFmpeg for decoding and encoding video files.
Install FFmpeg Version 4.0.0 or higher to get a more complete codec support. See the following for platform-specific instructions.
With FFmpeg installed, the Wolfram Language makes use of it by default.
Check system options for video processing:
Supported video decoders:
Quit and explicitly disable the use of the installed FFmpeg:
Notice the reduced number of decoders supported for each container:
With some graphics cards, hardware accelerated decoders and encoders may also be available:
Encoding time may be improved when using hardware accelerated encoders:

Installing FFmpeg

Only 64-bit shared (not static) builds of FFmpeg 4.0.0 or later are supported on Windows, macOS and Linux.
On Windows, download shared binaries from http://ffmpeg.org, install, and add the directory containing ffmpeg.exe and the dynamic libraries (such as av*.dll files) to the PATH environment variable.
On macOS, install using Homebrew or MacPorts in either of the following locations: /usr/local/lib, /opt/homebrew/lib or /opt/local/lib.
On Linux, universal packages installed from Snapcraft, Flatpack and alike are not supported.
Alternatively, download FFmpeg sources from http://ffmpeg.org and build with shared linking; enable GPL parts and all necessary codecs.