FFMPEG 将音频添加到视频中,但将其剪辑到视频长度

发布于 2024-12-02 21:19:50 字数 335 浏览 1 评论 0原文

我正在尝试从图像序列创建视频并使用 FFMPEG 添加音频。

帧序列只有 25 帧长,但音频有几分钟。我希望 FFMPEG 将音频剪辑到帧序列的长度。

这是我尝试过的命令:

ffmpeg -i input_images%04d.jpg -pix_fmt yuv420p -vcodec mjpeg -qmin 1 -qmax 1 -r 25 -i audio_file.mp3 -ar 22050 -ab 192k -aframes 25 output.mov

这会生成包含第一个图像序列但包含完整长度音频的视频。 -aframes 被忽略。有什么想法吗?

I'm trying to create a video from an image sequence and add audio with FFMPEG

The frame sequence is only 25 frames long but the audio is several minutes. I want FFMPEG to clip the audio to the length of the frame sequence.

This is the command I have tried:

ffmpeg -i input_images%04d.jpg -pix_fmt yuv420p -vcodec mjpeg -qmin 1 -qmax 1 -r 25 -i audio_file.mp3 -ar 22050 -ab 192k -aframes 25 output.mov

This results in a video with the first image sequence but the full length audio. -aframes is ignored. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰火雁神 2024-12-09 21:19:50

听起来您正在寻找 -shortest 选项:

-最短
当最短输入流结束时完成编码。

It sounds like you're looking for -shortest option:

-shortest
Finish encoding when the shortest input stream ends.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文