Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.35k stars 1.55k forks source link

How to make vertical video with blurred background sides? #884

Open ramazk opened 5 years ago

ramazk commented 5 years ago

Hi, how I can make video explained here: https://stackoverflow.com/questions/30789367/ffmpeg-how-to-convert-vertical-video-with-black-sides-to-video-169-with-blur Thanks in advance.

KeizerDev commented 5 years ago

Would like to know if this possible too. The actually question is now, how to make the following ffmpeg command work in moviepy:

ffmpeg -i input.mp4 -lavfi '[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' -vb 800K output.webm
seanphan commented 5 years ago

Hey @KeizerDev @ramazk, StackOverFlow brought me here with same question. Did you resolve this issue with moviepy ?

AKwoKWH commented 5 years ago

@KeizerDev @ramazk @seanphan What to ask the same too. I was thinking to overlay the same video , with the blurred one at the back. are there any faster method?

shanginn commented 5 years ago

yeah, same question here, not found answer yet..

tburrows13 commented 4 years ago

This would be a nice example to have in the examples folder.

shanginn commented 4 years ago

I did it like this:

with VideoFileClip(video_path) as video:
    if video.aspect_ratio < 1.7:
        video.write_videofile(
            new_video_path,
            ffmpeg_params=['-lavfi', '[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']
        )
keikoro commented 2 years ago

Would anyone who commented or reacji'd on this issue create an example as suggested earlier? @shanginn, perhaps?