Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ffmpeg repeat audio loop audio to some times and durations
# ffmpeg -i rain-drops.ogg -i pouring-rains.ogg -i distant-thounder.ogg -i close-thounder.ogg -i frogs.ogg -filter_complex amix=inputs=5:duration=shortest -acodec libmp3lame rain-thounder.mp3 -y
# 把ogg音频文件重复到1800秒,并压缩成为mp3。增加逐渐音量减小到0,也逐渐增加到正常音量
for f in *.ogg;
do
ffmpeg -i "$f" -vn -sn -c:a mp3 -ab 192k -acodec libmp3lame mp3src/"${f%.ogg}".mp3 -y \
&& ffmpeg -stream_loop 60 -i "$f" -vn -sn -c:a mp3 -ab 192k -t 1800 -acodec libmp3lame mp3src/"${f%.ogg}"-normal.mp3 -y \
&& ffmpeg -stream_loop 60 -i "$f" -vn -sn -c:a mp3 -ab 192k -t 1800 -af "afade=t=out:st=0:d=1800" -acodec libmp3lame mp3src/"${f%.ogg}"-evening.mp3 -y \
&& ffmpeg -stream_loop 60 -i "$f" -vn -sn -c:a mp3 -ab 192k -t 1800 -af "afade=t=in:ss=0:d=1800" -acodec libmp3lame mp3src/"${f%.ogg}"-morning.mp3 -y
done
for f in *.mp3;
do
ffmpeg -i "$f" -vn -sn -c:a mp3 -ab 192k -acodec libmp3lame mp3src/"${f%.mp3}".mp3 -y \
&& ffmpeg -stream_loop 60 -i "$f" -vn -sn -c:a mp3 -ab 192k -t 1800 -acodec libmp3lame mp3src/"${f%.mp3}"-normal.mp3 -y \
&& ffmpeg -stream_loop 60 -i "$f" -vn -sn -c:a mp3 -ab 192k -t 1800 -af "afade=t=out:st=0:d=1800" -acodec libmp3lame mp3src/"${f%.mp3}"-evening.mp3 -y \
&& ffmpeg -stream_loop 60 -i "$f" -vn -sn -c:a mp3 -ab 192k -t 1800 -af "afade=t=in:ss=0:d=1800" -acodec libmp3lame mp3src/"${f%.mp3}"-morning.mp3 -y
done
# ffmpeg -i birds.ogg -vn -sn -c:a mp3 -acodec pcm_s16le -ac 1 -ar 16000 mp3src/birds.wav -y
# ffmpeg -stream_loop 60 -i birds.ogg -vn -sn -c:a mp3 -t 1800 -af "afade=t=in:ss=0:d=1800" -acodec pcm_s16le -ac 1 -ar 16000 mp3src/birds.wav -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment