Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Readme.md

Video Generation with Python

This repository contains the sample code for the blog-post Video Generation with Python using Python’s MoviePy, SciPy and ImageMagick libraries. If you are looking for the original sample code that uses Python’s MoviePy and Gizeh libraries you can find it in its own repository.


Getting Started

To build and run this sample follow the instructions below to install requirements and set-up your python environment with pipenv.

Install ImageMagick

ImageMagick is required to run python_video.py for creating Moviepy TextClips.

You can download the source binaries in the download page and follow your development environment section to install from source. Otherwise, you can use a system package manager for the desired OS as follows.

To verify ImageMagick installation you can run the following command that will create a gif file.

$ convert logo: logo.gif

Ubuntu

Your distribution may already have installed ImageMagick. But in case its not, type:

$ sudo apt install imagemagick

MacOS

Using Homebrew which provides pre-built binaries for Mac, type:

$ brew install imagemagick

ImageMagick depends on Ghostscript fonts. To install them, type:

$ brew install ghostscript

Windows

The Windows version of ImageMagick is self-installing. Simply go to the download page to get a version that will launch itself and ask a few installation questions.

Install Python 3

Linux and OSX

Using version manager asdf-vm.

Install Python Plugin:
$ asdf plugin-add python https://github.com/danhper/asdf-python.git
Install Python:

Python version is specified in .tools-versions file.

$ asdf install

Note: This can be installed using package managers as well, the instruction may vary according to your package manager:

  • In Ubuntu:
sudo apt-get install python3
  • In OSx:
brew install python3

Windows

Using package manager Chocolatey:

C:\> choco install python3

Install python package manager

If not installed yet, run from the root of the project to install pipenv:

$ pip install --user pipenv

Install dependencies and generate video

From root project directory run:

$ pipenv install

Enable your virtual environment

From root project folder, enable virtual env typing:

pipenv shell

On Mac M1

Install required library for Moviepy

brew install ffmpeg

To generate the video

With pipenv virtualenv enabled and from the root project folder run:

python python_video.py

Note: It's possible to execute the script directly with pipenv using:

pipenv run python python_video.py

Disable Virtual Environment

To Disable it type exit

Troubleshooting

If you encounter errors when linking ImageMagick binaries like in this known issue 693, it does not have the proper permission set.

Check for the ImageMagick policy file at /etc/ImageMagick-6/policy.xml and comment out (or remove the line that reads)

<policy domain="path" rights="none" pattern="@*" />
<!-- <policy domain="path" rights="none" pattern="@*" /> -->