View Single Post
Old 09-23-2021, 03:36 PM  
Ollay
Confirmed User
 
Industry Role:
Join Date: Jul 2016
Location: United Kingdom
Posts: 73
Need help with ffmpeg

Hi everyone,

I'm trying to add a 16:9 intro to videos for my mechbunny site using ffmpeg. So far i have the following filter which i found online:

Code:
ffmpeg -i intro.mp4 -i input.mp4 -filter_complex "[0][1]scale2ref=iw:ih[intro][main];[intro]drawbox=t=fill[intro-bg];[0][intro-bg]scale2ref=iw:ih:force_original_aspect_ratio=decrease:flags=spline[intro][intro-bg];[intro-bg][intro]overlay=x='(W-w)/2':y='(H-h)/2'[intro-resized]; [intro-resized][0:a][main][1:a]concat=n=2:v=1:a=1:unsafe=1[v][a]" -map '[v]' -map '[a]' -movflags +faststart -acodec aac -vcodec h264_nvenc -cbr true -b:v 1000k -bt 1000k -y -2pass true -threads 32 -profile:v high -r 30 -preset medium output.mp4
It works great unless the main video isn't 16:9. If it's a portrait video it will just be stretched out to fill the screen.

Does anyone know how i can adjust the filter to add black bars down the side of the video to keep it the correct aspect ratio? I'm struggling to get my head around the filters.

Thanks in advance
__________________
Highest paying InPage ads: Clickadilla
Ollay is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote