FFMPEG:转换图像+到MP4 60fps的音频,包括Fadein / vadeout和覆盖

发布于 2025-02-13 07:32:56 字数 448 浏览 1 评论 0原文

这是我要实现的目标:

  1. 输入是mp3或wav,图像(jpg或png)
  2. 输出应为带有MP3音频的MP4视频,在60fps处,以在/淡入/淡出中非常平滑。在视频(每个)(每个)上(每个)耗尽(黑色),

我努力使这种淡入 /淡入淡出。 这是我所拥有的:

 ffmpeg -r 1 -loop 1 -i image.jpg -i audio.mp3 -acodec copy -r 60 -shortest -vf fade=in:0:01 -pix_fmt yuv420p output.mp4

我的Fadein是静态的,是黑色的图像,然后是我的视频,不流畅。 如何获得平滑的60fps淡出?

我也有另一个请求,假设我有一个覆盖视频,我想加入视频。如果我将视频连接到现有视频中,那么覆盖层也将在不正确的淡入淡出的顶部,该如何实现?太感谢了。

Here is what I'm trying to achieve:

  1. Inputs are an MP3 or WAV, and an image (JPG or PNG)
  2. The output should be an MP4 video with the MP3 audio with the image, at 60FPS for a very smooth fade in/fade out (black) on the video (1s each)

I strugguling to make this fade in / fade out.
Here is what I have:

 ffmpeg -r 1 -loop 1 -i image.jpg -i audio.mp3 -acodec copy -r 60 -shortest -vf fade=in:0:01 -pix_fmt yuv420p output.mp4

My fadein is static, so black image and then my video, not smooth.
How do I get a smooth 60FPS fade?

I also have another request, let's say I have an overlay video that I want to concatenate to my video. If I concatenate a video to the existing video, the overlay will also be on top of the fades which is not right, how can I achieve this? Thank you so much.

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

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

发布评论

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

评论(1

萝莉病 2025-02-20 07:32:56

您正在设置nb_frame = 1使用过滤器选项in:0:01。如果您希望淡入持续时间,则需要指定选项名称:in:duration = 1start_time = 0选项不必要,因为0是默认值)。

对于vadeout,您需要指定start_time选项,因此首先运行ffprobe首先获取MP3文件的持续时间。

至于覆盖层,您必须在褪色之前进行。您的过滤链应看起来像[0:v] [1:V]覆盖,淡入:in,vade:out

[addendum]褪色效果需要帧才能实现它,在滤波器vade :[0:v] [1:v]覆盖,fps = 60,vade:in,fade:out。并从输出选项中删除-r 60(或将其放入,因为它无论如何都不应该做任何事情)。

You're setting nb_frame=1 with your filter options in:0:01. If you wish to fade duration, you need to specify the option name: in:duration=1 (start_time=0 option is unnecessary as 0 is the default).

For fadeout, you need to specify the start_time option so run ffprobe first to get the duration of the mp3 file.

As for the overlay, you must do it before fading. Your filterchain should look like [0:v][1:v]overlay,fade:in,fade:out

[addendum] Fading effect requires frames to realize it, increase the framerate before the filter fade: [0:v][1:v]overlay,fps=60,fade:in,fade:out. And remove -r 60 from the output option (or leave it in as it shouldn't do anything anyway).

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