Python FFMPEG-Python Library Example to Flip Video in Horizontal and Vertical Direction Full Project For Beginners

Python FFMPEG-Python Library Example to Flip Video in Horizontal and Vertical Direction Full Project For Beginners

 

Welcome folks today in this example we will be flipping video in both horizontal and vertical direction using ffmpeg-python library. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install ffmpeg-python

 

After installing this library you need to make an app.py file and copy paste the following code

 

Horizontal Flip Video Example

 

app.py

 

import ffmpeg
stream = ffmpeg.input('video1.mkv')
stream = ffmpeg.hflip(stream)
stream = ffmpeg.output(stream,'output.mkv')
ffmpeg.run(stream)

 

 

Now if you execute the python script by typing the below command as shown below

See also  Python 3 dxfgrabber Script to Convert AutoCAD Drawings DWG/DFG Figures to PNG or JPEG Image File Full Project For Beginners

 

python app.py

 

 

So it will create the output.mkv file inside the same directory as shown below

 

 

Now if i open the video you will see the video is flipped in horixontal direction as shown below

 

 

 

Vertical Flip Video Example

 

app.py

 

import ffmpeg
stream = ffmpeg.input('video1.mkv')
stream = ffmpeg.vflip(stream)
stream = ffmpeg.output(stream,'output.mkv')
ffmpeg.run(stream)

 

 

 

Leave a Reply