Jump to: Board index » General » Fusion

Using Expressions to Create Titles from Clip Names

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

JollyGreen

  • Posts: 3
  • Joined: Sat Jun 05, 2021 5:50 am
  • Real Name: Jason L Simpson

Using Expressions to Create Titles from Clip Names

PostSun Jun 06, 2021 6:25 pm

So I recently finished a huge skateboarding project that had over a thousand trick clips, all timed to music with slow motion. It was a major undertaking, and I am proud of how it turned out. Now I am wanting to create a raw clip video that uses the clip name as a title. I have done a lot of research into it, and have managed to do this by referencing the clip name, as seen here with the first clip.
Screenshot (1).png
First Clip
Screenshot (1).png (919.69 KiB) Viewed 1826 times

First of all, I would prefer to remove the file extension from the name, and have went down several rabbit holes with no success. As you can see, I am just refencing the media in metadata by using:
Code: Select all
Text(MediaIn1.ClipName.Value)
in the expression line. Though this would be ideal, if it couldn't be done, I wouldn't be upset about it.
Second of all, when I get to clip trick names that are substantially longer, like the example below:
Screenshot (2).png
In need of word wrap...
Screenshot (2).png (862.02 KiB) Viewed 1826 times

part of the clip name is off screen. I could obviously could change the size to make it fit, but that is not the effect I am looking for. Is there anyway to make this word wrap? I went to Noah Haehnel's Expressions Cookbook here for reference, but the return command will work but will not respond to formatting.
Anybody have any guidance or new rabbit holes to follow? I am using Resolve 17 Free Version...
Offline

xunile

  • Posts: 3028
  • Joined: Mon Apr 23, 2018 5:21 am
  • Real Name: Eric Eisenmann

Re: Using Expressions to Create Titles from Clip Names

PostMon Jun 07, 2021 6:50 pm

I would try using something like

Code: Select all
string.gsub(MediaIn1.ClipName.Value,".mp4","")


to remove the extension.
Attachments
2021-06-07 (1).png
2021-06-07 (1).png (564.56 KiB) Viewed 1801 times
Win 10 Home | Intel i7 - 10700f 64 GB 1 TB GB SSD 2 TB SSD
RTX-3060 12 GB | Resolve Studio 18.6.6| Fusion Studio 18.6.6

Win 10 Home | Intel Core I7-7700HQ 32 GB 1 TB NVME SSD 1 TB SATA SSD
GTX-1060-6GB | Resolve 17.4.6
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Using Expressions to Create Titles from Clip Names

PostTue Jun 08, 2021 12:10 am

There's a Fuse that does text wrapping. I've never used it and can't speak as to whether it's appropriate for your use case, but it and a discussion about it can be found here:
https://www.steakunderwater.com/wesuckl ... f=6&t=1098

For your extension-trimming expression, you can remove everything after a . with this one:
string.gsub(MediaIn1.ClipName.Value, "%.%w+", "")

That'll remove the dot along with all alphanumeric characters found after it. So it will also trim off sequence numbers, which you may or may not want.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

JollyGreen

  • Posts: 3
  • Joined: Sat Jun 05, 2021 5:50 am
  • Real Name: Jason L Simpson

Re: Using Expressions to Create Titles from Clip Names

PostWed Jun 09, 2021 10:32 pm

A big thanks to you both, as both code strings work great, and I see that I can use patterns in lua to refine further for other formatting in the one case. The word wrap looks a little more complicated, and I can just copy and paste for the 20 or 30 clips that need adjusting. It certainly beats having to do over a 1000 clips by hand...
Offline

VMC303

  • Posts: 1
  • Joined: Fri May 27, 2022 2:30 am
  • Real Name: Vincent McCurley

Re: Using Expressions to Create Titles from Clip Names

PostFri May 27, 2022 2:48 am

I was looking for a solution to the same issue today using Resolve 18b3.

I kludged together a slightly different solution that doesn't rely on pattern matching, instead it grabs a substring using the sub function:
Code: Select all
string.sub(s,i,j)


where:
s = name of string
i = starting index
j = ending index

To remove the last 4 characters of the file clip name:
Code: Select all
Text(string.sub(MediaIn1.ClipName.Value, 1, -4))
Last edited by VMC303 on Mon May 30, 2022 12:26 pm, edited 1 time in total.
Offline

mytrees

  • Posts: 21
  • Joined: Fri Apr 22, 2022 9:50 am
  • Real Name: Tell Hensel

Re: Using Expressions to Create Titles from Clip Names

PostFri May 27, 2022 11:11 pm

Hey Davinci Resolve Experts,

I have a similar question: In my case I don't want to get the filename, but rather the clip name of an Adjustment Layer.

Could you help me find an expression for this case? Sadly I haven't found a solution yet...

I also created a own thread, because my problem is a bit different.
https://forum.blackmagicdesign.com/viewtopic.php?f=22&t=161231

Thank you in advance

Tell

Return to Fusion

Who is online

Users browsing this forum: No registered users and 31 guests