How to more elegantly append an audio file to itself when using FFmpeg than the process I have come up with?
It seems like the macOS QuickTime player app does not support a song playing for curtain number loops
My idea is to append a audio to itself for the curtain numbers.
Here is code:
// loop 3 times
ffmpeg -i "concat:nobody.mp3|nobody.mp3|nobody.mp3" -acodec copy out.mp3
It works.
But how to append an audio file to itself in a more elegant way than my code handles it now?
Solution 1:
Adapted from Repeat/loop with ffmpeg?
concat demuxer
Use the concat demuxer.
-
Make
input.txt
:file 'nobody.mp3' file 'nobody.mp3' file 'nobody.mp3'
-
Concatenate:
ffmpeg -f concat -i input.txt -c copy output.mp3
- It will be more reliable than the concat protocol.
- Useful if you want to add various files (but they must have same attributes).
- In Linux you can automatically make
input.txt
. See "For Linux users" section in Repeat/loop with ffmpeg?
-stream_loop
ffmpeg -stream_loop 2 -i nobody.mp3 -c copy output.mp3
-stream_loop 2
will play once, then loop twice, so nobody.mp3
will play 3x. Setting -1
is infinite loop.