Instant Subtitles! (Creating subtitles automatically as if by magic)

No, I have not seen this post. I will definitely check it out. All of this is so cool!

Made a slight modification to my original script after looking at Master JonRay’s script.

SetKeyDelay, 200
^M:: ; This sets CTRL + M as the “hotkey” (trigger).
send, !{right} ; sends playhead to the right edge of the clip
Loop, 5 ; number of iterations
{

send, ^c ; Copies the clip.

;send, ^+{PgDn} ; Ctrl+Shift+Page Down to advance playhead 10 seconds.

send, {PgDn 4}{right 5} ;PgDn 4X right 5x

send, ^v ; Pastes the clip.

sleep, 200
}
send, !{left} ; After the loop ends, sends playhead to the left edge of the clip.
return

The send !{left} before the return puts the PH at the left edge of the last clip. If the loop needs to be repeated the PH will be positioned correctly.

1 Like

I am so geeked Sauron. After playing around with your script a bit I finally got the end result that I was seeking!!! Initially I ran into issues when I ran the script because I had an unnecessary color clip on track V2 which affected how much space I had to paste my 100 clips (I had placed this here when I was attempting a different solution). The clips started overlapping and Shotcut got hosed up and stop responding. I end up exiting out of the script, exiting out of shotcut, then restarting shotcut to start over. I made sure to remove the unnecessary color clip from the end of track V2, I already had a long video clip on track V1 so I was set in that regard. Then I reran the script and viola it worked! I sat in watched in awe as my computer pasted all 100 clips in a matter of a few minutes! I am so excited! I am also grateful to you for all your help. I really could not have accomplished this without you. Next I am going to play round with Jonray’s script and see what I can learn from it. I think it is so cool that there is more than one way to write a script to perform a repetitive action. I am really diggin this. Now I want to script all the things! LOL! :laughing:

Right on! This awesome. I will study this script as well because I need all the help I can get to learn how to write good scripts. And again, I think it is so cool how many different ways a script can be written to perform the same action. Love it! :+1::+1::+1:

I am so happy I ran into your Youtube video! This video has started something and now I want to script all the things!!! :heart_eyes:

1 Like

Your enthusiasm is infectious, @treuben !! You might like to take a look at the two threads below for more uses of AHK/Shotcut. Also search this forum (magnifying glass, top right) for “autohot key”…

1 Like

I definitely will Jonray. Thank you! :smile:

My pleasure! :smiley:

Hi Sauron,

I tried out this script to see how it would go and it is not working right for me.

This script has the playhead being advance 10 seconds (in line 9) and 4.2 seconds (line 11).

When I first posted my question asking for a script that would copy a clip, advance 10 seconds, then paste another clip, all looped a certain number of times, I just threw out 10 seconds as a random number.

Then I tried to be more specific with my request by stating that I actually needed a script that would copy my clip, advance the playhead 4.2 seconds, paste it, all for x number of times.

This script, appears to me to combine both these different scenarios unnecessarily, unless I am reading and understanding this script incorrectly.

When I ran it all it did was copy and paste my clip, back to back, 5 times, at the very end of track V1.

I tried to modify the script by deleting out line 9 ( ;send, ^+{PgDn} ; Ctrl+Shift+Page Down to advance playhead 10 seconds), because this was just a throw away example I gave when I initially posted the question. What I actually wanted to be able to select my clip, copy it, advance the playhead 4 seconds ( or 2 seconds, or 4.5 seconds, or whatever number of seconds I require) then paste it again for x amount of times, (which is line 11).

How would this script be written so that a clip would first be copied, then the playhead advanced a certain amount of time ( ex: 10 seconds, or 4 seconds, or 4.2 seconds), then pasted, for 5 iterations?

I tried to modify it by deleting out line 9 and it simply did not work.

Thanks again for all your help. I really am learning alot with all this!

The script should have worked with no modification.:confused:

The semi-colon that I put at the beginning of the line that advances the clip 10 seconds should disable that line. Here’s the working script. I removed that line. If you need to change the duration of the gap between clips modify line 12.
When the script ends, the PH is moved to the left edge of the last clip. If the loop needs to be repeated the clips won’t get pasted back to back at the end of the timeline.

Copy Paste.ahk.txt (418 Bytes)

When using the modified script the clip should be selected and the PH needs to be on the clip but not at the end of the clip.

image

OMG Sauron! I think you uncovered my error with your original script. I was selecting the clip, then hitting alt + right arrow to send the playhead to the right edge of the the clip, then I hit control M. I did not know I was not supposed to do that. So I am going to retry both your original modified script and your new modified script and see what happens.

Thank you for being patient with me and taking the time to help me out all this. I am really grateful.

