Skip to content

WebNinjaDeveloper.com

Programming Tutorials




Menu
  • Home
  • Youtube Channel
  • Official Blog
  • Nearby Places Finder
  • Direction Route Finder
  • Distance & Time Calculator
Menu

Python 3 MoviePy Script to Mirror Mp4 Video in X & Y Axis Direction in Command Line

Posted on February 12, 2023

Welcome folks today in this blog post we will be using the moviepy library to mirror mp4 video file in x and y axis. All the full source code of the application is shown below.

 

 

Get Started

 

 

First of all we need to install the below moviepylibrary using the pip command as shown below

 

 

pip install moviepy

 

 

In order to get started you need to make an app.py file and copy paste the following code

 

 

app.py

 

Mirroring MP4 Video in X-Axis & Y-Axis Direction

 

 

Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Import everything needed to edit video clips
from moviepy.editor import *
 
# loading video dsa gfg intro video
clip = VideoFileClip("video.mp4")
 
# getting subclip from the original video
clip = clip.subclip(0, 10)
 
# mirroring image according to the x axis
clip = clip.fx(vfx.mirror_x)
 
 
# showing final clip
clip.ipython_display()

 

 

As you can see we are importing the moviepy library at the very top and then we are only taking the first 9 seconds of the input video using the subclip()method and then we are applying the mirroring effect on the video in the x-axis direction using the fx() method and inside it we are passing the constant which is vfx.mirror_x for x direction. For Y-Axis you just need to write vfx.mirror_y instead as shown below

 

 

Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Import everything needed to edit video clips
from moviepy.editor import *
 
# loading video dsa gfg intro video
clip = VideoFileClip("video.mp4")
 
# getting subclip from the original video
clip = clip.subclip(0, 10)
 
# mirroring image according to the x axis
clip = clip.fx(vfx.mirror_y)
 
 
# showing final clip
clip.ipython_display()

 

 

 

Recent Posts

  • Javascript Fabric.js Example to Export Drawing Canvas to Image & PDF Document in Browser
  • Python 3 Flask-WTF Example to Implement Form Validation and Show Custom Error Messages in Browser
  • Python 3 Flask Jinja2 Template Project to Implement HTML5 Form Validation & Show Custom Error Messages in Browser
  • Node.js Tutorial to Rename All Files in Directory With Custom Pattern Using fs Module
  • FFMPEG Command to Create MP4 Video Slideshow From Multiple Images in Command Line
  • Angular
  • Bunjs
  • C#
  • Deno
  • django
  • Electronjs
  • java
  • javascript
  • Koajs
  • kotlin
  • Laravel
  • meteorjs
  • Nestjs
  • Nextjs
  • Nodejs
  • PHP
  • Python
  • React
  • ReactNative
  • Svelte
  • Tutorials
  • Vuejs




©2023 WebNinjaDeveloper.com | Design: Newspaperly WordPress Theme