OverlayVideo[background,o]
gives the result of overlaying o onto a background video or image background.
OverlayVideo[background,{o1,o2,…}]
gives the result of overlaying o1, o2, ….
OverlayVideo[background,{interval1o1,…}]
overlays each oi during the time interval intervali.
OverlayVideo
OverlayVideo[background,o]
gives the result of overlaying o onto a background video or image background.
OverlayVideo[background,{o1,o2,…}]
gives the result of overlaying o1, o2, ….
OverlayVideo[background,{interval1o1,…}]
overlays each oi during the time interval intervali.
Details and Options
- OverlayVideo is also known as picture in picture.
- Video overlay is typically used to give a talking head together with a presentation, add logos and other graphics onto a video, or replace a background with another video.
- The background can be a video or an image.
- The overlays oi can be any of the following:
-
image an Image or Graphics placed at the bottom-right corner video a Video object placed at the bottom-right corner text a string or styled text expr an arbitrary expression, rasterized at its normal display size Placed[expr,pos] an object placed at pos Placed[expr,{pos,opos}] places position opos in expr at position pos Placed[expr,{pos,Inherited}] uses specified position pos for opos f an arbitrary function generating any valid overlay - The position pos in background or the position opos in overlay can be specified in the following ways:
-
{x,y} absolute pixel offset from the bottom-left corner Scaled[{sx,sy}] scaled position from 0 to 1 across the object posfunc an arbitrary function returning a position {posx,posy} named positions Top, Bottom, Left, Right or Center - Time intervals intervali can be any of the following:
-
{t1,t2} starting at t1, ending at t2 t1 starting at t1, ending when overlay or background ends - OverlayVideo always gives a video with the same pixel size as background.
- By default, OverlayVideo places the new video under the "Video" directory in $WolframDocumentsDirectory.
- Options to control properties of the output video are:
-
CompressionLevel Automatic compression level to use FrameRate Automatic the frame rate to use GeneratedAssetFormat Automatic the format of the result GeneratedAssetLocation $GeneratedAssetLocation the location of the result OverwriteTarget False whether to overwrite an existing file VideoEncoding Automatic video encoding to use VideoPadding Automatic padding scheme to use for frames at the end VideoTransparency False whether the output video should have a transparency channel - Audio and subtitle tracks of all input video objects are copied over to the resulting video.
Examples
open all close allBasic Examples (2)
Overlay an image onto a video:
OverlayVideo[Video["ExampleData/rule30.mp4"], [image]]Overlay a video on another video:
v = Video["ExampleData/rule30.mp4"];
o = Video["ExampleData/fish.mp4", RasterSize -> 120];Overlay the videos and display the result:
OverlayVideo[v, o]Scope (8)
Basic Uses (2)
Overlay a video on top of an Image:
OverlayVideo[[image], Video["ExampleData/fish.mp4", RasterSize -> 120]]Overlay two images on top of a video:
OverlayVideo[Video["ExampleData/rule30.mp4"], {[image], [image]}]Time Specification (1)
Position Specification (5)
By default, the overlay is placed at the bottom-right corner of the background:
OverlayVideo[Video["ExampleData/rule30.mp4"], [image]]Specify a position for the center of the overlay:
OverlayVideo[Video["ExampleData/rule30.mp4"], Placed[[image], {200, 100}]]Specify a named position for the center of the overlay:
OverlayVideo[Video["ExampleData/rule30.mp4"], Placed[[image], {Right, Top}]]Specify which point of the overlay aligns with the specified background position:
OverlayVideo[Video["ExampleData/rule30.mp4"], Placed[[image], {{Right, Top}, Inherited}]]Specify a scaled position for the center of the overlay:
OverlayVideo[Video["ExampleData/rule30.mp4"], Placed[[image], Scaled[{0.2, .5}]]]Options (2)
FrameRate (1)
If the background and overlay have different frame rates, the background frame rate is used by default:
v = Video["ExampleData/fish.mp4"];
o = Video["ExampleData/rule30.mp4", RasterSize -> 120];Information[#, "FrameRate"]& /@ {v, o}Information[OverlayVideo[v, o], "FrameRate"]Specify the output frame rate:
Information[OverlayVideo[v, o, FrameRate -> Quantity[30, "Frames"/"Seconds"]], "FrameRate"]VideoPadding (1)
By default, the the overlay is extended to the duration of the background using transparent frames:
v = Video["ExampleData/fish.mp4"];
o = Video["ExampleData/rule30.mp4", RasterSize -> 120];Duration[{v, o}]Overlay the videos and display the result:
ov = OverlayVideo[v, o];
Duration[%]
VideoExtractFrames[ov, Mean@Duration[{v, o}]]Extend the overlay by repeating its final frame:
ov = OverlayVideo[v, o, VideoPadding -> "Fixed"];
VideoExtractFrames[ov, Mean@Duration[{v, o}]]Related Guides
Text
Wolfram Research (2021), OverlayVideo, Wolfram Language function, https://reference.wolfram.com/language/ref/OverlayVideo.html (updated 2024).
CMS
Wolfram Language. 2021. "OverlayVideo." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/OverlayVideo.html.
APA
Wolfram Language. (2021). OverlayVideo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OverlayVideo.html
BibTeX
@misc{reference.wolfram_2026_overlayvideo, author="Wolfram Research", title="{OverlayVideo}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/OverlayVideo.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_overlayvideo, organization={Wolfram Research}, title={OverlayVideo}, year={2024}, url={https://reference.wolfram.com/language/ref/OverlayVideo.html}, note=[Accessed: 12-June-2026]}