How to create dynamic subtitles in After Effects?

Тәжірибелік нұсқаулар және стиль

In this video tutorial you will learn how to create dynamic subtitles in After Effects, that you can quickly reuse for any future project.
0:00 - Intro
0:35 - Setting up the comp
1:11 - Creating subtitles text layer
3:04 - Adding a dynamic box behind subtitles
8:21 - Multi line setup
10:55 - Closing statement
Expression on box size:
subText = thisComp.layer("Subtitles");
textWidth = subText.sourceRectAtTime(time).width + paddingX;
textHeight = subText.sourceRectAtTime(time).height + paddingY;
[textWidth, textHeight]
Expression on text anchor:
yPos = thisLayer.sourceRectAtTime(time).height / 2;
[0, yPos]

Пікірлер: 78

  • @YemiDavis
    @YemiDavis Жыл бұрын

    This is the best, most straight foreward subtitle tutorial I've come across! Great work!!

  • @damiengreen5978
    @damiengreen59782 жыл бұрын

    Great tutorial, works so well. before I was resizing boxes manually

  • @a.carsandas
    @a.carsandas2 жыл бұрын

    took me a while but worth it in the end, this tutorial saves me. Thank you sm ;D

  • @zakiroyhan
    @zakiroyhan2 жыл бұрын

    Thank you so much!! it's more saving time using expression comparing to animating manually.

  • @alotenorio
    @alotenorio Жыл бұрын

    El mejor tutorial que he visto para generar subtítulos en After Effects ^^

  • @rean8899
    @rean88992 жыл бұрын

    Thank you so much sir! I've been finding it for so long.

  • @noyklas8953
    @noyklas8953 Жыл бұрын

    Thank you! Straight forward end well explained! :)

  • @heywazup_aep
    @heywazup_aep2 жыл бұрын

    Thanks for the tutorial , I'll try this.

  • @wilpikidwilpikid8970
    @wilpikidwilpikid89702 жыл бұрын

    Thanks man, it helps me a lot

  • @user-gb2or3wc2o
    @user-gb2or3wc2o11 ай бұрын

    thanks a lot, very useful!

  • @SekiFayt
    @SekiFayt Жыл бұрын

    Thank you so much. This is exactly what I needed! T^T

  • @turkmen_hits
    @turkmen_hits2 жыл бұрын

    thank you very much broo you really helped))

  • @eldertauras
    @eldertauras9 ай бұрын

    Thank you so much!

  • @nanding0718
    @nanding07182 жыл бұрын

    Thanks Man!

  • @nicholasfaithful7708
    @nicholasfaithful77082 жыл бұрын

    WOW dude! For me, this is epic!

  • @BlizeBrze
    @BlizeBrze Жыл бұрын

    THANKS YOU YOU SAVE MY HEAVY LIFE , YOU ARE SUPERMAN !!!

  • @cristelproducciones
    @cristelproducciones2 жыл бұрын

    Thanks a lot bro

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    No problem ;)

  • @tilius.xyz_
    @tilius.xyz_2 жыл бұрын

    Hey, thanks a lot, nice and easy tutorial, tho I'm using it for an animated interface. I have animated text inside a button, which needs a minimum rectangle size. Could you think of a solution?

  • @noshiAEP
    @noshiAEP Жыл бұрын

    Very helpful expression! The problem I'm currently facing is that when you move the text and box in the timeline, the timing of the box gets completely messed up for me and the box moves inbetween the text hold keyframes for some reason. I tried precomposing text and the box to move it but that doesnt fix the problem. I don't really know much about expressions but maybe it has to do with the .sourceRectAtTime command? Edit: I just found a workaround to not move the layers themselves, but dragging out the back and pulling in the front and then moving the keyframes to the correct timing. That kinda fixes it.

  • @MCU_3883
    @MCU_38833 жыл бұрын

    thanks

  • @SOUTH11_YT

    @SOUTH11_YT

    3 жыл бұрын

    You're welcome!

  • @nickdanvers547
    @nickdanvers5472 жыл бұрын

    If this isn't working for you, here's something that helped me: Go to your background subtitle box layer, and make sure that every Scale or Size is set to 1920x1080, or 100%

  • @j6patriotnews986

    @j6patriotnews986

    2 жыл бұрын

    Make sure you delete the stroke or you will have an error

  • @deliberatevideo
    @deliberatevideo Жыл бұрын

    When I tried to follow you exactly typing the expression by hand it didn't work, so I checked the description and copied the one you provided. It worked! Not sure what I was missing in mine!

  • @deliberatevideo

    @deliberatevideo

    Жыл бұрын

    Okay I just tried again. I started with a brand new rectangle, and when it came to the expression I had better luck when I used the autofill suggestions when possible. It seemed to link things together properly. This is my first time doing an expression so I have NO idea what the proper way is. XD

  • @SrryNoobi

    @SrryNoobi

    Жыл бұрын

    @@deliberatevideo could be the capitalization of your text or missing punctuation

  • @shriefallam8866
    @shriefallam88669 ай бұрын

    What if I want to make a background rectangle to go along with the typewriter effect on words?

  • @abdelazizmuhammed5340
    @abdelazizmuhammed5340 Жыл бұрын

    thx fot the tut mate, is there an expression that makes the rectangle follows the text word by word I asked chat gpt for this but I keep getting errors please let me know if that's possible thanks again

  • @richochet
    @richochet2 жыл бұрын

    Thank you, so well done. Subbed) How do I account for the parts of text that are below the centre like in "g" etc? They seem to make it not quite centred if you see what I mean.

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    Thanks Alex. Yeah that's a little annoying and I only noticed it myself after recording the tutorial. There's a couple of ways to fix it: 1. Use capitalized text. It will make all of your letters the same size. 2. You could turn off that Anchor Point expression and simply adjust your subtitles text position by hand. You'd also have to set a fixed height for Subtitles BG box expression "textHeight = 100;". This approach doesn't work with 2 lines of text. I'm sure there's a way to write an expression that looks at whether the line has any "g" or "l" type of characters that stick out either at the top or bottom, but that's a little too complex for the tutorial I wanted to share. Hope this helps.

  • @petrvorasicky3073
    @petrvorasicky30733 ай бұрын

    When I move subtitles on the timeline or copy and paste to another composition, background rectangle doesnt work properly :(

  • @tasnimfarah6139
    @tasnimfarah61394 ай бұрын

  • @JaiShreeRam_901
    @JaiShreeRam_901 Жыл бұрын

    Hey, Just in case anyone did not know, Textbox 2 plugin is paid but can save you alot of time with many customizations.

  • @rodrigobravo318
    @rodrigobravo3184 ай бұрын

    how do i do if i don't want the box height to change? i only want the width to change.

  • @antonhapunkt4287
    @antonhapunkt4287 Жыл бұрын

    Great tutorial! So far, the only "problem" I'm facing is that the subtitles-box even shows a little square when the text is empty (includes no letters).. So when you want to have a "break" for a moment with the subtitles you would have to work around it.. (I know it's because of the additional space which is added to the size of the letters/text). I'm sure there is a way through expressions to tell it not to show a box whenever the text remains empty... unfortunately I'm not familiar enough with expressions.

  • @erikj.petterson639

    @erikj.petterson639

    Жыл бұрын

    I was having the same trouble and i didn't know how to solve it, so i asked it to ChatGPT and i can belive it but it solved that issue, change the code with this: Subtext = thisComp.layer("Subtitles"); textContent = Subtext.text.sourceText; if (textContent == " ") { [0,0] } else { TextWidth = Subtext.sourceRectAtTime(time).width+80; TextHeight = Subtext.sourceRectAtTime(time).height+30; [TextWidth, TextHeight] } Have the consideration that ( " " ) represent a space and not empty, because when i didn't have text what i did was create a space to create a keyframe. I hope it solve your problem too!

  • @SOUTH11_YT

    @SOUTH11_YT

    Жыл бұрын

    Lol no way GPTChat gave you that answer :)) You can make it even a little simpler. Add these 3 lines to your "Subtitles Box" layer opacity property: subs = thisComp.layer("Subtitles").text.sourceText; if (subs == "") 0 else 70 it checks the text value on your Subtitles layer and if its empty, sets box opacity to 0.

  • @lukaszlatkovsky4838
    @lukaszlatkovsky4838 Жыл бұрын

    Hey thank you for tutorial. What if I want pauses between text? I tried make more boxes with subtitles but it doesnt work.

  • @flyerbeyer

    @flyerbeyer

    Жыл бұрын

    Late to the Party - but: Just ad keyframes with no text or a blank space in the textelement. You will have a small backround-box with the dimensions of your padding in the pauses. to get rid of them automatically i just use an expression to set opacity of the box-Layer to the Width of the text. It's not sophisticated but worked for me (subText = thisComp.layer("Subtitles"); transform.opacity = subText.sourceRectAtTime(time).width; )

  • @margueriteoosthuizen6006
    @margueriteoosthuizen6006 Жыл бұрын

    I do exactly what the tutorial says and copy the expressions but I keep getting errors :/

  • @__hushm3

    @__hushm3

    Жыл бұрын

    Same here

  • @allfatihah
    @allfatihah2 жыл бұрын

    How if align right?

  • @Eindrew9
    @Eindrew92 жыл бұрын

    hey! nice tutorial, but when I copy the layers to a different comp or duplicate them or whatever, it does not work anymore? why is that?

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    Hi Eindrew9 its strange you say it doesn't work when you copy it to a new comp. I've tested it a couple of ways here and I can't see to find a way to break it. Could you send me your file to support@southeleven.com so I can take a look? When duplicating the two layers you have to update the first expression line on "Background Box 2" layer's "size" parameter. Change it from "subText = thisComp.layer("Subtitles Text");" to "subText = thisComp.layer("Subtitles Text 2");".

  • @user-py5uq6rq2d
    @user-py5uq6rq2d10 ай бұрын

    I can't get it to work. The first line returns "object of type layer found where a property is needed" - don't really see, why a layer can't be assignable to a variable...

  • @kelvinkinyanjui2364
    @kelvinkinyanjui2364 Жыл бұрын

    I'm stuck.. what did you just type on the first expression after typing sub Text min 5:39?

  • @SOUTH11_YT

    @SOUTH11_YT

    Жыл бұрын

    You should enter one of the expressions from video description.

  • @syafiqyshr1
    @syafiqyshr12 жыл бұрын

    Can i ask you ? What symbol u use “ Subtext (?) ?

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    Hi Muhd, I'm not sure I follow your question... Take a look at video description where I've added the expressions used in this demo.

  • @syafiqyshr1

    @syafiqyshr1

    2 жыл бұрын

    @@SOUTH11_YT Ok great thank u .

  • @dwifebrianto9738
    @dwifebrianto97382 жыл бұрын

    It's working for 1 line subtitle, Thanks! How about if we use 2 line subtitle?

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    Hi Dwi, yes that should work too. See at 8:21s mark where I show how to use it with multiple lines.

  • @janetisnow

    @janetisnow

    9 ай бұрын

    ​@SOUTH11_YT Hey, thanks for your tutorial! Do you know of any additonal code if I want the box to look more accurate for 2 lines with different width? E.g. Top line is shorter than the bottom line, ideally would want the box above to be shorter than the one at the bottom (rather than just a rectangular box)? I am ok if there is no additional leading from line 1 to line 2 excluding the box! lmao not sure if you know what I'm talking about.

  • @adhamayman6142
    @adhamayman61422 жыл бұрын

    how to make the rectangle change with words

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    You need add those two expressions found in the description.

  • @connorwarden1557
    @connorwarden1557 Жыл бұрын

    subText = thisComp.layer("Subtitles"); textWidth = subText.sourceRectAtTime(time),width + 100; textHeight = subText.sourceRecAtTime(time),height + 40; [textWidth, textHeight] I'm getting an error with this, can anyone see what the issue is? Thanks

  • @SOUTH11_YT

    @SOUTH11_YT

    Жыл бұрын

    What’s the error saying? Is your subtitles text layer called “Subtitles”? Does the expression work if you just copy and paste it exactly as in description?

  • @connorwarden1557

    @connorwarden1557

    Жыл бұрын

    @@SOUTH11_YT Hey I've got it all going now, only issue is when the text goes to two lines instead of one, the box is offset?

  • @SOUTH11_YT

    @SOUTH11_YT

    Жыл бұрын

    @@connorwarden1557 Glad to hear that. What was the problem? Could it be that you added a text box (you add it by clicking and dragging out a box using a text tool) instead of typing your text? There's no expressions on your text layer to affect how the text is displayed so I'm not sure why it would do that.

  • @abuabu7041

    @abuabu7041

    Жыл бұрын

    @@SOUTH11_YT respect for replying to comments and helping 1.5 years later, nice video btw!

  • @jayeshkaslikar8463
    @jayeshkaslikar8463 Жыл бұрын

    dose it works in crack version

  • @SOUTH11_YT

    @SOUTH11_YT

    Жыл бұрын

    Crack version of what?

  • @StorytellerDan
    @StorytellerDan Жыл бұрын

    Remember to tell people to make sure they´ve got their text ´CENTRE ALIGNED´ before they try this.

  • @dhruvchavan5336

    @dhruvchavan5336

    10 ай бұрын

    bruv..it's not staying center alligned for a new subtitle keyframe what to do :(

  • @27shearer
    @27shearer2 жыл бұрын

    My subtitles box is changing shape a fraction of a second before the text why is that?

  • @kevinli7941

    @kevinli7941

    2 жыл бұрын

    same problem

  • @27shearer

    @27shearer

    2 жыл бұрын

    It seems to work fine on a blank comp as in the video but as soon as it's placed on top of a footage file it fails?

  • @kevinli7941

    @kevinli7941

    2 жыл бұрын

    @@27shearer good shout, i can troubleshoot it by creating another precomp for it but still it's off, but i can manual sort it.

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    Hmm weird - I can't seem to be able to reproduce this. But one thing that comes to mind is that your video comp might have a different framerate to the comp where you created your subtitles. If you paste the two layers into your video comp, text layer will have the keyframes set in between the frames and no exactly on them. You could try to shift them to exact frames manually and see if that fixes is?

  • @mybengal
    @mybengal2 жыл бұрын

    there are errors in my case

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    What errors are you getting?

  • @sounder7564
    @sounder75642 жыл бұрын

    sorry not working

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    What wasn’t working?

  • @sounder7564

    @sounder7564

    2 жыл бұрын

    @@SOUTH11_YT that code in description. i wrote code in video after that works. wrong code in description.

  • @mehdiheidari4958
    @mehdiheidari49582 жыл бұрын

    Great tutorial, I have a question I have this code for a subtitle text box : text=thisComp.layer(""); width=tex.sourceRectAtTime(time-tex.inPoint,true).width+45; myFade = 12; if ( marker.numKeys > 0){ m = marker.nearestKey(time); t = m.time; d=linear(width,0,1400,45,1400); if (t

  • @SOUTH11_YT

    @SOUTH11_YT

    2 жыл бұрын

    I'd probably approach it using an array and do it something like this: // Vars subs = thisComp.layer("Subtitles").text.sourceText; subsText = thisComp.layer("Subtitles"); keyArray = []; //Create an array with all keyframe times for (i = 1; i keyArray.push(subs.key(i).time); } //Transition for (i = 0; i if (time>keyArray[i]) { transitionTime = keyArray[i+1] keyCur = keyArray[i] keyNext = keyArray[i+1]; } } //Set box width textWidthCur = subsText.sourceRectAtTime(keyCur).width + 100; textWidthNext = subsText.sourceRectAtTime(keyNext).width + 100; //Output textWidth = ease(time, transitionTime-0.2, transitionTime, textWidthCur, textWidthNext); textHeight = subsText.sourceRectAtTime(time).height + 40; [textWidth, textHeight] --------------------------------------------------------------------------------- You'd have to clean it up a little bit but if you paste it into your "Subtitles Box" layer, it will work. Not sure how you'd approach the text to create a smooth transition but please do share the finished project as I'd like to see how it turns out. All the best,

  • @mehdiheidari4958

    @mehdiheidari4958

    2 жыл бұрын

    @@SOUTH11_YT Thanks man Yeah sure, i will share it with you when it is finished.

Келесі