 So I suppose pretty much everyone knows you can just go on YouTube and search like full album or something like that And it'll come up with a whole bunch of albums that you can watch or theoretically download Now one thing that would be nice Wouldn't it be nice if you could just take if you're one of those guys like me who if I listen to music I want to have it on my computer of course tagged properly split up into tracks etc etc It'd be nice if they're away of Getting this stuff downloading it and splitting it up in the tracks and automatically tagging it Well, that's what I'm gonna talk about in this video I have two little scripts or really one script that uses another but Script to do just that using YouTube DL and FFM peg and I wrote this a while ago I actually wrote this Not for albums, but for like splitting up audiobooks I think I think it was originally this audiobook Hamlet's Mill Which is like it's a two-parter and the first part is eight hours and 40 minutes, and I guess the second part's 540 So it was a big pain Having to do a little like taking the track getting the audio then splitting it up with FFM peg manually So I wrote a script for it So in this video, I'm gonna use the example of of course the unabombers manifesto Just because it's a meme on this channel and because it's not copyrighted I don't know maybe I shouldn't use one of these copyrighted albums on this video But obviously you could hypothetically do that with any of these anyway, so I'm gonna copy this URL So you probably know if you watch the channel, but if you don't I'll tell you there is a Command YouTube DL actually maybe I'll pull up the manual YouTube DL so YouTube DL of course you just give it a URL from YouTube and it downloads the video Or you can say I only want the audio it downloads the audio it can give any size you want You can actually use it on different video sites. It just is named after YouTube So I have this particular alias of YouTube D YouTube DL basically if you run this if you run YouTube DL The format I want is best audio on a URL. What it's gonna do is it's only gonna download just the audio Okay, so that's the first thing you want to do you do that manually you just download the The track onto your computer and this is for the full album or full audio book, okay? So I've actually already done that so here I have it the second thing you need to do is you need time codes Because basically what the script I'm gonna the script I'm gonna show you what it does is you just give it a file you give it a list list of time codes in a file And it will do everything automatically, so I actually already have a list of all the a List of all the tracks here or not tracks Well, I guess they're gonna be tracks But all the chapters and where their time codes are in this particular audio at least I think this is the right one It looks like around the right time codes. I did I made my own audio book of this a while ago So I'm reusing the file. So here's how it works Actually, let me just um, maybe I'll just run it the book the thing is called book split Maybe I'll rename it to like album split. You just give it well It'll say the first thing you give it is the Audio and then you give it the file That's the time codes and I'm gonna run this and then I'll show you the script in a second But all it's gonna do is it's gonna prompt you for a couple in from, you know, just the basic details about it So the album or book title is gonna be, you know in Duff Industrial Society and its future Author is gonna be the Cousins key, I hope that's right Enter your publication on a mid 90s. I'm not quite sure and then it's gonna go through and it's going to take the data that you gave it in that timecode File and it's gonna start splitting it up into parts. I'll actually show you all I'll speed through it in a second But just to show you see that it's made This file here. It's already going through them All already going through the file and splitting up it is splitting it up into parts So you already have the introduction the first chapter and if you look at all of these only move it to another one No, so transparency isn't messing with you, but you can see that it they're already named here It has the author and it also automatically does for example tracks and stuff like that So this is automatically. Okay, this is track. This is the third line in the file So that's gonna be the third track, etc. And it already knows. Oh, they're gonna be 25 in total. Okay, so I'm gonna let its Finish And in just a minute. I'll come back and I'll show you the actual script. Oh minute for me a second for you Okay, I left and came back and it's all done splitting the file. So let's actually take a look at them So as I said, well first off notice that I actually have it use lowercase and not use spaces That's just you know, because I don't like it. I you know, don't obviously we're not gonna have spaces in our file names here But you can see it has split all of these files All of them should be properly tags. They are working stuff like that So anyway, let me show you how the script actually works. I haven't pulled up here that again This is I call it book splits. I will have to remember the put to put this on my github and all that but so basically again, the idea is that It it asks for a book title an author and a year It takes input audio and then as I said, I don't like using spaces and stuff in my file name So I escape all that, you know, I make spaces hyphens and stuff like that and Make everything lowercase. I don't I don't know. It's okay I don't I don't know how you guys feel about this But I feel like hyphens are like a soy dev thing to do I feel like I should be using underscores, but I don't know that's just my feeling I don't know why I feel like that. It's just hyphens. That's like a zoomer thing. I don't know Anyway, so it creates a little directory for it Here I have it use opus to tag or for the extinct the extension And then it gets the number of lines in the file stuff like that So then it loops through every line of the file it reads the information and again The information looks like this. It's a timecode on the left and then all the rest of it is going to be the title of that chapter or You know track or anything like that. So it just goes through every single one of that One of those so to be clear it just in case you want to look at this yourself There are probably three notable things first off in order to use ffmpeg in a loop properly You need to give it this option. No standard input It just does it will not work. You'll get crazy things happening I'm not exactly sure why you have to do that But someone who knows more about it can probably tell me the second thing I'll talk about in a second and that is I use a script called tag And I'll explain why use that in a second The other thing is that when it's looping through these it technically when it's on the first line It isn't actually running ffmpeg It only runs it after the first line because you need this data here You need to know that this you know this chapter introduction goes from zero to this point, okay? So it actually it's actually running each Through the loop it runs the the command after the line It's supposed to be on and then you actually have to do the last one outside the loop here Anyway, so that that's what that is now. I should as I mentioned I do have another script called tag and this is really just so the one thing that annoys me Well, it doesn't really annoy me But one fact of life is that with different audio containers or codecs or whatever whatever I always get confused about the difference between a codec and a container and all that kind of stuff But I don't really know that much about it audio But the one thing you need to know is like So I'm using opus as I said and I have this little wrapper script called tag Basically, I use this to like manually tag things or I can give it command line options, so You know, I can say like tag you know artist name and Then you know, here's my file There's something like that and it'll talk tag it the reason I have I like doing this with opus files and org files Especially is because by default. Well, you need this you need a separate command opus tags to actually edit the tags whatsoever But to do it you can't like give it command line options like this where it's like a for artist T for track title Or something like that. You have to do this thing where you echo in the actual metadata and pipe it into opus tags A standard input. It's so I don't know confusing to me So I just use well, it was confusing when I wrote the script Then I now I use the script and that's what I use tag for tagging opus and log files I also I don't even tag mp3s anymore. I don't use mp3s anymore once I moved on to Og an opus But yeah, so anyway, so the tag script and the book split script together they basically Saved me so much time because whenever I want an album or an audiobook that I can't find elsewhere I just get it from YouTube. I download the audio. I I create one of oops got rid of my face. I create one of these things here a just a File that has all of the different time codes and stuff like that And that's actually all you need and of course many people on YouTube will like put these up anyway So you just have the file and that feed it to the scripts. That's it The only other caveat is you have to have you know, YouTube DL FFM peg and You know opus tools or whatever it is actually let me see I should probably say that because I didn't know that till a bit ago. So the opus. Where's the Script I had it. Oh, I already closed it. Didn't I okay? Let me open up the tag script to be clear this Command opus tags. I forget what exactly the package name is Something with opus in it Yeah, I guess it's opus tags. Okay, never mind. It was an obvious thing. Anyway, so you need opus tags You need FFM peg and YouTube DL. You probably at least have the other two if you watch my channel And yeah, that's how I do it See you guys next time links are in my github whatever in the video description