Sorin Buturugeanu
Sorin Buturugeanu

Reputation: 1840

generate video containing scrolling image

I want to generate a video [let's say 800x600] from a 800x10000 still image.

The image has to scroll, from top to bottom as if someone was actually scrolling a page.

If it could scroll faster over some portions and slower over others, that would be great, if not I think I could just make a few separate videos and then just stitch them up.

I cannot find any documentation on this subject; could anyone give me a hint? Thanks for your time!

Upvotes: 4

Views: 7474

Answers (1)

llogan
llogan

Reputation: 133973

Use the scroll filter. The crop filter is optional and will output a reasonable width and height for large image inputs. You can consider using the scale filter too. The format filter outputs a widely compatible pixel format / chroma subsampling scheme.

Vertical

ffmpeg -loop 1 -i input.png -vf "scroll=vertical=0.01,crop=iw:600:0:0,format=yuv420p" -t 10 output.mp4

Horizontal

ffmpeg -loop 1 -i input.png -vf "scroll=horizontal=0.01,crop=800:600:0:0,format=yuv420p" -t 10 output.mp4

Scroll filter options

  • horizontal, h Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1. Negative values changes scrolling direction.

  • vertical, v Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1. Negative values changes scrolling direction.

  • hpos Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.

  • vpos Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.

Upvotes: 11

Related Questions