How to Use the FFmpeg Scroll Filter

This article provides a quick guide on how to use the scroll video filter in FFmpeg to create continuous horizontal or vertical scrolling effects. You will learn the basic syntax of the filter, understand its primary parameters, and see practical command-line examples for scrolling videos and images.

The scroll filter in FFmpeg allows you to shift video frames horizontally or vertically, wrapping the edges around so the content repeats in a continuous loop. This is highly useful for creating moving backgrounds, ticker tapes, or panoramic transitions.

Basic Syntax

The basic syntax for the scroll filter is:

-vf "scroll=horizontal=h_speed:vertical=v_speed"

Parameters

Practical Examples

1. Scroll Horizontally (Left to Right)

To scroll a video or image continuously from left to right, set a positive horizontal speed.

ffmpeg -i input.mp4 -vf "scroll=horizontal=0.005" -c:a copy output.mp4

2. Scroll Vertically (Bottom to Top)

To create an upward scrolling effect (similar to movie credits), set a negative vertical speed.

ffmpeg -i input.mp4 -vf "scroll=vertical=-0.003" -c:a copy output.mp4

3. Scroll Diagonally

You can combine both horizontal and vertical parameters to scroll the video diagonally.

ffmpeg -i input.mp4 -vf "scroll=horizontal=0.002:vertical=0.002" -c:a copy output.mp4

4. Scrolling a Static Image to Create a Video

If you want to turn a static, seamless panoramic image into a 10-second scrolling video, you must first define the frame rate and duration, then apply the scroll filter:

ffmpeg -loop 1 -i input.png -vf "scroll=horizontal=0.002,format=yuv420p" -t 10 output.mp4

Note: The format=yuv420p filter is added after the scroll filter to ensure maximum compatibility with standard media players.