Using Python for simple media processing

Time:2021-6-23

Installation dependency

(sudo) pip install moviepy

Moviepy uses ffmpeg software to read and export video and audio files. Also use (optional) ImageMagick to generate text and GIF files. Different media processing relies on Python’s fast math library numpy. Advanced effects and enhancements use some Python image processing libraries (PIL, scikit image, SciPy, etc.).

Chinese link:doc.moviepy.com.cn/index.html#docum…

Introducing moviepy

from moviepy.editor import *

Synthesis of audio files into video files

Videopath = "video address to synthesize audio"

Extracting audio from video

Video = videofileclip ("video address")

Get audio often

audio = AudioFileClip(sys.argv[2])
print(audio.duration)
sys.stdout.flush()

This work adoptsCC agreementReprint must indicate the author and the link of this article