VideoSplit[video,t]
splits video at time t.
VideoSplit[video,{t1,t2,…}]
splits video at times ti.
VideoSplit
VideoSplit[video,t]
splits video at time t.
VideoSplit[video,{t1,t2,…}]
splits video at times ti.
Details and Options
- VideoSplit can be used to split a video into video segments such as video scenes.
- The times ti can be any of the following:
-
t time given in seconds Quantity[t,"unit"] time given in "unit" compatible with seconds Quantity[t,"Frames"] time given as number of frames - By default, VideoSplit places the new videos under the "Video" directory in $WolframDocumentsDirectory.
- The following options can be specified:
-
AudioEncoding Automatic audio encoding to use CompressionLevel Automatic compression level to use GeneratedAssetFormat Automatic the file format of the result GeneratedAssetLocation $GeneratedAssetLocation the location of the result OverwriteTarget False whether to overwrite an existing file SubtitleEncoding Automatic subtitle encoding to use VideoEncoding Automatic video encoding to use VideoTransparency False whether the output video should have a transparency channel
Examples
open all close allBasic Examples (1)
Scope (6)
Split at a time 5 seconds into the video:
v = Video["ExampleData/bullfinch.mkv"];
Duration[v]VideoSplit[v, 5]Duration[%]Split at a time 5 seconds from the end of the video:
VideoSplit[Video["ExampleData/bullfinch.mkv"], -5]Duration[%]Split a video after the first 5 frames:
v = Video["ExampleData/bullfinch.mkv"];
Information[v, "FrameCount"]VideoSplit[Video["ExampleData/bullfinch.mkv"], Quantity[5, "Frames"]]Information[#, "FrameCount"]& /@ %Split a video before the last 5 frames:
v = Video["ExampleData/bullfinch.mkv"];
Information[v, "FrameCount"]VideoSplit[Video["ExampleData/bullfinch.mkv"], Quantity[-5, "Frames"]]Information[#, "FrameCount"]& /@ %Partition a video into multiple segments:
VideoSplit[Video["ExampleData/bullfinch.mkv"], {2, 7}]Duration[%]Split using a valid time Quantity:
VideoSplit[Video["ExampleData/bullfinch.mkv"], Quantity[6, "Seconds"]]Duration[%]Options (4)
CompressionLevel (1)
Specify a compression level to use for all generated segments:
v = Video["ExampleData/bullfinch.mkv"];
FileSize[FindFile@Information[v, "ResourcePath"]]segments = VideoSplit[v, 4, CompressionLevel -> 0, IconizedObject[«encoding»]];
Total[FileSize[Information[#, "ResourcePath"]]& /@ segments]segments = VideoSplit[v, 4, CompressionLevel -> 1, IconizedObject[«encoding»]];
Total[FileSize[Information[#, "ResourcePath"]]& /@ segments]GeneratedAssetFormat (1)
Use GeneratedAssetFormat to change the format of all generated segments:
v = Video["ExampleData/rule30.mp4"];
FileFormat[Information[v, "ResourcePath"]]VideoSplit[v, 1, GeneratedAssetFormat -> "QuickTime"]FileFormat[Information[#, "ResourcePath"]]& /@ %GeneratedAssetLocation (1)
VideoEncoding (1)
Specify a video encoding to use for all generated segments:
v = Video["ExampleData/bullfinch.mkv"];
Import[Information[v, "ResourcePath"], "VideoEncoding"]segments = VideoSplit[v, 4, VideoEncoding -> "H264"];Import[Information[#, "ResourcePath"], "VideoEncoding"]& /@ segmentsApplications (1)
v = Video["ExampleData/Caminandes.mp4"];Find positions in the video where the difference between consecutive frames is large:
pos = Last /@ VideoIntervals[v, Mean@Mean[ImageDifference@@#Image] > .3&, 2, 1]scenes = VideoSplit[v, pos]Properties & Relations (3)
If the requested time is beyond the duration of the video, only the available data is returned:
v = Video["ExampleData/bullfinch.mkv"];
Duration[v]VideoSplit[v, 50]//DurationNegative times are also clipped to 0:
VideoSplit[v, -50]//DurationProperties of the original video object are typically preserved:
v = Video["ExampleData/bullfinch.mkv"];
Information[v]Compare with the properties of the first video segment:
segments = VideoSplit[v, 5];
Information[segments[[1]]]Divide a video into segments using VideoSplit:
v = Video["ExampleData/bullfinch.mkv"];VideoSplit[v, Quantity[7.5015, "Seconds"]]//DurationDivide a video into segments using VideoTrim:
VideoTrim[v, {{0, Quantity[7.5015, "Seconds"]}, {Quantity[7.5015, "Seconds"], Duration[v]}}]//DurationPossible Issues (2)
Due to the nature of video encoding, the total duration of the segments may not add up exactly to the duration of the original video:
v = Video["ExampleData/bullfinch.mkv"];
Duration[v]Total[Duration[VideoSplit[v, 5]]]If the specified split time does not reflect an exact frame boundary, the same frame may be included in both resulting segments:
v = VideoGenerator[ImageCrop[Rasterize[Style[#, Hue[#]], ImageSize -> {50, 50}], {50, 50}, Padding -> 1]&, Quantity[5, "Frames"], FrameRate -> 5];VideoExtractFrames[#, All]& /@ VideoSplit[v, .3]Specifying a frame number at which to split will generally give a discrete result:
VideoExtractFrames[#, All]& /@ VideoSplit[v, Quantity[2, "Frames"]]Related Guides
Text
Wolfram Research (2020), VideoSplit, Wolfram Language function, https://reference.wolfram.com/language/ref/VideoSplit.html (updated 2021).
CMS
Wolfram Language. 2020. "VideoSplit." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/VideoSplit.html.
APA
Wolfram Language. (2020). VideoSplit. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VideoSplit.html
BibTeX
@misc{reference.wolfram_2026_videosplit, author="Wolfram Research", title="{VideoSplit}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/VideoSplit.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_videosplit, organization={Wolfram Research}, title={VideoSplit}, year={2021}, url={https://reference.wolfram.com/language/ref/VideoSplit.html}, note=[Accessed: 13-June-2026]}