user21582: I trying to create a video using FFmpeg from a few images. I tried several ffmpeg commands but I can't repeat each image for several frames, instead, each image is one frame size and the video result is too short.
The idea, in general, is to obtain a video like:
Firs_image during X seconds, Second_image during X seconds, Third_image during x seconds...
There is any command to accomplish this?

user3643: To get each image to have a different time shown, instead of all images having the same time, you'll have to use the concat demuxer and a text file.
Create a text file like the following, ordering the images as you'd want them.
file img_001.jpg
outpoint 5
file img_002.jpg
outpoint 3
file img_003.jpg
outpoint 9
.... [keep going until you've included all the images]

Then you run the following command:
ffmpeg -f concat -i [name you gave above text file] [your commands] output.mp4

Explanation

The command uses -f concat demuxer to add all the files listed in the text file to a single output.
The text file lists the file name, then lists the amount of time to show it in seconds.
If just the three files in the example are run, you will get a 17 second video that shows 3 images; the first for 5 seconds, the second for 3 seconds, and the third for 9 seconds.
The framerate will be whatever you specify under [your commands] (the correct flag here would be -r) or default to 30 fps (I think) if you do not specify anything.
You can give partial seconds with a decimal.
You can put full file paths with the file name, but will also have to include -safe 0 after concat for it to work. This is not necessary if they are relative paths.

Differences when working with video files instead of images:
In the text file, the format is usually like what is found in this similar question/answer, where you specify an "inpoint" as well as an "outpoint". The inpoint is where in the video input timeline you want to start, and the outpoint is for how many seconds you want to go. However, when the input file is an image (instead of a video) the inpoint creates an error, so you have to leave it out.
A Caveat
The concat demuxer requires all input files to have the same streams. This means basically everything like framerate and codec must be the same, but the container can be different. I've never tried this method with different image types, but I assume something like a mix of jpeg and png inputs would throw an error.
If you want to concatenate files of different types, you will have to use the concat filter. It's not as intuitive, but you have full control and won't need a text file. The above demuxer solution in the filter form looks like this (line breaks added for readability):
ffmpeg -loop 1 -t 5 -i img_001.jpg 
               -t 3 -i img_002.jpg 
               -t 9 -i img_003.jpg 
       filter_complex "[0:v:0][0:a:0]
                       [1:v:0][1:a:0]
                       [2:v:0][2:a:0]
                      concat=n=3:v=1:a=1
                      [outv][outa]" 
                      -map "[outv]" -map "[outa]" 
       [your commands] output.mp4

Basically, you name all the inputs at the beginning of the command. -loop 1 lets ffmpeg treat the images like looping video, so you don't have an inpoint. A video file can specify an inpoint with -ss before the -t, and will take 0 seconds as the default if not specified. filter_complex does all the work. The items like [0:v:0] are calling the inputs, specifying which input and what stream. concat=n=3:v=1:a=1 tells how many files the filter should expect (n=3) and how many video and audio streams to output (v=1:a=1). [outv][outa] Are kind of like user created variables. You would either send these to additional filters, or map them to the output (-map "[outv]" -map "[outa]").
Like I said, the filter is not very intuitive, so if you need further help writing your filtergraph, ask another question or follow the links I've already given.

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

e.g. for each image to show for 2.5 seconds,
ffmpeg -framerate 1/2.5 -i img%d.png -r 25 -pix_fmt yuv420p out.mp4


21582: <p>I trying to create a video using FFmpeg from a few images. I tried several ffmpeg commands but I can't repeat each image for several frames, instead, each image is one frame size and the video result is too short.</p>

<p>The idea, in general, is to obtain a video like:
Firs_image during X seconds, Second_image during X seconds, Third_image during x seconds...</p>

<p>There is any command to accomplish this?</p>
 3643: <p>To get each image to have a different time shown, instead of all images having the same time, you'll have to use <a href="https://trac.ffmpeg.org/wiki/Concatenate" rel="nofollow noreferrer">the concat demuxer and a text file</a>.</p>
<p>Create a text file like the following, ordering the images as you'd want them.</p>
<pre><code>file img_001.jpg
outpoint 5
file img_002.jpg
outpoint 3
file img_003.jpg
outpoint 9
.... [keep going until you've included all the images]
</code></pre>
<p>Then you run the following command:</p>
<pre><code>ffmpeg -f concat -i [name you gave above text file] [your commands] output.mp4
</code></pre>
<h1>Explanation</h1>
<ul>
<li>The command uses <code>-f concat</code> demuxer to add all the files listed in the text file to a single output.</li>
<li>The text file lists the file name, then lists the amount of time to show it in seconds.</li>
<li>If just the three files in the example are run, you will get a 17 second video that shows 3 images; the first for 5 seconds, the second for 3 seconds, and the third for 9 seconds.</li>
<li>The framerate will be whatever you specify under <code>[your commands]</code> (the correct flag here would be <code>-r</code>) or default to 30 fps (I think) if you do not specify anything.</li>
<li>You can give partial seconds with a decimal.</li>
<li>You can put full file paths with the file name, but will also have to include <code>-safe 0</code> after <code>concat</code> for it to work. This is not necessary if they are relative paths.</li>
</ul>
<p><strong>Differences when working with video files instead of images:</strong></p>
<p>In the text file, the format is usually like what is found in <a href="https://video.stackexchange.com/a/25099/3643">this similar question/answer</a>, where you specify an &quot;inpoint&quot; as well as an &quot;outpoint&quot;. The inpoint is where in the video input timeline you want to start, and the outpoint is for how many seconds you want to go. However, when the input file is an image (instead of a video) the inpoint creates an error, so you have to leave it out.</p>
<p><strong>A Caveat</strong></p>
<p>The concat demuxer requires all input files to have the same streams. This means basically everything like framerate and codec must be the same, but the container can be different. I've never tried this method with different image types, but I assume something like a mix of jpeg and png inputs would throw an error.</p>
<p>If you want to concatenate files of different types, you will have to use <a href="https://trac.ffmpeg.org/wiki/Concatenate#differentcodec" rel="nofollow noreferrer">the concat filter</a>. It's not as intuitive, but you have full control and won't need a text file. The above demuxer solution in the filter form looks like this (line breaks added for readability):</p>
<pre><code>ffmpeg -loop 1 -t 5 -i img_001.jpg 
               -t 3 -i img_002.jpg 
               -t 9 -i img_003.jpg 
       filter_complex &quot;[0:v:0][0:a:0]
                       [1:v:0][1:a:0]
                       [2:v:0][2:a:0]
                      concat=n=3:v=1:a=1
                      [outv][outa]&quot; 
                      -map &quot;[outv]&quot; -map &quot;[outa]&quot; 
       [your commands] output.mp4
</code></pre>
<p>Basically, you name all the inputs at the beginning of the command. <code>-loop 1</code> lets ffmpeg treat the images like looping video, so you don't have an inpoint. A video file <em>can</em> specify an inpoint with <code>-ss</code> before the <code>-t</code>, and will take 0 seconds as the default if not specified. <code>filter_complex</code> does all the work. The items like <code>[0:v:0]</code> are calling the inputs, specifying which input and what stream. <code>concat=n=3:v=1:a=1</code> tells how many files the filter should expect (<code>n=3</code>) and how many video and audio streams to output (<code>v=1:a=1</code>). <code>[outv][outa]</code> Are kind of like user created variables. You would either send these to additional filters, or map them to the output (<code>-map &quot;[outv]&quot; -map &quot;[outa]&quot;</code>).</p>
<p>Like I said, the filter is not very intuitive, so if you need further help writing your filtergraph, ask another question or follow the links I've already given.</p>
 1871: <p>Use</p>

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

<p>e.g. for each image to show for 2.5 seconds,</p>

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