问题描述
我需要将输入3(logo.gif)的大小调整为360x360,但是使用scale = 360:360只会使我的视频质量真的很差.这是我的代码:
I need to resize input 3 (logo.gif) to 360x360, but using scale=360:360 just made my video quality really bad. Here's my code:
ffmpeg -y -hide_banner -safe 0 -f concat -i "concat.txt" -i "overlay.png" -i "audio.mp3" -ignore_loop 0 -i "logo.gif" -filter_complex "[0]scale=3840x2160,zoompan=z='if(lte(zoom,1.0),1.25,max(1.001,zoom-0.0012))':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':fps=20:d=200:s=1920x1080[p];[p][1]overlay, scale=1920:1080, drawtext=fontfile=Heathergreen.otf:text=TITLE':fontcolor=black:fontsize=62:x=135:y=940, drawtext=fontfile=voxbox.ttf:text='TEXT':fontcolor=white:fontsize=70:x=120:y=885[v];[2:a]showwaves=mode=cline:s=178x56:r=20:scale=sqrt:colors=0x222222,colorkey=0x000000:0.01:0.1,format=yuva420p[w];[v][3]overlay=20:500[z];[z][w]overlay=108:740[outv]" -map "[outv]" -map 2:a -pix_fmt yuv420p -c:v libx264 -c:a aac -preset veryfast -shortest -movflags faststart -fflags genpts -r 20 "output.mp4"
更新:我只是简单地调整了图像的大小,并将其用作输入,而不是在编码过程中调整大小.效果很好,但是如果有人对此有答案,我很想知道我要去哪里错了.
UPDATE: I've simply resized the image and used that as input rather than resizing during the encode. It works fine, but if anyone has an answer to this I'd be curious to know where I was going wrong.
推荐答案
您可以使用 [3] scale代替
.开始时,您的GIF应该是正方形的,以免扭曲. [v] [3] overlay = 20:500 [z]
= 360:360 [3v]; [v] [3v] overlay = 20:500 [z]
Instead of [v][3]overlay=20:500[z]
you would use [3]scale=360:360[3v];[v][3v]overlay=20:500[z]
. Your GIF should be square-shaped to begin with, to avoid distorting it.
这篇关于FFMPEG-如何调整图像叠加层的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!