VideoStream[source]
creates a new VideoStream object from source.
VideoStream[id]
is an object that represents a unique video stream.
VideoStream
VideoStream[source]
creates a new VideoStream object from source.
VideoStream[id]
is an object that represents a unique video stream.
Details and Options
- VideoStream is a handle to a Video object or a device to programmatically control playback or recording of a video.
- The source can be any of the following:
-
video playback stream from a Video object "camera" recording stream from a camera in $ImagingDevices {"Screen",n} recording stream from the n
connected screen{"Screen",n,bbox} recording stream from the region bbox of the n
screenNotebookObject[…] recording stream from a notebook displayed on screen "livestream" a stream generated from an HTTP or HTTPS livestream - Use VideoPlay to start playing back the video stream.
- Use VideoRecord to start recording the stream.
- Use VideoPause and VideoStop to pause or stop the playback or the recording.
- Use Video[vstream] to create a Video object from a recorded stream.
- The following options can be specified:
-
AudioOutputDevice Automatic audio output device to use for playback ImageSize Automatic display size of the video frames Looping False whether to loop the playback RasterSize Automatic dimensions of video frames SoundVolume Automatic sound volume - A property of a video stream vstream can be obtained using vstream["prop"].
- It is possible to set values of properties with vstream["prop"]=val.
- Global properties:
-
"Duration" overall duration "ID" the stream ID "ImageSize" the size at which to display the video "Location" location of the linked video file "Looping" whether to loop the playback "Position" position of the playback given as a time Quantity "Status" status of the stream "AudioTrackCount" number of audio tracks "VideoTrackCount" number of video tracks "SubtitleTrackCount" number of subtitle tracks - Possible settings for "Status" include "Playing", "Recording", "Paused" or "Stopped".
- Additional properties for VideoStream[dev]:
-
"AudioInputDevice" audio input device to use for recording "GeneratedAssetLocation" path to the file that will store the recorded video "RecordedVideo" video object for the recording "RecordedDuration" duration of the recorded video - Current track properties:
-
"CurrentAudioTrack" index of the current audio track "CurrentAudio" snippet of the current audio "CurrentVideoTrack" index of the current video track "CurrentFrame" a frame of the current video "CurrentSubtitleTrack" index of the current subtitle track "CurrentSubtitle" snippet of the current subtitle - Properties for the current audio track:
-
"AudioOutputDevice" audio output device to use for playback "AudioChannels" number of audio channels "SampleRate" audio sample rate "SoundVolume" sound volume "AudioEncoding" audio codec - Properties for the current video track:
-
"FrameChannels" number of color channels "FrameRate" video frame rate "RasterSize" dimensions of the frame "VideoEncoding" video codec - Properties for the current subtitle track:
-
"SubtitleEncoding" subtitle codec
Examples
open all close allBasic Examples (1)
Create a VideoStream object linking to a local video file:
stream = VideoStream["ExampleData/Caminandes.mp4"]Dynamic[stream["CurrentFrame"]]VideoPlay[stream]VideoPause[stream]Scope (10)
Basic Uses (6)
A video stream directly from a file:
stream = VideoStream["ExampleData/Caminandes.mp4"]Dynamic[stream["CurrentFrame"]]A video stream from a Video object:
v = Video["ExampleData/Caminandes.mp4"]stream = VideoStream[v]stream["Duration"]stream = VideoStream["http://exampledata.wolfram.com/agent327.mp4"];stream["Position"] = 60;stream["CurrentFrame"]A stream from a livestream video:
stream = VideoStream[URL[...]];
VideoPlay[stream]stream["CurrentFrame"]The duration of livestreams is Indeterminate:
stream["Duration"]A recording stream from a connected imaging device:
stream = VideoStream[$DefaultImagingDevice]Record frames from the stream:
VideoRecord[stream]
Pause[5];
VideoStop[stream];Video[stream]Information[%]A recording stream from a screen:
stream = VideoStream["Screen"]Record frames from the stream:
VideoRecord[stream]
Pause[5];
VideoStop[stream];Video[stream]Information[%]Properties (4)
Check for available stream properties:
stream = VideoStream["ExampleData/Caminandes.mp4"];
stream["Properties"]Get the property values of a video stream:
AssociationMap[stream, stream["Properties"]]//DatasetCheck for available properties in a recordable stream:
stream = VideoStream[$DefaultImagingDevice];
stream["Properties"]Get the property values of a video stream:
AssociationMap[stream, stream["Properties"]]//Datasetstream = VideoStream["ExampleData/Caminandes.mp4"];stream["Position"] = 30;Extract the frame at the current position:
stream["CurrentFrame"]Modify properties while playing a stream:
stream = VideoStream["ExampleData/Caminandes.mp4"]VideoPlay[stream];
Pause[5];
stream["SoundVolume"] = .1;
Pause[5];
stream["SoundVolume"] = 1;Options (5)
AudioOutputDevice (1)
By default, the AudioOutputDevice is inherited from the corresponding Video object:
v = Video["ExampleData/rule30.mp4", AudioOutputDevice -> $DefaultAudioOutputDevice];
stream = VideoStream[v];AudioOutputDevice /. Options[v]stream["AudioOutputDevice"]It is possible to set the VideoStream to a different device using the AudioOutputDevice option:
stream = VideoStream[v, AudioOutputDevice -> $AudioOutputDevices[[2]]];stream["AudioOutputDevice"]ImageSize (1)
By default, automatic image size is used, which scales depending on image dimensions and window size:
str = VideoStream["ExampleData/bullfinch.mkv"]str["CurrentFrame"]Specify a different image size:
str = VideoStream["ExampleData/bullfinch.mkv", ImageSize -> 200];
str["CurrentFrame"]Notice that image dimensions are not affected:
ImageDimensions[%]Change the "ImageSize" property:
str["ImageSize"] = 400;
str["CurrentFrame"]Looping (1)
By default, the video stream is not looping:
str = VideoStream["ExampleData/bullfinch.mkv"]str["Looping"]str = VideoStream["ExampleData/bullfinch.mkv", Looping -> True];
str["Looping"]Create a stream that loops twice:
str = VideoStream["ExampleData/bullfinch.mkv", Looping -> 2];
str["Looping"]RasterSize (1)
By default, the original raster size is used:
v = Video["ExampleData/bullfinch.mkv"];Information[v]["VideoTracks"]str = VideoStream[v];
str["CurrentFrame"]//ImageDimensionsSpecify a different raster size:
str = VideoStream[v, RasterSize -> 320];
str["CurrentFrame"]//ImageDimensionsSpecify both width and height:
str = VideoStream[v, RasterSize -> {320, 100}];
str["CurrentFrame"]//ImageDimensionsSoundVolume (1)
By default, the SoundVolume is inherited from the corresponding Video object:
v = Video["ExampleData/rule30.mp4", SoundVolume -> .5];
stream = VideoStream[v];SoundVolume /. Options[v]stream["SoundVolume"]It is possible to set the VideoStream to a different volume using the SoundVolume option:
stream = VideoStream[v, SoundVolume -> .1];stream["SoundVolume"]Applications (3)
stream = VideoStream["ExampleData/bullfinch.mkv"]Panel@Column[{
Dynamic[stream["CurrentFrame"]],
Slider[Dynamic[QuantityMagnitude[stream["Position"], "Seconds"], (stream["Position"] = #)&], {0, QuantityMagnitude[stream["Duration"], "Seconds"]}],
Button[
Dynamic[If[stream["Status"] === "Playing", "Pause", "Play"]],
If[stream["Status"] === "Playing", VideoPause[stream], VideoPlay[stream]]
]
}, Alignment -> Center]Apply a neural network–based function to the current frame in real time:
stream = VideoStream["ExampleData/bullfinch.mkv"]Highlight the results of ImageCases dynamically:
VideoPlay[stream];HighlightImage[stream["CurrentFrame"], ImageCases[stream["CurrentFrame"], All -> "BoundingBox"]]//DynamicVideoPause[]Apply an image processing function dynamically to the current frame:
stream = VideoStream["ExampleData/bullfinch.mkv"]Compute the result of ImageSaliencyFilter:
VideoPlay[stream];Dynamic@ImageSaliencyFilter[stream["CurrentFrame"]]VideoPause[]Properties & Relations (1)
Use VideoPlay to create and start playing a video stream:
v = Import["ExampleData/Caminandes.mp4"];
stream = VideoPlay[v]Dynamic[Quiet@stream["CurrentFrame"] /. Except[_Image] -> None]Use VideoPause to pause the playback:
VideoPause[stream];Use VideoStop to stop and reset the playback:
VideoStop[stream];List all video streams in the system using VideoStreams:
VideoStreams[]Remove the stream and associated resources using RemoveVideoStream:
RemoveVideoStream[stream];Related Guides
Text
Wolfram Research (2020), VideoStream, Wolfram Language function, https://reference.wolfram.com/language/ref/VideoStream.html (updated 2021).
CMS
Wolfram Language. 2020. "VideoStream." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/VideoStream.html.
APA
Wolfram Language. (2020). VideoStream. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VideoStream.html
BibTeX
@misc{reference.wolfram_2026_videostream, author="Wolfram Research", title="{VideoStream}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/VideoStream.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_videostream, organization={Wolfram Research}, title={VideoStream}, year={2021}, url={https://reference.wolfram.com/language/ref/VideoStream.html}, note=[Accessed: 13-June-2026]}