0

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.

1 Answer 1

0

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.

2
  • MP4. Corrected.
    – Gyan
    Apr 21, 2022 at 18:00
  • Thank you. I tried to understand the combination of -shortest and +shortest but didn't prevail. It just works.
    – Paul
    Apr 21, 2022 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.