gpt4 book ai didi

FFMPEG 缩放、缩放和连接过滤器

转载 作者:行者123 更新时间:2023-12-04 23:05:04 32 4
gpt4 key购买 nike

我正在使用 ffmpeg for android 来制作 mp4 格式的视频。我无法让这个命令在 FFMPEG 中工作,基本上我正在尝试添加两个图像,缩放它们,添加缩放效果,最后将结果连接到一个视频文件中。我做了这样的事情:

ffmpeg 
-t 8 -i image1.png
-t 8 -i image2.png
-filter_complex
[0:v]scale=720:720[scl1]; [1:v]scale=720:720[scl2];
[scl1]zoompan=z=if(lte(zoom, 1.0), 1.55, max(1.001, zoom - 0.0010)):d=205, fade=t=out:st=7:d=1[v0];
[scl2]zoompan=z=if(lte(zoom, 1.0), 1.55, max(1.001, zoom - 0.0010)):d=205, fade=t=in:st=0:d=1,fade=t=out:st=7:d=1[v1];
[v0][v1]concat=n=2:v=1:a=0, format=yuv420p[v] -map [v] outputVideo.mp4

一直在修改这个命令,但仍然无法让它工作,我得到了错误:
Input link in1:v0 parameters (size 1280x720, SAR 0:1) do not match the corresponding output link in0:v0 parameters (1280x720, SAR 45:31)
[Parsed_concat_7 @ 0xf0d77600] Failed to configure output pad on Parsed_concat_7

最佳答案

利用

ffmpeg 
-i image1.png
-i image2.png
-filter_complex
[0:v]scale=720:720,setsar=1[scl1]; [1:v]scale=720:720,setsar=1[scl2];
[scl1]zoompan=z=if(lte(zoom, 1.0), 1.55, max(1.001, zoom - 0.0010)):s=720x720:d=205, fade=t=out:st=7:d=1[v0];
[scl2]zoompan=z=if(lte(zoom, 1.0), 1.55, max(1.001, zoom - 0.0010)):s=720x720:d=205, fade=t=in:st=0:d=1,fade=t=out:st=7:d=1[v1];
[v0][v1]concat=n=2:v=1:a=0, format=yuv420p[v] -map [v] outputVideo.mp4

在单个图像上使用 zoompan 时,在过滤器中设置持续时间(以帧为单位),而不是在输入中。

您突出显示的问题是由于缩放过滤器调整了纵横比。 setsar 过滤器使它们相同。

关于FFMPEG 缩放、缩放和连接过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51647277/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com