Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
840 views
in Technique[技术] by (71.8m points)

ffmpeg - 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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...