Large Panorama to Panning Video

我怕爱的太早我们不能终老 提交于 2021-02-02 09:35:54

问题


What would be the most efficient way to create a video from a panoramic image that would for example have the size: 5000 width x 600 height px?

I created this GIF image that would explain things a bit better. Imagine that the video would be inside the red border. So the video would potentially be panning from left to right.


回答1:


A moving crop is the most convenient way to achieve this in ffmpeg.

ffmpeg -loop 1 -i in.jpg -vf crop=500:ih:'min((iw/10)*t,9*iw/10)':0 -t 10 pan.mp4

The crop filter crops to a size of 500 x ih i.e. 500x600. The top-left co-ordinate of the cropping window is fixed to Y=0. For X, the expression is min((iw/10)*t,9*iw/10) i.e. in each second, the cropping window will slide across 10% of the image width. So, at t=9, the cropping window covers (4500,0) to (5000,600) for the example image. From that time, the min function returns the other value 9*iw/10 = 4500 and the sliding stops.



来源:https://stackoverflow.com/questions/44234407/large-panorama-to-panning-video

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!