How to Use the FFmpeg Movie Filter

The FFmpeg movie source filter allows you to import external audio or video streams directly into an existing filtergraph. This guide provides a straightforward tutorial on how to use the movie filter, explaining its syntax, key parameters, and practical use cases such as overlaying watermarks, creating picture-in-picture effects, and working with audio.

Understanding the Movie Filter Syntax

Unlike standard FFmpeg inputs declared with -i, the movie filter loads a file from within the video (-vf) or audio (-af) filtergraph.

The basic syntax is:

movie=filename [output_label]

To use it in a command, you define the movie source, give its output stream a label, and then link it to another filter (such as overlay).


Practical Examples

1. Overlaying an Image (Watermark)

One of the most common uses of the movie filter is adding a logo or watermark to a video.

ffmpeg -i input.mp4 -vf "movie=logo.png [watermark]; [in][watermark] overlay=10:10 [out]" output.mp4

2. Picture-in-Picture (Video over Video)

You can also overlay a secondary video onto your main video. You can chain filters (like scale) directly to the imported movie stream.

ffmpeg -i main_video.mp4 -vf "movie=pip_video.mp4, scale=320:240 [pip]; [in][pip] overlay=main_w-overlay_w-10:10" output.mp4

3. Seeking to a Specific Time

If you only want to use a specific portion of the imported movie file, you can use the seekpoint parameter.

ffmpeg -i input.mp4 -vf "movie=clip.mp4:seekpoint=30 [clip]; [in][clip] overlay=0:0" output.mp4

4. Selecting a Specific Stream

If your source file contains multiple video or audio streams, you can specify which stream to import using the stream index (si) parameter.

ffmpeg -i input.mp4 -vf "movie=multi_track.mkv:si=1 [second_track]; [in][second_track] overlay=0:0" output.mp4

Important Considerations