I am so frustrated right now. Not one of these scripts is working for me correctly. The script that Sauron wrote the very first time worked for me once, which was awesome. Now I am trying to create another video using different clips and now none of the clips are pasting right. Not Sauron’s scripts or Jonray’s scripts. I tried all of them. I don’t know what is going on. I have done everything. I started the project over at least a dozen times. From scratch. Scripts didn’t work correctly. I shut my computer all the way down, reloaded Shotcut, and started my project again from scratch. No go. I switched from using the latest version of Shotcut back down to an older version Shotcut. No go. I attempted to use the scripts as written, to see if maybe my tinkering with scripts is the reason for them not working. Nope. Still didn’t work right. I tried using other video clips. No go. I closed out of all other running programs and documents and made sure only Shotcut, Notepad and this here webpage were running. Still could not get any of these scripts to behave correctly. Running the scripts results in the clips being pasted in the wrong position or not at all. I am trying everything to get them to run correctly and they just wont. I dont understand why. Sauron’s very first script he wrote up worked for me the other day so I don’t know what gives. My laptop is old, but not that old. Its going on 4 years old I believe. Maybe it is my laptop. I dont know, but it could be Shotcut itself because one issue I have with it is it is laggy as all get out. Or it will completely crash. I do like the software, but it has not been easy for me to use. The lag is bad. I dont know if this is Shotcut or my computer. I don’t know if this lag is what is causing the scripts to not run right any more. I am so frustrated right now. It’s like I don’t want to go bed until I fix what ever this issue is because I really need this script to work right again. I am going to keep playing around with it. Man I am sad and frustrated :frowning:

Hi @treuben ! Poor you! I just ran @sauron’s modified script and it works fine. I can’t be here to help for a while now because I’m off to work but just wanted you to know it works Ok for me. Hope that may help a little. Good luck…

Okay. I understand. Thank you for trying it out yourself.

I am really at a loss. I pasted a pic of the script I ran. I only change the loop number to 5.

I also pasted a pic of result I get. The clips are overlapping each other!

And I made sure the playhead was ON the clip and not at the end of the clip before I ran the script, as Sauron instructed, and it still keeps pasting like this.

I started over from scratch several times to see if I can get different results and same.

Maybe the latest version of Shotcut doesn’t work with my computer?

Did you use the latest version of Shotcut on your computer when you ran this script?

Does the frame rate of the video in track V1 matter? The framerate of the video that I put on track V1 is 60 fps.

There has got to be a reason for this.

@sauron Any ideas?

It seems the frame rate does matter. I tried with a UHD 60 fps clip. Shotcut was choking. Had to use the KKnBB proxy tool to lower the resolution.
The PH was not seeking properly when running the script. Changed SetKeyDelay from 200 to 600. Now it works properly.
You might want to change the right 5 to right 12 if you want 4.2 seconds with 60 fps video.

image

1 Like

Awww Bless you man! Bless you. I have not tried this yet. But I am just so moved that you keep tinkering on this for me. I got the idea of the frame rate from one of your earlier posts when you said something about ‘if the video’s frame rate is 25 fps’. So that got me to thinking. What is the fps of the video I am trying to use now? Found out it was 60 fps. Didn’t know if it mattered. This is why I decided to pose the question to you and Jonray because I am really trying to leave no stone left unturned. And for you to try this out yourself and replicate my issue, man, I am so glad. I really thought something was wrong with either Shotcut or my computer. I have uninstalled an reinstalled several different versions of Shotcut trying to fix this issue. At any rate…

I am going to revise your script as indicated and hope this works for me as it has worked for you.

I do have one more question though @sauron

What is the KKnBB proxy tool and do I also need to do what you did and use it to lower the resolution of my video? Or will just changing the SetKeyDelay from 200 to 600 in the script suffice?

Thanks again for all your help. This experience has taught me so much. It has been so frustrating but also rewarding at the same time. :slightly_smiling_face:

There is a very long thread here.

It’s a very useful tool to have.

That depends on how well the video plays. If there’s no lag or stutter then you will probably be OK.
My video was UHD 3840x2160. The playback was very laggy so I made a proxy.

Yeah my video is laggy as all get. It is a headache to scrub through. So if using this proxy tool can help me out with this then I am willing to learn how to use it. I will go read through the thread you provided.

Thank you for all your help!

Wow, nice detective work, @sauron! :+1: Didn’t know that!

Sauron,

I used the KKnBB proxy tool to reduce the resolution of the two videos I want to use in my next Shotcut project.

Now I am ready to use the _fastproxy_xxxx files to do my video editing.

The instructions state not to use the Automatic video mode to start my project.

I have several questions regarding this.

1.) Is this screen where the video mode would be changed?

2.) If I am not supposed to use Automatic mode, then what mode do I use? Like how do I know which one to choose?

3.) Which ever mode I choose will this be the video mode for the FINAL project?

Thanks again for all your help!