videoffmpeg

FFmpeg: How to convert horizontal video 16:9 to vertical video 9:16, with blurred background on top and bottom sides


I know there is a post to do the contrary: FFmpeg: How to convert vertical video with black sides, to video 16:9, with blurred background sides

but i can't figure out how to do this with ffmpeg

here is the input:

and here is the expected result (the background video should be zoomed with the same aspect ratio, cropped to 9/16 and blurred) :

Thanks for your help!


Solution

  • I adapted solution proposed by Mulvya

    here is the final result:

    ffmpeg -i input.mp4 -lavfi "[0:v]scale=256/81*iw:256/81*ih,boxblur=luma_radius=min(h\,w)/40:luma_power=3:chroma_radius=min(cw\,ch)/40:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,setsar=1,crop=w=iw*81/256"  output.mp4