使用 ffmpeg 添加重复的背景音频 [英] adding repeated background audio with ffmpeg

查看:53
本文介绍了使用 ffmpeg 添加重复的背景音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 ffmpeg,我看到了如何添加音乐文件作为视频的背景,但问题是如何使音频循环/重复.有出路吗?

With ffmpeg, I see how to add music file as background for a video, but the problem is how to make the audio loop/repeat. Is there a way out?

推荐答案

ffmpeg 具有前景广阔的 -loop_input 标志,但尚不支持音频输入.

ffmpeg has the promising -loop_input flag, but it doesn't support audio inputs yet.

我建议将 sox-shortest 选项用于 ffmpeg 作为解决方案.

I'd recommend sox and the -shortest option for ffmpeg as a solution.

sox short_audio.mp3 looped_audio.mp3 repeat 1000 # adjust count as necessary
ffmpeg -i input_video.mp4 -i looped_audio.mp3 -shortest output_video.mp4

sox 命令将循环输入,ffmpeg 命令将其用于音频,但在处理完视频时停止.

The sox command will loop the input, and the ffmpeg command will use it for the audio, but stop when it runs out of video to process.

这篇关于使用 ffmpeg 添加重复的背景音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