Skip to content

Instantly share code, notes, and snippets.

@iflamed
Created September 23, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iflamed/533aebade5c6253fa6c8cf43c0c4f582 to your computer and use it in GitHub Desktop.
Save iflamed/533aebade5c6253fa6c8cf43c0c4f582 to your computer and use it in GitHub Desktop.
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