Moviepy: How to make vertical video with blurred background sides?

Created on 14 Dec 2018  路  6Comments  路  Source: Zulko/moviepy

examples question video

Most helpful comment

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']
        )

All 6 comments

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

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

@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?

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

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

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']
        )
Was this page helpful?
0 / 5 - 0 ratings

Related issues

cquintini picture cquintini  路  4Comments

Swiffers picture Swiffers  路  4Comments

xjcl picture xjcl  路  3Comments

djevo1 picture djevo1  路  3Comments

tburrows13 picture tburrows13  路  3Comments