<p>Use this command to generate a black video for wide playback compatibility.</p>
<p><code>ffmpeg.exe -loop 1 -i &quot;C:\Program Files (x86)\Utilities\BlackVideo\black640x480.png&quot; -pix_fmt yuv420p -t 10 -c:v libx264 black.mp4</code></p>
<p>and then</p>
<p><code>ffmpeg.exe -stream_loop -1 -i &quot;black.mp4&quot; -i &quot;%1&quot; -c:v copy -shortest -fflags +shortest -max_interleave_delta 200M &quot;%1.mp4&quot;</code></p>
<p>You will need ffmpeg 4.3 or later.</p>

CC BY-SA 4.0
2022-04-21T18:00:51.973Z
MP4. Corrected.
Gyan
CC BY-SA 4.0
2022-04-21T21:00:18.780Z
Thank you. I tried to understand the combination of `-shortest` and `+shortest` but didn't prevail. It just works.
Paul
CC BY-SA 4.0
2022-04-21T12:38:16.480Z
2022-04-21T18:00:41.140Z
2022-04-21T18:00:41.140Z
Gyan
<p>Currently I am converting MP3 to MP4 black video using following command line in Windows Registry:</p>
<pre><code>C:\Program Files\ffmpeg\bin\ffmpeg.exe -loop 1 -i &quot;C:\Program Files (x86)\Utilities\BlackVideo\black640x480.png&quot; -i &quot;%1&quot; -c:v libx264 -tune stillimage -shortest &quot;%1.mp4&quot;
</code></pre>
<p>It works fine, but FFMPEG isn't that smart to just encode a chunk from keyframe to keyframe and then repeat it without encoding. Instead, every second of the video is encoded, which is slow and causes unnecessary CPU load.</p>
<p>To solve this problem I created a black video with no sound for the first 10 seconds. Now I'm looking for the right FFMPEG command line options to loop this video without re-encoding for as long as the MP3 track lasts.</p>

<ffmpeg>
Convert MP3 to MP4 looping black video with FFMPEG
Paul
# Convert MP3 to MP4 looping black video with FFMPEG

(Asked by: username_0 on 2022-04-21)

Currently I am converting MP3 to MP4 black video using following command line in Windows Registry:
C:\Program Files\ffmpeg\bin\ffmpeg.exe -loop 1 -i "C:\Program Files (x86)\Utilities\BlackVideo\black640x480.png" -i "%1" -c:v libx264 -tune stillimage -shortest "%1.mp4"

It works fine, but FFMPEG isn't that smart to just encode a chunk from keyframe to keyframe and then repeat it without encoding. Instead, every second of the video is encoded, which is slow and causes unnecessary CPU load.
To solve this problem I created a black video with no sound for the first 10 seconds. Now I'm looking for the right FFMPEG command line options to loop this video without re-encoding for as long as the MP3 track lasts.

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2022-04-21. Score: 0 | Accepted answer

Use this command to generate a black video for wide playback compatibility.

`ffmpeg.exe -loop 1 -i "C:\Program Files (x86)\Utilities\BlackVideo\black640x480.png" -pix_fmt yuv420p -t 10 -c:v libx264 black.mp4`

and then

`ffmpeg.exe -stream_loop -1 -i "black.mp4" -i "%1" -c:v copy -shortest -fflags +shortest -max_interleave_delta 200M "%1.mp4"`

You will need ffmpeg 4.3 or later.

> **Comments:**
> **username_1**: MP4. Corrected.  
> **username_0**: Thank you. I tried to understand the combination of `-shortest` and `+shortest` but didn't prevail. It just works.  

---

