Dataclay — Automating Digital Production
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Register
    • Login

    Best Way to Template Subtitle Track

    Scheduled Pinned Locked Moved
    Templates
    5
    20
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jonundefined
      Jon @CitizenSam
      last edited by Jon

      @citizensam

      The good news is that it can be done! However, it’s a bit trickier than your average text layer swap. Basically, you’ll need to rename the files to swap the file extension from .srt files to .jsx files and then import one of them into AE as if it is a normal footage layer. After you’ve imported the file, you’ll want to add it to the timeline and then map the data from the .jsx to a text layer using an AE Expression. Once all that is working, it should be possible to use Templater to swap between the .jsx versions of the .srt files in order to swap between different sub tracks.

      For a sample, take a look at this example project on our GitHub repo:

      The project contains a sample aep file that has everything already set up. Simply point the Data option to the “Subtitle Swap Data.json” file and direct the Footage directory to the subtitle-swap folder.

      From there, you should be able to swap between the three data points. The video footage is also swapped and Time Sculpted to set the duration of the main comp to be the same as the duration of the video clip.

      Hopefully, that’s enough to get you started, but if you run into any trouble, let us know, and we’ll do what we can to help.

      Edit: for those who come to this later, please pay attention to the line endings in the repo’s JSX (SRT) files when you download or clone from GitHub. Depending on your OS, they may be incorrect. These files were created with CRLF (Windows) line endings and will work on Windows if you clone with a git management app. If you downlead the zip, they may be in LF (Unix). On MacOS, the OS may be expecting CR (Macintosh) line endings. It’s a difficult thing to manage cross-platform compatibility, so just be mindful if you experience issues.

      scainopicturemanundefined 2 Replies Last reply Reply Quote 0
      • scainopicturemanundefined
        scainopictureman @Jon
        last edited by

        @jon Thank you so much! I am going to begin experimenting with this today.

        1 Reply Last reply Reply Quote 0
        • scainopicturemanundefined
          scainopictureman @Jon
          last edited by

          @jon Hey Jon. So this is looking great so far. Only thing I’m confused about from the sample project is the subs aren’t timed out. It’s just one big text file…

          Subs.PNG

          Jonundefined 1 Reply Last reply Reply Quote 0
          • Jonundefined
            Jon @scainopictureman
            last edited by Jon

            @scainopictureman it may be possible that the expression on the text layer isn’t working correctly for you? I’ve re-verified that it’s still working correctly in AE 2023. Which version of After Effects are you using? What language is set for AE and your operating system?

            f60b4444-8746-467b-9f92-9fbd07e0dd46-image.png

            scainopicturemanundefined 2 Replies Last reply Reply Quote 0
            • scainopicturemanundefined
              scainopictureman @Jon
              last edited by

              @jon Thanks so much for your prompt reply. If we get this working, it will be a game changer for me.
              I am on After Effects 23.2.1. The language on my Windows machine is US English.
              I’m not sure how to check language on After Effects but it all looks like US English to me.
              The swapping of the layers is working fine, so it’s just that formatting issue we need to crack.

              1 Reply Last reply Reply Quote 0
              • scainopicturemanundefined
                scainopictureman @Jon
                last edited by

                @jon So interestingly enough. When I swapped the sample .jsx files for some of my own files, it worked! THANK YOU!

                Jonundefined 1 Reply Last reply Reply Quote 0
                • Jonundefined
                  Jon @scainopictureman
                  last edited by

                  @scainopictureman glad to hear it’s working! That is odd behavior and I’m not sure why it wouldn’t just work right away.

                  Ben Formanundefined 1 Reply Last reply Reply Quote 0
                  • Ben Formanundefined
                    Ben Forman @Jon
                    last edited by

                    I’m having the same issue

                    Ben Formanundefined 1 Reply Last reply Reply Quote 0
                    • Ben Formanundefined
                      Ben Forman @Ben Forman
                      last edited by

                      https://files.jotform.com/jufs/AlexaSports/222508108729053/5577821884386894630/Screenshot 2023-04-19 at 11.35.03 PM.png?md5=1lBekH2lKuwNiAR1xfJbJg&expires=1681973029

                      I’m on AE 23.2.1

                      I believe I’m on the latest version of Templater, but am not 100% sure

                      Ben Formanundefined 1 Reply Last reply Reply Quote 0
                      • Ben Formanundefined
                        Ben Forman @Ben Forman
                        last edited by

                        I’m seeing some odd weird green text, and the entire expressions box appears to be glitching

                        https://www.jotform.com/uploads/AlexaSports/222508108729053/5577826774387959455/Screenshot 2023-04-19 at 11.50.37 PM.png

                        Jonundefined Jeffundefined 2 Replies Last reply Reply Quote 0
                        • Jonundefined
                          Jon @Ben Forman
                          last edited by

                          @ben-forman Looks like that second screenshot isn’t coming through due to spaces in the URL.

                          Does advancing the preview to the next data point or a different subtitle file (srt -> jsx) resolve the expression not completing its calculation?

                          1 Reply Last reply Reply Quote 0
                          • Jeffundefined
                            Jeff @Ben Forman
                            last edited by

                            @ben-forman

                            After doing some troubleshooting, it seems like the behavior we’re seeing here is the result of the encoding format of the .jsx subtitles files in the project. If we open the Lockdown-Walkthrough.jsx, Templater-Intro.jsx, and Templater-Walkthrough.jsx files in an advanced text editor like Notepad++, it should be possible to change the encoding from Unix (LF) to Windows (CR LF) to make the example files read correctly on Windows-based systems.

                            Or, as @scainopictureman did in their previous reply, you could always replace the existing .jsx files with properly formatted ones to verify that the expression works with files with the correct text encoding.

                            Unfortunately, it seems as though GitHub converts everything to Unix (LF) encoding when files are downloaded through the website interface, so there’s not much we can do on that side, but at least we know what’s causing the error in After Effects.

                            Thanks!

                            Ben Formanundefined 1 Reply Last reply Reply Quote 0
                            • Ben Formanundefined
                              Ben Forman
                              last edited by

                              I’m on a Mac, does the same advice still apply? I need to change the encoding of the JSX? Can I use sublime?

                              Ben Formanundefined Jonundefined 2 Replies Last reply Reply Quote 0
                              • Ben Formanundefined
                                Ben Forman
                                last edited by

                                Note my issue happening with SRT files I got from other places (not the github ones)

                                1 Reply Last reply Reply Quote 0
                                • Ben Formanundefined
                                  Ben Forman @Ben Forman
                                  last edited by

                                  @ben-forman There appear to be lots of ‘Save with Encoding’ options, the first few I’ve tried didnt work though.

                                  1 Reply Last reply Reply Quote 0
                                  • Ben Formanundefined
                                    Ben Forman @Jeff
                                    last edited by

                                    @jeff said in Best Way to Template Subtitle Track:

                                    @scainopictureman

                                    @scainopictureman Can you post the jsx file that worked here?

                                    1 Reply Last reply Reply Quote 0
                                    • Jonundefined
                                      Jon @Ben Forman
                                      last edited by

                                      @ben-forman said in Best Way to Template Subtitle Track:

                                      I’m on a Mac, does the same advice still apply? I need to change the encoding of the JSX? Can I use sublime?

                                      So the line endings on Mac might work best as CR (rather than CRLF or LF). Sublime should let you change the line endings, too.

                                      @ben-forman said in Best Way to Template Subtitle Track:

                                      @ben-forman There appear to be lots of ‘Save with Encoding’ options, the first few I’ve tried didnt work though.

                                      The encoding should be utf-8.

                                      Ben Formanundefined 1 Reply Last reply Reply Quote 0
                                      • Ben Formanundefined
                                        Ben Forman @Jon
                                        last edited by

                                        @jon said in Best Way to Template Subtitle Track:

                                        So the line endings on Mac might work best as CR (rather than CRLF or LF). Sublime should let you change the line endings, too.

                                        Can you clarify what this means? Am I changing characters? Changing encodings?

                                        Jonundefined 1 Reply Last reply Reply Quote 0
                                        • Jonundefined
                                          Jon @Ben Forman
                                          last edited by Jon

                                          @ben-forman said in Best Way to Template Subtitle Track:

                                          @jon said in Best Way to Template Subtitle Track:

                                          So the line endings on Mac might work best as CR (rather than CRLF or LF). Sublime should let you change the line endings, too.

                                          Can you clarify what this means? Am I changing characters? Changing encodings?

                                          LF, CR, and CRLF are platform-specific “line-endings”—they tell the OS where a given line of text or code ends and a new one starts. The behavior where it was displaying all of the subtitle text at once is because AE and the OS aren’t correctly interpreting where each line ends.

                                          UTF-8 is a text character encoding—numerical representations of a graphical character/shape. There are also others like ASCII, UTF-16.

                                          The files in the GitHub repo are already UTF-8. When I created them on Windows, the files had CRLF line endings, but git automatically converted them to LF line endings upon uploading.

                                          I am on Windows and an older version of Sublime, but this is what it looks like on my menu. Save after changing.

                                          16d599cd-5194-4739-9b26-e6bd1e38e708-image.png

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post