Real Time Closed Caption Generator for YouTube
So the past couple of nights I've been working on a new music video for Jessie Reed Just got it up online. There it is 'Taking What's Mine Tonight' Now, that I got that up I decided I'm going to actually add some closed captions There's actually a feature on YouTube where you can close-caption it. but it requires uploading a closed caption file Which can be can be a bit tedious to make sometimes. So I've actually got my own little closed caption generator. I built it a while ago Just specifically for doing this task It actually automates the process of creating closed captions So the first thing I do is I take the lyrics. This is the raw lyrics I got from Jessie. What I basically do is I take the lyrics and I put it into a raw lyrics text file, and basically every single line in this text file will be a new line for lyrics this is something I actually use as input for my program that I created so that would be... [Source Text] so I would click on source text and I would browse for this lyrics file. I would use this for the process of creating the closed caption file. Then I also pick an audio source and that's the sound track. and then the output destination that's the output closed caption file location and the file name I want of the closed caption file Now that I got that done to actually generate this closed caption file where ever closed caption has its own timestamps to tell you exactly when to show up in the video all I have to do is hit begin and this thing will start up this gives you little instructions on how to use it. Basically the way it works is it will play the audio track while displaying what closed caption is coming up next I only really hold space for the duration that I want it to be displayed and it will automatically take the times and put them into the closed caption file So let's just see what happens when I hit enter. Taking What's Mine Tonight and you can see right here that the next words are Taking What's Mine Tonight So I would, hold that down and now it's saying taking what's mine tonight It shows me a little query of what ones are coming up next Up the you can see the In and Out timestamps So yeah, It actually makes it quite handy otherwise I would have to manually type in all these values. Now I'm just going to cheat here and I'm just going to hit enter here rapidly Just so I can show you the end result.
and here we are so this is what it actually generated this is actually what is required Basically It's just an In and Out and then the time You can see it would be very tedious to actually have to type that out manually You'd have no idea where it's supposed to go So this is a very nice automated process for creating closed captions
One down fall though is that..
If you kind of screw up, you have to fix it manually you can't really stop it, you have to do it while it's playing but it is very quick
If you do it right, it only takes the amount of time to play the video, to actually create the closed caption file for it Then I would take this file and upload it. So let's actually just do that now. Let's see what it does with it Closed Caption, English, Upload. It's in there. There we go Now, YouTube has it and YouTube can show me my actual captions.
and here we are
.. closed captions are in place. and that's an optional feature that people can turn on and off If I really wanted to I could also add alternative closed captions Right now I only have 'English - TWMT' This is the one I just created. But if I wanted to I could make different language versions or... other weird things.. I don't know, whatever So yeah, that's closed captions Launching my closed caption program There it is, checking for updates... and it's loaded --- Diving Into Source Code --- So if I open up the source code for this closed caption generator You can see it was January 30th 2012 that I made it So it wasn't to long ago and there's a good decent amount of code here 230 lines in the main program but then this isn't the only file I'm actually using quite a number of custom includes that I've built Not just for this, but for many programs I make. VBS Module, that's a pretty large one. It's got all kinds of pop up windows using VB Script. Shady, that's the special button GUI system I have. Sort, that's just for sorting arrays. That's for grabbing certain types of windows events. Version Control, that's just for keeping track of my versions And App Tracker, that handles the update features.
Auto update features
All those modules I was talking about, they're all up in this folder. So here are all the modules that I am using. I created every single one of these modules. That's the GUI I built for it. Quite extensive. Here's the sort module Very Extensive VBS Module If I go down to mark you can see all the different functions I have created inside of this module Browser, InputBox, Notice, Message Box... And then win event grab this one just basically allows me to get control of the 'X' on the program so I know if somebody clicks this Cuz Turing doesn't have that natively, you don't know. File Browse, This was actually an entire program I was working on for like a year, and then eventually it turned into a module So file Browse, this is a file browser. This is in itself a 2000 line long program.
and then it has its own modules on top of that
EI Library, This is actually kind of cool This is a system I created for... storing images within the code itself. So I would use a program to basically take a folder of images and it would convert it into code that would then generate those images on the fly when you
run the program so you don't have to carry those images with you
The manager, that's just managing all the commands The Engine, this is what actually does the conversions it actually generates the image files based on, these files which are RGB values in a huge array which would make up the actual image So after thinking about it a bit.
I got curious
So I decided to actually count how many lines of code my entire program is with all the modules. I'm at four and a half thousand lines.
Now the only thing I haven't included yet is this browser
All the browser module stuff is 5000 lines. It's interesting to think that this little application here is 9000 nearly 10,000 lines of code. Pretty Crazy So just for fun I am going to run my program. Usually when I run it It executes fairly quickly. and there it is loading up and now it's running straight out of the IDE, Turing Environment but what I really want to show you is, it has something called Trace execute where it actually shows you what line it's on, and what module I'm actually going to make this Trace relatively quickly and have it run through the entire process as it's loading let's see how crazy this is. Run. Look at all those applications These are all separate files This is the route that it takes. Right now it's going through the *EI Engine. This is the Image Generating Library I created. It's going through and taking values out of an array and basically generating bitmap images so that I don't have to include the files with it. All you do is use a program I wrote earlier... Quite a while earlier, which takes raw images and converts them into these modules So right now it's just going through the engine and generating itself. and right here we can see, It's just saying, "Loading" So this is actually running a lot slower, a lot slower than real time. That's pretty crazy. Ok, now its somewhere else. Checking for updates. ok trace execute... turn you off for just a second. until you do something else Oh, there we go it's doing something else now. ok, now it's just running through the shady UI. That's just literally this right here Now its just running through its regular loops where it goes through Shady UI. Shady UI is this button module, Which is causing these to fade in and out That's what's handling all that. Yeah so most of these modules are just for this right here.
This little program
and a lot of them are like these little icons right here for actually generating them, out of pixel per pixel using Draw Dots so there actually quite a number of icons I've actually got a little library of different icons for different items in here. So that actually uses it quite a bit. Yup, all for this little closed caption generator.
Tags: video caption generator
Ssh! We read YouTube quietly © 2020