合并视频和音频的ffmpeg。环路视频音频的同时并没有结束 [英] Merge video and audio with ffmpeg. Loop the video while audio is not over

查看:784
本文介绍了合并视频和音频的ffmpeg。环路视频音频的同时并没有结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图合并与视频文件中的音频文件。
我有两个选择:

I'm trying to merge an audio file with a video file. I have two options:


  • 有一个非常小的视频文件(例如,10秒)的循环而音频文件还没有结束。

  • Have a very small video file (e.g., 10 seconds) that loop while the audio file is not over.

有一个很长的视频文件上,我可以将音频文件(比我的音频文件更长)。我想切当音频完成视频。

Have a very long video file (longer than any of my audio file) on which I can attach the audio file. I would like to cut the video when the audio is finished.

我已经使用了后者的ffmpeg -t选项。这意味着我必须得到的音频文件的持续时间将其送入ffmpeg的。是否有可能避免这一步呢?

I've using the latter with the -t option of ffmpeg. It means I have to get the duration of the audio file to feed it into ffmpeg. Is it possible to avoid this step ?

第一个解决方案的任何指针?

Any pointer for the first solution ?

推荐答案

第二个项目符号点很容易被利用的ffmpeg的-shortest选项解决。请参阅: http://www.ffmpeg.org/ffmpeg-doc.html#SEC12了解更多信息。

The second bullet point was easily solved by using the -shortest option of ffmpeg. See: http://www.ffmpeg.org/ffmpeg-doc.html#SEC12 for more details.

这篇关于合并视频和音频的ffmpeg。环路视频音频的同时并没有结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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