ChatGPT changed how I work in After Effects FOREVER

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥

👍︎︎ 2 👤︎︎ u/hyper_brew 📅︎︎ Mar 22 2023 🗫︎ replies
Captions
I just used a brand new tool to get chat GPT to write me three actually useful After Effects scripts and I didn't even have to leave after effects to do it prior to this video I had absolutely zero experience with scripting in After Effects so this is absolutely something that you can do even if you've never touched scripting yourself and these aren't just basic scripts that you have to run from the file menu no they're actual script UI panels that you can dock into the after effects workspace and access at any time I even converted them into kbar versions with custom icons and I'm going to make all of it available to download so stick around to the end of the video to find out how you can get them in this video I'm going to walk you through the process of how I made all three of these scripts using chat GPT and all the little tips and tricks that I picked up along the way so if you've ever thought to yourself I wish there was a way to do this in After Effects this is the video for you there's so much that I want to talk about in this video but first let me just tell you what the three scripts do the first one is called sequence layers better and it allows you to sequence any selected layers by a set number of frames that you type in regardless of how long the layers are and that's really the feature that after effects is missing if you want to do this manually the second script is called reverse layer order and it does exactly what you might think reverses the indexing order of whatever layers you have selected keeping them in the same relative place in the layer stack and the third script is called make a line and it's very simple but really useful it just generates a single path lined and a slider control to determine how long that line should be if those sound useful to you do me a favor and like this video And subscribe if you're not already now let's talk about how I used chat GPT directly in After Effects to make these three scripts now I'm sure we've all seen Nick's video over at motion by Nick where he uses chat GPT to write scripts and expressions to make some really impressive tools and Time Savers inside of after effects if you haven't seen it yet go check the link in the description so you can watch Nick's video but just to get you up to speed chat GPT is an AI chat bot that's actually capable of coding for you the reason it can do this is because it was trained on lots of different coding languages including JavaScript which is what we need for scripting in After Effects and expressions now the code that chatgpt writes is not usually very reliable and almost always has errors but you can really push it and try and refine it to get it to fix the errors and give you code that actually works and after watching Nick go back and forth with the AI ending up with three working scripts I want it in is this what being a developer is like as I was experimenting with tragedy PT to make some of my own scripts my boss Adam who literally writes After Effects scripts for a living told me about a little tool that was in beta that allows you to use chat GPT to write scripts and expressions directly in After Effects the next day Klutz GPT was released and that's when everything changed for me Klutz GPT is an After Effects extension that allows you to link your open AI account in chat with the AI directly in an after effects panel but it's streamlined specifically for writing scripts and expressions for after what this means is that I can click a button to start writing a prompt specifically for script writing in After Effects tell the AI what I want to do and immediately test that code without any copying pasting or any other kind of setup now Klutz GPT isn't the AI itself it's just linking to open ai's chat GPT so it's the same version of the AI that you would get on the web version of chat GPT but klutzgpt is able to identify errors so if you get an error when you run a script it's going to automatically copy that error and start writing your next response to the AI letting it know what happened which is a huge Time Saver and this works for Expressions as well although just like Nick I had much less success getting chat GPT to actually write expressions versus writing scripts which probably has to do with the body of knowledge that there is for the AI to train on for JavaScript versus just expressions in After Effects clutch GPD even supports multiple chats and contains them all in a little sidebar so you can easily start a new chat test out a new prompt and then go back to an older one at any point and at this point you're probably wondering if this is a sponsored video from hyperbrew who makes Klutz GPT and that is not the case at all I just love this tool it's actually a pay what you want script so if you want to try it out for yourself for free you can go do that the link is in the description but I want to strongly encourage you to support the developer and pay price that you think is fair for the amount of use you're going to get out of this tool so let's make a script the way that I started was by trying to think of a time when I was working in After Effects and had a thought something like there should be a way to do this automatically or I wish this was part of after effects if a script or third-party tool doesn't already exist for the idea you had it could be a great candidate for klutzgpt the first idea I had was a script that would sequence layers based on a number of frames that you select now you can do this manually but it takes a lot of extra work you have to trim your layers to be the length that you want them to be sequenced by then you have to find the menu command sequence the layers and then re-extend all the out points back to where they should be so lots of Little Steps between one ear layer sequenced and having your layer sequenced I wanted something that would sequence my layers regardless of how long the layers were were so I clicked the script prompt starter button in clutchgpt and ask the AI to write a script for after effects to sequence the selected layers based on the order they're selected in by a number of frames determined by the user include an undo group and this is my first tip for writing scripts with AI tell it to use an undo group an undo group is code that wraps around other parts of your code that lets After Effects know how far back something should be undone when you undo if you don't use an undo group getting back to where you were before the script Rand could take a while pressing undo over and over again almost immediately Klutz GPT wrote up a script to sequence my layers complete with descriptive comments explaining what every part of the script was doing thanks to the script prompt starter text I click the Run script button and an alert window opened up asking for the number of frames to sequence the layers by I typed in a number clicked OK and my layers were sequenced that blew my mind I didn't write any code or even leave after effects and now I had a magic button that did something that I imagined now it wasn't working perfectly the first layer in the sequence also was offset by the number of frames that I typed in and it always sequenced the layers from top to bottom it didn't matter what order I selected them in so I jumped back into the chat and let the AI know what was going on that's working but not perfectly the first layer is being offset by the number of frames input by the user could you rewrite the script so that the layer selected first remains where it is and all the other layers sequenced after it didn't even write that very well but the AI is smart enough to guess what I meant and it immediately gave me another version of the script and the first layer was no longer being offset by that amount but there was still the issue of the layers always being sequenced from top to bottom so I said that's working better but it's not taking the order of the layers were selected into account the AI was extremely polite and that made me want to be polite which is the opposite of what computers usually make me want to do this felt like I was actually talking to somebody who knew what they were doing almost like a support chat except they weren't trying to stop me from canceling a subscription but even though they were polite about it the updated script wasn't working at all so I tried a different approach and I said that's not working instead of each layer being offset by the number of frames input by the users each subsequent layer is sequenced exponentially I chose my words poorly here Not only was that not really a request it wasn't even what I meant exponentially isn't the word that I should have been using here so this is less of a tip and more just common sense but when you're talking to AI don't use words that you don't understand yourself I decided to pretend that that last revision wasn't my fault and said that's still not working rewrite the script so that each layer is sequenced by the number of frames determined by the user and now I think it just completely confused the AI each new prompt and response build off everything that came before it so even though I'm asking for specific things it's still taking into account the things that I probably shouldn't have asked for in the first place like exponentially sequencing the layers so at this point I just decided to start over open a new chat and try again I copied and pasted my initial prompt back into the chat hoping that I could get back to a point where I could work on one issue at a time and wouldn't you know it there were no issues this time the script was behaving exactly how I wanted it to right off the bat layers were sequenced by the number of frames I set it to the first layer wasn't offsetting from its original place in time and the sequencing was based on the order the lay players were selected in so here's my next tip don't be afraid to start over sometimes the AI just isn't working and asking it to change things over and over again just won't get you anywhere now I'm not saying that feeding the same prompt into a new chat is just going to magically work every time and give you exactly what you want but you might get lucky sometimes the fact is starting two different chats with the same prompt are going to give you different results so don't be afraid to start over next I ask for the default sequence value to be one frame that was an easy one for the AI it didn't have any problems making that change then I wondered if the UI of the alert panel could match After Effects and a few things happened the first one was an issue I got my first script error and this is one of Klutz gpt's major benefits it automatically copied and pasted that error into the chat so I didn't have to put in any extra effort to tell the AI that something went wrong but before I hit reply I noticed that the UI of that panel did match the UI of After Effects I tested out the functionality and it still worked great so I modified the response a little bit before sending it off with the updated code I still got the same error so I tried again this went back and forth a few times before I decided to try and look at the code myself and see what I could figure out to do this I used Microsoft's Visual Studio code which is a far more advanced code editor than I'll ever need but it makes looking at and editing this JavaScript much easier I tried my best to see what was causing the error but realized I should just go back to the code that was working and ask chatgbt for something else a UI panel for the script that I could dock into after effects that way it would automatically adopt all of the UI settings from After Effects interface and Adam told me that he'd be seriously impressed if the AI could pull off a script UI panel because all the code that you need to make those is really complicated and doesn't make a lot of sense so Klutz GPT can you make that script A UI panel it sure seems like it now script UI panel can't be run like a normal script at least not if you want it to be dockable so I had to save this as a jsx file and install it into the script uis panel for the version of After Effects I was using then restart After Effects and find it under the window menu now the panel wasn't working I was getting all kinds of errors the panel itself was completely emptied I tried for a while to compare one version of the code to another attempting to blindly fix the issue without having any idea what I was looking at and eventually tried to take a different approach which is my next tip ask chatgpt to teach you things the biggest issue I had with the current version of the script was that nothing was displaying inside of the panel and I didn't know why so I asked chatgpt how would you write an After Effects script UI panel with a button inside of it I figured if I had the framework of an After Effects UI panel I could try to piece together the code from what was working into the code that gives me a working panel this approach worked perfectly it gave me much simpler code that I could digest a little bit more easily to see the structure of a script UI panel for After Effects now like I said I have no prior scripting knowledge but I do know a fair amount about expressions and expressions are JavaScript it's just that scripting can be much more complex and do actual tasks within After Effects instead of just change a property that you're applying an expression to so I was able to at least halfway understand what I was looking at while dissecting that script UI panel code and because I was reading all those helpful descriptive comments between lines of code that the AI was generating I started to realize that I was learning how scripting works just by asking the AI to teach me instead of having to go to Google and trying to search for something where somebody else was doing the same thing that I'm trying to do now I can just in plain English ask the AI to teach me how to do what I'm trying to do and with klutzgpt I don't even have to leave after effects to do that now that I was starting to understand the structure of the panel I was able to take the script function and place it into the panel where it needed to be so that it would actually display properly and still function the way I wanted it to and that's my next tip instead of trying to do everything in one single chat open up multiple chats and work on one problem at a time if you have a script doing what you want in the way that you want it to be done don't keep asking the AI to change things about it in my case it was taking a usable script and turning it into a UI panel for you it might be something else like adding an extra feature to the script at that point save your code so you don't lose it and open up a new chat ask the AI to generate a script for that next feature and then see if you can piece the two together I don't know this for sure but I think that keeping these chats separate will help the AI stay focused on the specific task that you're trying to accomplish after lots of experimenting I ended up with a doggable script UI panel with a custom layout that did what I asked it to in the way that I expected and I was even able to add some extra features to the interface like this little about button where I could explain how the script was created and just like that I had my first working custom dockable script UI panel for After Effects almost entirely generated by AI at this point I was pretty confident that I could use AI to take an idea I have and turn it into an actual script and now that I had a decent process figured out I tried making a couple more the next thing I wanted to be able to do was reverse the order of layers that you have selected and I know that's not that hard to do manually you have to just select the layers cut and paste no wait I have to select them in the opposite order cut paste okay there we go can you see why I wanted a script for this it's not that difficult to do but I somehow managed to do it wrong basically every time so I followed my own tips with this one I asked the AI to make a script that reverses the order of the selected layers and I got an error I sent that error right back through klutzgpt another error now it was rearranging the layers but in a completely random order error error nothing happens this time error all right time to try again error error error wait it's actually working though can you fix it it works I don't think I really need that alert this is working perfectly can we keep the reordered layers selected but can you keep the reordered layers before or after the layers around them the error error error oh that's a new one this was the first time I ran into this issue what seems to be going on is that within Klutz GPT or anything that's accessing chat jbt's API there's a limit to the amount of characters that can be in a chat and I had just reached that limit the way I got around this was by copying the latest version of the code starting a new chat and asking klutzgpt to modify that code I also noticed that sometimes the AI didn't realize I was writing a script for After Effects so it's a good idea to say something like can you modify this after effects script before you paste in the code with the new chat and the latest code we were back to iterating after one back and forth the script was working perfectly just for fun I decided to push my luck and ask for a UI panel version of the script and wouldn't you know it that's exactly what I got zero issues I got to a working script much faster the second time around so I decided to go for one more and my next few ideas didn't really pan out the ideas that I had weren't even really that good but eventually I came up with an idea for a single line generator which is something that is surprisingly difficult to do in After Effects if you want to be perfectly centered and easily controllable just like having a primitive rectangle or an ellipse with specific controls for that type of shape I want to have a single line that's centered in my comp with a simple slider that allows me to control the length and a stroke applied so that's exactly what I asked for and this took a while to get working but through this process I not only got a working script but I learned how to draw paths with scripting and how to control them with Expressions two things that I did not know how to do before I tried to make this script the script was drawing a two-point open path centered in the comp adding a stroke and a slider control but for some reason it wasn't applying the expression that we needed to tie the Path property to the slider length I spent about an hour and a half trying to figure out why the expression wasn't getting applied I could see where it was in the code but I could not figure out why it wasn't getting a tied to that Path property and the AI wasn't able to figure it out either this was one of those times where I had this sneaking suspicion that it was something really dead simple and I just didn't know what I didn't know and that's why it wasn't working and that leads me to my next tip which is don't be afraid to ask a human I'm lucky enough to have friends in my life that are much smarter than I am and who actually understand all of this scripting stuff and I was chatting about this script making process with some of my friends when I finally decided to turn away from the AI and ask my friend Evan to take a look at the code for me less than 10 minutes went by and Evan pinpointed the issue and as I suspected it was a very tiny oversight the script was trying to apply the path expression to the path group not the path itself all I had to do was add dot path to a single line of code in my script and it suddenly was working exactly how I wanted it to you might not have somebody in your life who knows the ins and outs of scripting but there are servers on Discord and channels on slack with people who are willing to answer questions about scripting and expressions so I'll leave some links down in the description if you're interested in that and if you're wondering how these scripts stack up to something that was actually written by a human I ran these by Adam and he actually gave his seal of approval he said the code was written better than his own when he first started learning how to script and that the comments that the AI added were extremely valuable which I totally agree with download these scripts and look at them in a script editor so that you can read the descriptive comments that are telling you in plain English what each group of code is actually doing and that's really going to help you start to understand how scripts work at this point I have a pretty good grasp on how these three scripts are working and I was able to isolate just the function part that actually executes what the script is supposed to do that part of the code can be copied and pasted into a k bar button using a scriptlet and if you're not using K bar yet you absolutely should be it's a complete game changer for having your own customized workflow in After Effects it allows you to create buttons to launch scripts apply expressions or presets run basically any command in After Effects all from single clickable buttons in a battle ax we try to integrate K bar buttons with basically every tool that we put out and you can easily have multiple K Bar toolbars and dock multiple K bars in your workspace which is why I touch an amazingly customizable tool and that's why I made scriplet versions of all three of these scripts so if you're interested in getting K Bar please use the link down in the description that's an affiliate link which doesn't cost you anything extra and it really supports my channel and helps me make more content like this video I hope this video got you excited about implementing AI into your After Effects workflow if you want to download my three scripts you can follow the link down in the description that will have both the script UI panel versions and the kbar versions with those custom icons but now I want to hear from you let me know down in the comments if you've used chatgpt to write your own scripts or expressions and if you're using klutzgpt now and if you have an idea for a script but you're not ready to jump into AI generated scripting let me know in the comments as well and I'll see if I can turn in a new script myself I just want to give a huge shout out to Adam my boss for looking at the scripts Evan for helping me out with that issue that I just could not figure out and Justin over at hyperbrew for creating klutzgpt and everyone at the hyperbread team for making such an awesome tool that makes this process of working with AI generated scripting so much easier don't forget to subscribe thank you so much for watching and I'll see you in the next video
Info
Channel: Jake In Motion
Views: 218,598
Rating: undefined out of 5
Keywords: motion graphics tutorial, after effects tutorial, artificial intelligence, after effects expressions, adobe after effects tutorial, adobe after effects, chat gpt, after effects chatgpt, use chatgpt ai to create animations, chat gpt animation, after effects scripts, chatgpt after effects, after effects basics, after effects tutorial edit, after effects tutorial animation, artificial intelligence art, chat gpt 4, chat gpt to make money, chatgpt how to use, chatgpt tutorial
Id: LpCxhE3Qgq0
Channel Id: undefined
Length: 18min 45sec (1125 seconds)
Published: Tue Mar 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.