8 ms·
Video editing with Python
- bob_theslob646 9y agoIf anyone wants to read the docs , here is a direct link >http://zulko.github.io/moviepy/ http://zulko.github.io/moviepy/
- rebuilder 9y agoThe docs do appear to be somewhat incomplete, though, there's functionality used in the examples that the docs otherwise don't seem to mention even exists.
- Miredly 9y agoI've used Moviepy fairly extensively in a recent project and yes, the docs are incomplete. I've had to resort to actually reading the source code to figure out why, for example, my argument was being ignored. I still have some unresolved (though seemingly obscure) issues with transparency, and my question to the moviepy subreddit went unanswered.
- m45t3r 9y agoIt seems similar to Vapoursynth: http://www.vapoursynth.com/ http://www.vapoursynth.com/ AFAIK, Vapoursynth is more powerful thanks to its module system, however the ability to integrate with IPython notebooks of MoviePy seems nice.
- ageofwant 9y agoI have this notion that in time, as people's general comfort level interacting with computers and advanced computing platforms like Python become rote. That computer interfaces will be more REPL like, and less application, or GUI like. That the principle of general computing will be applicable at interaction level, not application level, if you will. Future users may consider today's restrictive GUI interfaces as quaint anachronism of the stupid ages.
- Miredly 9y agoHow much video/audio editing have you done?
- Santosh83 9y agoGood point, but I tend to believe that no one kind of user interface can ever be complete, so the best kinds of programs will support multiple interfaces that can be used with people with varying levels of skills and familiarity, to accomplish the program's tasks. Point and click GUIs will always have their place for those who have very little or no familiarity with software concepts.
- JoeAltmaier 9y agoNonsense. Point and click is useful for anyone who uses a tool infrequently and wants to make progress without resorting to a manual. Honestly the average app is not so complex its fundamentals cannot be represented as point-and-click. Its partly ego that keeps people on command lines. As expressed in that comment, which has a vibe of chest-beating.
- Kudos 9y agoIf a task seems straightforward I will likely apply my past experiences with any similar task, and skip any provided manual until I become unsure or hit an obstacle. This is how normal people approach computing devices.
- gt_ 9y agoThis is more or less the ongoing wider state of 3D software. There’s a pile of exceptions to every rule around each corner. If anything, coding has become less important as better software design evolves.
- ethbro 9y agoWe were going that route, and then I'd say Windows' and Mac's market acceptance proved otherwise. I think the argument might there for interfaces to scale more fluidly from GUI to text (e.g. every GUI command is text mapped and shows you). But the on ramp to text is too difficult for new users...
- debt 9y agoVideo editing apis are a pretty neat way to edit video. Apple provides a nice set of apis to achieve this as well: https://developer.apple.com/documentation/avfoundation/avmutablecomposition https://developer.apple.com/documentation/avfoundation/avmut...
- mncharity 9y agoA few years ago I used moviepy to make the animated user-test videos in [1]. The idea was to create science education videos using a software-like process of iterative development and guerrilla street usability testing. Traditional science education videos are created by sort of a waterfall process. Throw the script/footage/video over the wall, and just hope it kind of works when it hits users. But it seems this usually doesn't work - prolifically creating misconceptions, while failing to provide transferable understanding. Ok for a "motivational speaker" role, but not for a "tutor". Someone at a leading educational video shop once told me 'sure, it would be great to make user testing part of our development - just as soon as we find anyone willing to fund that'. Regrettably, my videos didn't user test well. The exercise didn't converge, and was abandoned. I had envisioned an incremental process, of informal testing for appeal, understanding and misconceptions, while improving clarity of explanation. Instead, what I found was a minefield. Bacteria and viruses get bad press, so for some "a fun story about bacteria!" has the emotion tone of "a fun story about genocide!". An elderly British gentleman was distressed by the mention of "millimeters", which brought back unhappy memories of learning metric as a child. An MIT student was disturbed by the viscerals of breaking off the head of a T4 phage (zoomed to chicken-size). Someone ran away exclaiming "how could you show me something so disgusting?!", for reasons unknown, but perhaps from having not understood anything, and thus seeing a pile of E.coli, as a pile of poo. Lot's of "oh my, I certainly didn't anticipate that failure mode". And this wasn't long-tail variance - I wasn't testing enough to see any. This kind of nonlinearity seemed common case. I also hit some newby with "insufficient domain expertise on tap" mistakes, like underestimating the interference effects between spoken and written input - having a character speaking visible text works startlingly poorly. I wrapped moviepy in a framework to create lots of minor variants for testing... class NovX4 (FilmCommon2): default_shots = 'context','question','realsize','zooming','views','playset','buildings','measure','stories' question_shots = 'question_how','question_sizes','question_planets','question_atoms' with the animations timed to recorded speech (the computer voices I had available didn't test well)... "How can you remember, the sizes of small things?" question_how_script = aka(am18.HowCanYouRemember) question_sizes_script = aka(am18.TheSizesOfThings) and animation code sharing using inheritance and mixins and injection and ... class NovX6 (NovX4): def question_sizes_frame (self,t,d): ca = self.setup_table() ca.teacher().draw() ca.side_table() ca.room.mv(.2,.55).gs().otp().rotate(.2).draw_milli(image_of_book_life_size_zoo).gr() ca.room.mv(.0,.3).gs().otp().rotate(.4).draw_milli(image_of_pizza_slice).gr() if t > d * .5: ca.room.mv(.3,.4).gs().otp().rotate(-.2).draw_milli(image_of_walking_cat).gr() self.teardown() Doing programmatic video production had some nice properties, vis a traditional video animation pipeline. It was easier to revise past decisions, to support a set of active and evolving tests, and thus to explore possibility space. Without my being a "redraw this scene for the tenth time this morning" magically-fast skilled animation artist. But some things would have been much easier with a normal direct-manipulation UI. And there was a slippery slope of reinventing wheels ("oh, I guess I need to add feature X to the character rigging to get that effect :("). If I were starting on it today, years later... I'd likely use python and Blender instead. For the ecosystem. I was pushing moviepy well outside its normal use case. [1] The stick-figure videos, in the top How to remember sizes section, of the slowly-loading wasn't-intended-to-be-public page http://www.clarifyscience.info/part/Atoms http://www.clarifyscience.info/part/Atoms .
- soegaard 9y agoDon’t forget to check Leif Andersen’s video language https://lang.video/ It is a Racket language for editing videos. Quite handy when you need to edit many, similar conference videos.
- baldfat 9y agoI love this tool and just started using it. If this did DNxHD codec transcoding I would love it forever. I need to ask and look to see if this is possible to add. When you edit videos you SHOULD transcode your videos into a format that actually uses one image per frame (DNxHD or PreRes (On Mac)) and than then deliver it back into a compressed format like H.264.
- unicornporn 9y ago> When you edit videos you SHOULD transcode your videos into a format that actually uses one image per frame (DNxHD or PreRes (On Mac)) and than then deliver it back into a compressed format like H.264. Yes, you should transcode your videos to an intra-frame codec (i use ProRes at 540p). But (and this is important), this is only a proxy format. When you export your creation the video editor should automatically use the original files for rendering. Premiere this very well nowadays[1]. [1] https://helpx.adobe.com/premiere-pro/how-to/proxy-media.html https://helpx.adobe.com/premiere-pro/how-to/proxy-media.html
- baldfat 9y agoIf you have a H.264 (non-intraframed) and it is playing back in preview fine I try to just use that instead most of the time. ProRes 540p is HUGE. Are you working with 4k? If not I would knock that down. Apple ProRes 422 is only 147 Mbs. https://www.premiumbeat.com/blog/5-things-you-should-know-about-prores/ https://www.premiumbeat.com/blog/5-things-you-should-know-ab...
- unicornporn 9y ago> ProRes 540p is HUGE. 540p means 540 pixels on the short side (height). That is very low res and they're not big. > Are you working with 4k? Very close, UHD resolution.
- minimaxir 9y agoA few months ago I used MoviePy to create animated Magic: the Gathering cards (HN discussion: https://news.ycombinator.com/item?id=15449955 https://news.ycombinator.com/item?id=15449955 , technical writeup: http://minimaxir.com/2017/11/magic-the-gifening/ http://minimaxir.com/2017/11/magic-the-gifening/) Even though MoviePy is an "older" library (original HN discussion from back in 2014: https://news.ycombinator.com/item?id=7121104 https://news.ycombinator.com/item?id=7121104), it still works pretty well, although you may have to fuss around with the low-level FFMPEG settings to get what you want. I'm surprised that there hasn't been more usage of MoviePy actually.
- rayalez 9y agoI've recently learned that 3blue1brown's [1] videos are generated with python: https://github.com/3b1b/manim https://github.com/3b1b/manim [1] https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw
- makmanalp 9y agoI've actually played around with this a bit and it was surprisingly pleasant to use even with all the "beta software" warnings
- lanewinfield 9y agoI use this for my Freeze Frame Bot (and many others). MoviePy is super powerful and love playing with it. http://twitter.com/freezeframebot http://twitter.com/freezeframebot
- justswim 9y agoI'm the CTO at Kapwing (https://www.kapwing.com https://www.kapwing.com), where we use MoviePy for all of our products (all of which help users edit video online). Sometimes the documentation has been enigmatic but overall the library has made it really easy to create a video processing backend without having to dive deeply into combining ImageMagick and FFMPEG at a low level. Funny enough, MoviePy makes it so easy to edit videos that we also use it to edit images. But the way it works is when a user uploads an image, we convert the image into a video format, edit it with MoviePy, then convert it back into an image. A little inefficient, but it works better for us than writing a completely different branch of code to handle images. Having worked with MoviePy for a while my main ideas for improvement would be: 1) Create a callback for video editing progress so that it could be outputted to the frontend, etc, 2) Make predefined transitions - currently transitions need to be manually calculated, would be nice to have smarter presets to make it easier to create something like a slideshow, 3) improve threading over multiple CPUs - not sure how possible it would be for the library itself to handle this but from our initial tests ffmpeg by itself seems to handle threading more effectively
- blt 9y agoThis looks cool. I am planning to write some tools for semi-automated processing of a video dataset soon. Are there any other strong alternatives to this library that I should consider? Am OK with any language. An example task: automatically detect cuts between different shots with high sensitivity, e.g. many false positives, show the user a clip of +/- 2 seconds around each proposed cut, user presses a key to confirm/deny that it's actually a cut.
- Miredly 9y agoIt seems to me like what you're trying to do is analyze video, while Moviepy is mostly really good at programatic editing. Have you looked in to OpenCV?
- blt 9y agoYeah I would detect the cuts with something else. I just need the library to read/write video files, display them on screen, etc.
- dimatura 9y agoI've used moviepy quite a lot and even submitted a PR or two. It's not perfect, and docs aren't super up to date. For many tasks a good nonlinear editor is way easier. BUT, it also makes some tasks really easy that seem surprisingly complex to do with (the admittedly simple) GUI tools I've tried. E.g. making a 3x3 montage of videos playing simultaneously, with a caption beneath each.
- 153957 9y agoRecently I discovered ffmpeg-python [1], also a nice Python frontend to FFmpeg. One of its best features is being able to show nice graphs [2] showing where which filters are applied from in to output. And all FFmpeg filters can be used, it is a thin layer over FFmpeg, just much more readable. [1] https://github.com/kkroening/ffmpeg-python https://github.com/kkroening/ffmpeg-python [2] https://github.com/kkroening/ffmpeg-python#complex-filter-graphs https://github.com/kkroening/ffmpeg-python#complex-filter-gr...
- z_open 9y agoI think I'll just use this. I often need to cut up videos and I've found that using linux's video editing tools are horrendous. Even using ffmpeg from the command line doesn't work out due to its horrendous tolerance for choosing start and end points.
- marttt 9y agoIs there anything similar for non-destructive audio production except for Ecasound [1], Nama [2], Csound or SoX? There was an interesting paper about SPED, a sound file editor [3], but I'm afraid this was just a proposal. And AudioRegent [4], and a few links, somewhere, to using makefiles in audio production, but I've lost track on these. A quote from the SPED paper: "The editor should be usable without graphical user interface or it should not make any assumptions about it. This feature may seem strange if we think of the modern computer based editing systems which basically always have some kind of graphical user interface. On the other hand when comparing to analogue tape splicing one might ask how mandatory the graphical user interface really is." I've been thinking that a CLI audio editor (slicer, re-organizer) with a syntax similar to ed or sam [5] would be cool to experiment with. Imagine a CLI non-destructive digital audio editor built on top of a RPi or similar, running headless, only needing a tiny conrtol panel with a few buttons; maybe hooked to a tiny e-ink display for emergencies. (Yep, love sound editing; tired of screens or laptops in bags. I would love an "iPod Nano of non-destructive digital audio editing", but I am not the man to build one myself.) 1: http://nosignal.fi/ecasound/ http://nosignal.fi/ecasound/ 2: https://freeshell.de/~bolangi/nama https://freeshell.de/~bolangi/nama 3: https://tinyurl.com/y9s8mgme https://tinyurl.com/y9s8mgme [pdf] 4: http://journal.code4lib.org/articles/2882 http://journal.code4lib.org/articles/2882 5: http://doc.cat-v.org/plan_9/4th_edition/papers/sam/ http://doc.cat-v.org/plan_9/4th_edition/papers/sam/