通过ffmpeg通过1个人,我需要组合2个音频并向其中添加图片(专辑) [英] Through 1 someone through ffmpeg I need to combine 2 audio and add a picture (album) to it

查看:65
本文介绍了通过ffmpeg通过1个人,我需要组合2个音频并向其中添加图片(专辑)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过ffmpeg通过1人我需要组合2个音频并向其中添加图片(专辑)

Through 1 whom through ffmpeg I need to combine 2 audio and add a picture (album) to it

<--------->            1-audio
     <-------------->  2-audio
<------------------->  output

https://superuser.com/questions/1509582/ffmpeg-merge-两个音频文件,定义了重叠时间

我查看了此链接,它组合了2个音频.现在我需要为其添加图片(专辑)

I looked at this link and it combined 2 audios. Now I need to add a picture (album) to it

这是正在使用我的命令

ffmpeg -i 1.mp3 -i 2.mp3 -filter_complex "[1]adelay=Ns|Ns[a1];[0:a][a1]amix=inputs=2[a]" -map "[a]" output.mp3

多亏了这一点,我才能够将两个音频合并为一个.

我是这样看的

ffmpeg -i 1.mp3 -i 2.mp3 -i 1.png -filter_complex "[1]adelay=5s|5s[a1];[0:a][a1]amix=inputs=2[a]" -map "[a]" -c:a copy -c:v copy -map 0:0 -map 1:0 -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" audio-out.mp3

1.mp3 - first audio (1:35 s)
2.mp3 - second audio (0:16 s)
1.png - picture (album) (170x170)

我收到此错误

从输出流0:0请求流复制,这是从复杂的filtergraph馈送的.过滤和流复制不能一起使用.

当我说图片(专辑)时,我的意思就是那样.图片中清楚地显示了这一点. https://i.imgur.com/z64KhoS.png

When I say picture (album), I mean exactly that. This is clearly shown in the picture. https://i.imgur.com/z64KhoS.png

推荐答案

要解决该错误,您需要删除 -c:a副本.如错误消息所示,您无法复制过滤器的输出-您需要重新编码音频.只需删除此选项即可启用转码功能,不过,如果您需要进行某些特定的配置,则可能希望为mp3编码器提供选项.

To solve the error, you need to remove -c:a copy. As the error message tells you, you cannot copy the output of a filter - you need to reencode the audio. Simply removing this will enabled transcoding, though you may wish to provide options to the mp3 encoder if you are after some specific configuration.

然后,您还需要删除 -map 0:0 -map 1:0 ,因为这些将被过滤器的输出替换.

Then you will also need to remove -map 0:0 -map 1:0 since these will be replaced by the output of the filter.

最后,您需要添加 -map 2:0 来映射图像.这是因为图像现在是第三个输入,而不是第二个.

Finally, you need to add -map 2:0 to map the image. This is because the image is now the third input rather than the second.

因此最终的命令行将类似于:

So the final command line will be something like:

ffmpeg -i 1.mp3 -i 2.mp3 -i 1.png -filter_complex "[1]adelay=5s|5s[a1];[0:a][a1]amix=inputs=2[a]" -map "[a]" -c:v copy -map 2:0 -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" audio-out.mp3

这篇关于通过ffmpeg通过1个人,我需要组合2个音频并向其中添加图片(专辑)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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