<p>Use stream_loop to loop the input indefinitely and set output <code>-t</code> to limit the duration.</p>
<pre><code>ffmpeg -stream_loop -1 -i input -c copy -t 3600 output
</code></pre>

CC BY-SA 4.0
2021-05-14T09:38:51.483Z
2021-05-14T09:38:51.483Z
Gyan
<p>I am trying to use FFmpeg to generate for example a 1-hour video from concatenating a 1-second input video over and over and over again.</p>
<p>The problem is that the length of my input video is of various lengths so I can't just hardcode it to make it concatenate 3600 times.</p>
<p>My approach is:</p>
<p>1.Acquire the length of the input video (in this example, 1s)<br />
2.divide the target length by the length of input video (in this example, 3600)<br />
3.Let FFmpeg concatenate for (3600) times with <code>-vcodec copy -acodec copy</code></p>
<p>I am using Android Studio and the <code>com.writingminds:FFmpegAndroid:0.3.2</code> module<br />
Any ideas would be appreciated.</p>

<ffmpeg><android>
FFMPEG Loop Concatenate Video to Specific Length
Tupopo
# FFMPEG Loop Concatenate Video to Specific Length

(Asked by: username_0 on 2021-05-14)

I am trying to use FFmpeg to generate for example a 1-hour video from concatenating a 1-second input video over and over and over again.

The problem is that the length of my input video is of various lengths so I can't just hardcode it to make it concatenate 3600 times.

My approach is:

1.Acquire the length of the input video (in this example, 1s)  
2.divide the target length by the length of input video (in this example, 3600)  
3.Let FFmpeg concatenate for (3600) times with `-vcodec copy -acodec copy`

I am using Android Studio and the `com.writingminds:FFmpegAndroid:0.3.2` module  
Any ideas would be appreciated.

**Tags:** ffmpeg, android


---

## 1 answers

### Answer by username_1 on 2021-05-14. Score: 1

Use stream_loop to loop the input indefinitely and set output -t to limit the duration.
ffmpeg -stream_loop -1 -i input -c copy -t 3600 output


---

