Тёмный

How I Edit My Videos With Python - Python Task Automation 

Patrick Loeber
Подписаться 269 тыс.
Просмотров 74 тыс.
50% 1

In this tutorial, I show you how I edit my videos using Python and MoviePy.
MoviePy is a Python module for video editing, which can be used for basic operations like cuts, concatenations, title insertions, video compositing, video processing, and even to create advanced effects.
✅ Write cleaner code with Sourcery, instant refactoring suggestions in VS Code & PyCharm: sourcery.ai/?... *
⭐ Join Our Discord : / discord
🚀🚀 Get monthly Python and ML Tips:
www.python-engineer.com/newsl...
🚀🚀 SUPPORT ME ON PATREON:
/ patrickloeber
If you enjoyed this video, please subscribe to the channel!
Moviepy: zulko.github.io/moviepy/index...
Code:
github.com/patrickloeber/pyth...
You can find me here:
Website: www.python-engineer.com
Twitter: / patloeber
GitHub: github.com/patrickloeber
Music: www.bensound.com/
Photo by Jakob Owens on: unsplash.com/photos/l82NzBSYbj0
#Python
----------------------------------------------------------------------------------------------------------
* This is a sponsored or an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏

Опубликовано:

 

5 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 86   
@yuvrajsingh-gm6zk
@yuvrajsingh-gm6zk 4 месяца назад
As a video editor who is now a coding wannabe, this is pure gold man!!
@thedebapriyakar
@thedebapriyakar 3 года назад
Straight to the point and just mind blowingly well explained.
@patloeber
@patloeber 3 года назад
glad you like it!
@brendensong8000
@brendensong8000 2 года назад
Thank you for sharing this! Love all your video! It's very informative!!!
@markusbuchholz3518
@markusbuchholz3518 3 года назад
Hello Patrick, there are some but not so many YT channels which are prepared so outstanding like your. The effort and performance you deliver are remarkable, brilliant and impressive. You cover all the latest SW technologies and share your passion. Keep fingers for your goals.
@patloeber
@patloeber 3 года назад
Thanks so much for the kind words Markus!
@markusbuchholz3518
@markusbuchholz3518 3 года назад
@@patloeber Good luck!
@rajukani100
@rajukani100 3 года назад
That's it i looking for. Awesome Bro !
@patloeber
@patloeber 3 года назад
Thank you!
@ThorstenMueller
@ThorstenMueller Год назад
I just found your channel. Great and really helpful content, thanks for providing it 🙂. Subscribed directly, of course.
@terraflops
@terraflops 3 года назад
this is so cool! Python can do so many things. Happy to know Python can edit videos and audio. Thanks!
@patloeber
@patloeber 3 года назад
Glad you like it
@sikkavilla3996
@sikkavilla3996 3 года назад
this channel deserves more subscribers
@patloeber
@patloeber 3 года назад
thanks :)
@saralgyaan
@saralgyaan 2 года назад
It's very helpful video, will be trying it for sure.
@quagmirev252
@quagmirev252 Год назад
Hey, Nice work! Really helpful for me :D i really want to thank you for the help!
@vegaarcturus509
@vegaarcturus509 Год назад
Very useful for Minecraft ASMR mining blocks and putting blocks. I know that this is applicable in a lot of situations
@jrnpaulsen9926
@jrnpaulsen9926 Год назад
I've been thinking of doing something similar myself, but I'm trying to find a more efficient method for the manual work (in Audacity). One method could be to just use the label-function in Audacity, then find a way to extract/export all of the label-data (from/to/labelname). Another (more basic) improvement to the current workflow could be to link a hotkey to a script that adds track-selection start/end-time to the clipboard. Anyways, great video! There's so many tasks that (in large parts) can be be automated :)
@Micetticat
@Micetticat 3 года назад
I found your great tutorial because I was thinking how convenient would be to have a way to edit videos using code for some workflows.
@abhimanyunegi4382
@abhimanyunegi4382 3 года назад
Loved it Wass willing to make it myself, but you made it easier....👌👌👌
@patloeber
@patloeber 3 года назад
Thanks :)
@abhimanyunegi4382
@abhimanyunegi4382 3 года назад
@@patloeber Welcome ;)
@shantanudhiman5263
@shantanudhiman5263 2 года назад
I mean wow, this is better than any video editor, freaking awesome....!!!!!!!!!!!!!!!!!!!!!
@patloeber
@patloeber 2 года назад
yeah it's cool :)
@JuanGabrielOyolaCardona
@JuanGabrielOyolaCardona 2 года назад
Thanks for the great content. Thanks for sharing 😃🇨🇴
@kamel3d
@kamel3d Год назад
is there a library to visualise all of this I mean to give it a visual interface like in classic editing software?
@CodeWithTomi
@CodeWithTomi 3 года назад
This is a great tutorial..
@patloeber
@patloeber 3 года назад
Thanks :)
@todologic
@todologic 2 года назад
Great info!
@patloeber
@patloeber 2 года назад
Glad it was helpful!
@WebStacks500
@WebStacks500 8 месяцев назад
Thank You, now I'm gonna go and make a Video Editor in python with GUI - Quite a bit of work :)
@LanaDominkovic
@LanaDominkovic 2 года назад
Awesome, didnt even think about this possibility! Maybe I try to edit videos with Python :D
@patloeber
@patloeber 2 года назад
Go for it!
@brandonallen2301
@brandonallen2301 2 года назад
Came for the video editing tips. Reminded me that I majored in deep learning, lol
@CustAndCode
@CustAndCode Год назад
pretty nice! 🤗
@hishamsomroz6913
@hishamsomroz6913 3 года назад
Great man
@EveryLastdrop-tw6rg
@EveryLastdrop-tw6rg Месяц назад
you can actually just open your videos in audacity by the way, but that code is awesome thank you for showing
@SerapioSergiovich
@SerapioSergiovich Месяц назад
Nice video shows methods to create a business..
@hoclaptrinh882
@hoclaptrinh882 3 года назад
Amazing!
@patloeber
@patloeber 3 года назад
thanks!
@oneeyedphotographer
@oneeyedphotographer 3 месяца назад
I might use this approach to add a standard preamble, to trim dead space to make the video fit the target duration (good for YT #shorts), add a trailer for the next episode as required. I think a standard GUI editor would be my go to for normal work. If I'm talking, make an error and reshoot that segment, this isn't going to handle it well. Similar if I record an interview, it might take an hour of shooting but need to be condensed to 15 minutes. Python can probably be made to drive Premiere Pro too, it can drive Photoshop.
@saurrav3801
@saurrav3801 3 года назад
Nice video bro 🤙🤙
@patloeber
@patloeber 3 года назад
thanks!
@christiangeng6070
@christiangeng6070 2 года назад
Thanks for the lovely video! I have one question not directly related to the content presented, but as you are demoing your screencasts I think this is still relevant: How are you recording your screencasts - before cutting them? For me especially relevant would be appropriate command line switches for ffmgeg under Linux.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 года назад
I have only done screen grabbing on Linux under X11. On Wayland, things will be different. I once did a capture of a 1280×720 region using a command like ffmpeg -f x11grab -video_size 1280:720 -framerate 25 -i :0.0+«offset» -vcodec png «dir»/frame%04d.png
@JJSeattle
@JJSeattle 2 года назад
Ahahha okay, that was a funny disclaimer, "I don't use it myself for my RU-vid videos, but you could." Ahahahaha that just tickled me.
@rachit6099
@rachit6099 3 года назад
Thankyou so much :)
@patloeber
@patloeber 3 года назад
thanks!
@wassyppp
@wassyppp 2 года назад
Great video! Is there a way to play the video and save the cuts by pressing a button (start/stop). Then just running this function. Thanks
@RozBizMedia
@RozBizMedia 10 месяцев назад
DUDE, I was wondering if this was possible :)
@lukajeliciclux3074
@lukajeliciclux3074 3 года назад
@PythonEngineer do I see Tech with Tim and Corey Schafer in your subscription. 😃
@patloeber
@patloeber 3 года назад
Yes 😄
@efiratoglu
@efiratoglu Месяц назад
Great video about MoviePy. But I really wonder how you were planning to define silent parts of a video to extract automaticaly. Would you please drop a few lines about the algorithm of that? TBH, I could not find the command to analyze the sound level in an audio clip to create croppin time stamps and that would be more than enough... Many thanks again for that great tutorial!
@ClashBaseDeveloper
@ClashBaseDeveloper 10 месяцев назад
This is insane
@muhammad_talha
@muhammad_talha 3 года назад
thanks
@azarmahmood1421
@azarmahmood1421 2 года назад
Hi with python pillow can it improve the video image quality or is it just pictures it does thankyou
@narendrarao5989
@narendrarao5989 2 года назад
i want to add an audio test.mp3 of 2 secs to a video file of test.mp4 of 15 secs at multiple places like at 4th, 8 th , 12 th. what would be the approach?
@GoodBoyDanny
@GoodBoyDanny 3 года назад
I want to add a looping gif over music with out making a million cuts. Is that possible?
@abuazfaar3662
@abuazfaar3662 3 года назад
Beautiful 👍. Hey, I have some questions. Where do I reach out to you?
@patloeber
@patloeber 3 года назад
RU-vid or Discord
@seanivore
@seanivore 8 месяцев назад
I have a database of images and text and can't find a no-code bulk automator for making video shorts. Canva came out with one but you can't change the background. I've never used code... will this be too hard for me???
@futuremaxxed
@futuremaxxed 2 года назад
Can we add an audio file that plays when with text overlay
@errorhostnotfound1165
@errorhostnotfound1165 3 года назад
--I'm not sure why __name__ is italicized and missing an _ on the right and left side in this comment, but I didn't write it like that. --What does if __name__ == '__main__': edit_video(loadtitle, savetitle, cuts) --do? --What is "libx264"? Does the video have to be ".mov" to ".mp4" or can it be ".mp4" to ".mp4"? Videoquality is "24", what happens if I increase/decrease that number? Instead of having title separate from loadtitle and savetitle, could I have loadtitle and savetitle be paths? What are cut[0] and cut[1] in for cut in cuts: clip = video.subclip(cut[0], cut[1]) clips.append(clip) --? Are they individual cuts or are they start of a number of cuts? If I have cuts = [('00:01:00.00', '00:00:02.00'), ('00:00:05.00', 00:00:07.00')] is it for cut in cuts: clip = video.subclip(cut[0], cut[4]) clips.append(clip) --or for cut in cuts: clip = video.subclip(cut[0], cut[1], cut[3], cut[4]) clips.append(clip) --? Also, I haven't been able to run it fully yet, but it seems that for Windows txt = mpy.TextClip('Please Subscribe!', font='Courier') fontsize=120, color='white', bg_color='gray35' txt = txt.set_position(('center', 0.6), relative=True) txt = txt.set_start((0, 3)) # (min, s) txt = txt.set_duration(4) txt = txt.crossfadein(0.5) txt = txt.crossfadeout(0.5) ... final_clip.write_videofile(savetitle, threads=4, fps=24) codec=vcodec, preset=compression, ffmpeg_params=["-crf", videoquality]) --needs to be rewritten as txt = mpy.TextClip('Please Subscribe!', font='Courier') txt = txt.mpy.TextClip(fontsize=120, color='white', bg_color='gray35') txt = txt.set_position(('center', 0.6), relative=True) txt = txt.set_start((0, 3)) # (min, s) txt = txt.set_duration(4) txt = txt.crossfadein(0.5) txt = txt.crossfadeout(0.5) ... final_clip.write_videofile(savetitle, threads=4, fps=24, codec=vcodec, preset=compression, ffmpeg_params=["-crf", videoquality]) --to avoid an unexpected indent error.
@user-yz8yn4zc2i
@user-yz8yn4zc2i 3 года назад
Hi, I'm a student. I want to know how to clip the photos into a vedio with python like a function of the photo album and add some special effects when a photo changes. Thank you for your replying.
@yusun5722
@yusun5722 3 года назад
There might be a simpler way, but at least you can save the video frames as images, embed the photo to the correpsonding images and export the video.
@Kig_Ama
@Kig_Ama 3 года назад
How do we know the cut times? What if we have so many cut times? I am not sure, whether this works for my purpose.
@patloeber
@patloeber 3 года назад
Yes as I said, it is not suited for every workflow. You have to select the cut times manually by going through the video or audio line
@Kig_Ama
@Kig_Ama 3 года назад
@@patloeber true, ty. May be in future there will be an AI that decides this for u.🙃
@patloeber
@patloeber 3 года назад
@@Kig_Ama Yes, I think this is already possible (even without AI just by analyzing the sound intensity). But for my own recordings this task is more difficult because sometimes I don't talk but still write code on the screen. It's hard to detect this...
@Kig_Ama
@Kig_Ama 3 года назад
@@patloeber Amazing!
@todologic
@todologic 2 года назад
I saw that Davinci Resolve has Python Scripting support. Have you tried it?
@patloeber
@patloeber 2 года назад
no I haven't but that's interesting
@todologic
@todologic 2 года назад
@@patloeber Would be nice for a video perhaps? ;).
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 года назад
I did a quick search, and it seems it has trouble with newer versions of Python.
@todologic
@todologic 2 года назад
@@lawrencedoliveiro9104 oh. Pitty…
@todologic
@todologic 2 года назад
Out of curiosity, why did you stop using this method and what software do you use otherwise?. Thanks.
@patloeber
@patloeber 2 года назад
It's not super convenient and limited in the features. You cannot do fancy video transitions or something. I switched to Davinci Resolve afterwards
@todologic
@todologic 2 года назад
@@patloeber thanks for the info. The problem that I have is that I can not find a good video editor that is parametric. I know you can use JS with Premiere, but it is limited.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 2 года назад
There is also “melt”, which uses the MLT framework. You can drive that via an XML control file.
@AbdifatahNadir-fk7lc
@AbdifatahNadir-fk7lc 11 месяцев назад
Python is Every Think
@-raiwzo
@-raiwzo 2 года назад
Guys don't you feel weird while editing on python, I mean there should be a GUI there no ?
@matthewpaquette
@matthewpaquette 2 года назад
cool. but like... nooooooo
@suretmeyenateistoc4252
@suretmeyenateistoc4252 2 года назад
ı'cant see ui? but nice click bait
@SerapioSergiovich
@SerapioSergiovich Месяц назад
Nice video shows methods to create a business..
Далее
Making Automatic YouTube videos with Python
7:32
Просмотров 177 тыс.
Split Screen Videos with MoviePy
7:32
Просмотров 11 тыс.
Впервые дал другу машину…
00:57
НУБ ИЩЕТ ЖЕНУ В GTA SAMP
22:34
Просмотров 242 тыс.
КРУТОЙ ФОКУС С ШАРАМИ
00:35
Просмотров 417 тыс.
This video was made with code. But how?
8:42
Просмотров 711 тыс.
Automate your job with Python
6:07
Просмотров 374 тыс.
Video Data Processing with Python and OpenCV
32:05
Просмотров 68 тыс.
Automated Video Editing with MoviePy in Python
14:07
Просмотров 98 тыс.
Coding An Automated YouTube Channel!
13:59
Просмотров 109 тыс.
How I make science animations
43:39
Просмотров 696 тыс.