Skip to content

Instantly share code, notes, and snippets.

@ArneAnka
Created January 5, 2020 13:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArneAnka/a1348b13fc291f72f862d92f35380428 to your computer and use it in GitHub Desktop.
Save ArneAnka/a1348b13fc291f72f862d92f35380428 to your computer and use it in GitHub Desktop.
FFmpeg: How to convert vertical video with black sides, to video 16:9, with blurred background sides
https://stackoverflow.com/questions/30789367/ffmpeg-how-to-convert-vertical-video-with-black-sides-to-video-169-with-blur
ffmpeg -i <input_file> -filter_complex "[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16" <output_file>
TAKES FOREVER!
@kerkenit
Copy link

kerkenit commented Aug 6, 2023

For HDR video's Shot on iPhone and keep HEVC codec:
ffmpeg -i IMG_xxxx.MOV -movflags +faststart -c:a copy -c:v hevc -x265-params lossless=1 -vtag hvc1 -filter_complex "[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16" output.MOV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment