mhmovie
mhmovie is a Python library for adding music to a video with very simple code. mhmovie runs in Python 3+.
Examples
from mhmovie import *
m = Movie("Movie.mp4") # supports all moviepy formats
# you can get length by:
print(":".join(m.time())) # 00:03:06
mu = Music("Music.wav") # supports all moviepy formats
final = m + mu
final.save("final.mp4") # save the Movie with the Music as final.mp4
############################ control audio of video
m = Movie("Movie.mp4")
mute_movie = m.mute() # mute Music of Movie to mute_movie
m_audio = m.audio() # save audio to m_audio
m_audio = m_audio.vol(1.5) # up volume to 150%
final = m + m_audio
final.save("movieUpVolume.mp4")
################################## effects
m = m.sub_clip(10,20) # extract subclip from 10s to 20s
# additional effects
m = m.rotate(10) # 10 degrees
m = m.invert_colors()
m = m.time_mirror() # reverse timing
m = m.loop(5) # play 5 times
m = m.loop(duration=15) # loop for 15 seconds
m = m.resize(500,500) #resize each frame to 500x500 pixels
#### Music
m_audio = m_audio.sub_clip(10,20) # exctract audio from 10s to 20s
# overlay other music on this music (blend)
mu2 = Music("music2.mp3")
final_mu = m_audio.overlay(mu2)
final = m+final_mu
final.save("final.mp4")
########################## automatic mode
f = Folder("some_folder")
# some_folder has file of type mp4 and file of type mp3 and joins them automatically
f.load().save("output.mp4") # save Movie+Music as output.mp4
######################### operators
print(":".join(len(m))) # length of clip: 00:03:06
# effects
m = ~m # same as m.time_mirror()
m = m // (12, 43) # same as m.sub_clip(12,43)
m = m*6 # same as m.loop(6)
m = m%45 # same as m.rotate(45)
#### Music
m_audio = m_audio % mu2 # same as mu.overlay(mu2)
m_audio = m_audio // (12,43) #same as mu.sub_clip(12,43)
m_audio = m_audio**1.5 # same as mu.vol(1.5)
# you can combine operators
m = Movie("movie_original.mp4")
# reduce volume by half, add to movie, reverse and take subclip from 12s to 43s
m = (~(m + (m_audio ** 0.5)) // (12, 43))
m.save("final.mp4")
Prerequisites
mhmovie depends on the moviepy python module. the mhmovie main also depends on autoclick.
Installing
To install with pip- type in terminal:
(sudo) pip install mhmovie
use from terminal:
python -m mhmovie add m.mp4 mu.mp3 -o o.mp4
python -m mhmovie rotate m.mp4 90 -o o.mp4
and etc:
sub,mute,loop,audio,time_mirror,folder
New in this version
Many bug fixes and changed to moviepy.
Built With
Author
matan h
License
This project is licensed under the MIT License.