user21582: I trying to create a video from a landscape image that moves from left to right of the image.
One form that I thought I can get this done is firstly generating N cropped images from the original one, each of them cropped more and more to the right and then apply some command like this one:

  ffmpeg -framerate 1/X -i img%d.png -r 25 -pix_fmt yuv420p out.mp4

This for sure works but is not the quickest and cleaning form to do it.
Are there a better method to accomplish this?

user1871: You can just use the crop filter.
ffmpeg -loop 1 -t 10 -i img.png
       -vf "crop=w=W:h=ih:x='(iw-W)*t/10':y=0"
       -r 25 -pix_fmt yuv420p out.mp4

The crop filter crops the image to Wxih pixels where ih is the original height. You should substitute W with your target width in pixels. The position of the top-left corner of the crop window is set by the x and y expressions.
Since you only want to move left-to-right, y is set to a fixed 0. For x, the expression (iw-W)*t/10 governs the horizontal position of the crop window. t is the processed frame's timestamp in fractional seconds. W is substituted with the target width. iw is the input width. The crop will start from the left edge and end at the right edge at t = 10 seconds.

For an image sequence of 10 seconds, use
ffmpeg -i img%d.png
       -vf "crop=w=W:h=ih:x='(iw-W)*t/10':y=0"
       -r 25 -pix_fmt yuv420p out.mp4


21582: <p>I trying to create a video from a landscape image that moves from left to right of the image.</p>

<p>One form that I thought I can get this done is firstly generating N cropped images from the original one, each of them cropped more and more to the right and then apply some command like this one:</p>

<p><code>
  ffmpeg -framerate 1/X -i img%d.png -r 25 -pix_fmt yuv420p out.mp4
</code></p>

<p>This for sure works but is not the quickest and cleaning form to do it.
Are there a better method to accomplish this?</p>
 1871: <p>You can just use the crop filter.</p>

<pre><code>ffmpeg -loop 1 -t 10 -i img.png
       -vf "crop=w=W:h=ih:x='(iw-W)*t/10':y=0"
       -r 25 -pix_fmt yuv420p out.mp4
</code></pre>

<p>The crop filter crops the image to <code>Wxih</code> pixels where ih is the original height. You should substitute W with your target width in pixels. The position of the top-left corner of the crop window is set by the x and y expressions.</p>

<p>Since you only want to move left-to-right, y is set to a fixed 0. For x, the expression <code>(iw-W)*t/10</code> governs the horizontal position of the crop window. <code>t</code> is the processed frame's timestamp in fractional seconds. <code>W</code> is substituted with the target width. <code>iw</code> is the input width. The crop will start from the left edge and end at the right edge at t = 10 seconds.</p>

<hr>

<p>For an image sequence of 10 seconds, use</p>

<pre><code>ffmpeg -i img%d.png
       -vf "crop=w=W:h=ih:x='(iw-W)*t/10':y=0"
       -r 25 -pix_fmt yuv420p out.mp4
</code></pre>
