Subtitles

Gloriavale's picture

I am new to quartz composer and am trying to write a plugin that will read a subtitle file and display the titles at the given times in the file. I am not sure how to go about this and would appreciate some help. So far everything I have tried hasn't worked.Can somebody help?

Achim Breidenbach's picture
Re: Subtitles

Here are my 2 cents:

"Reading the file"-Part:

  • Use "String from File" patch from the Kineme-File-patches to read in the file

  • use a JavaScript-patch to convert the file into a structure QC understands, or let JavaScript do the logic anyways (this task heavily depends on how your file looks like, so I can't make any suggestions here)

"Rendering"-Part:

  • Use a "Image with String" patch to generate an Image from the current subtitle. Note: you can setup the width of the image in pixels and then this patch will automatically do line wrapping if the text is to long for the screen. (use a "Rendering Destination" patch to get the width of your screen you are rendering to)

  • use a "Anchor Position" patch to let it calculate the position for the following patch for bottom center on screen.

  • use a Billboard patch to actually render you text image to screen. Go to the Inspector panel of the Billboard patch and switch from "Auto Height" to "Real size" rendering. Note the "Pixel Alignment" input, set it to "1", so that the image is rendered pixel accurate for a sharp text.

Gloriavale's picture
Re: Subtitles

Thankyou for the tips. I have done that still no subtitles. Not sure what I am doing wrong. I discovered a patch called FX Factory subtitles importer and have tried that with no success either. I have attached my file. Any help welcome.

PreviewAttachmentSize
Subtitle Importer.qtz30.54 KB

Achim Breidenbach's picture
Re: Subtitles

Here are some notes to your composition:

  • your path should not have "File://" in it (btw, "file" should be lower case in URLs)
  • The "Anchor" patch needs image dimension so it can calculate the position of it on screen (connect the "Display Width/Height" outputs of the "Image with String" to the corresponding "Width/Height" inputs of the Anchor patch)
  • detach the "Anchor point" from the Anchor patch (the redish color of the connector line tells you that this connection won't work) and set its input to "Bottom Center"
  • Your JavaScript-Patch just have the default script in it, so what should it do? You need to code your own program here in order to walk through the subtitles.

I add the necessary patches to walk through the QuartzComposer structure without the JavaScript. I also put lots of comments in the composition so that you can see how its done. Please find the Composition in the ZIP, you have to put in the correct path to the file because it is different on your computer.

PreviewAttachmentSize
SRT Playback.zip12.92 KB

Gloriavale's picture
Re: Subtitles

Thankyou so much for your help. It is working now and I am learning lots too.