As I learnt to use Python for the CFDS (Chartered Financial Data Scientist) certificate, I now sometimes also use that coding knowledge for other practical use cases. For example recently I wanted to combine and cut some mobile phone footage I had taken.
Here’s some example code how to do that:
from moviepy.editor import * import moviepy.editor as mp # you can also use .avi etc instead of .mp4 (i.e. whatever your source is) video1 = VideoFileClip("Clip_1.mp4").subclip(15,28) video2 = VideoFileClip("Clip_2.mp4").subclip(0,7) # list our clips that we defined above clips = [video1, video2] # concat (merge) the files and give the new combined clip a name concat_clip = mp.concatenate_videoclips(clips) concat_clip.write_videofile("Clips Combined.mp4") # Make the text. Many more options are available. txt_clip = ( TextClip("Your Text",fontsize=40,color='white') .set_position('top') .set_duration(20) ) # create the result result = CompositeVideoClip([concat_clip, txt_clip]) # Overlay text on video result.write_videofile("Your Final Clip.mp4",fps=30) # Many options...
Questions or feedback?
Feel free to write me at email@example.com or add a comment.
- Using Python Script pynput to Control Mouse, Keyboard and Execute Repeat Tasks like Downloading – in Combination with Sleep Timer Function
- Amazon Transcribe vs Google Transcript vs IBM Watson – Speech to Text Comparison – Using Python Script, a .wav File Podcast – Amazon APIKey Credentials
- Crypto Turnover on SIX Swiss Exchange from mid-December 2020 to March 2021