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
1 2 3 4 5 |
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
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
1 2 3 4 5 |
import ffmpeg stream = ffmpeg.input('video1.mkv') stream = ffmpeg.vflip(stream) stream = ffmpeg.output(stream,'output.mkv') ffmpeg.run(stream) |