Page 1 of 1

%markername as filename multiple clip export

PostPosted: Wed May 18, 2022 2:16 pm
by TimElschner
Use Case:
We have an FAQ Session with multiple sections (with markers) which we need as individual clips exported.
The name of the clip should be the %markernotes
So if we have a marker with the note "What to do next"
we want the filename to be "what to do next.mp4"

Resolve SEEMS to be so close to enable this feature since there are the % variables BUT the delivery page does not produce any usefull output. If you choose individual clips you will get all clips and video layers individual. The naming of the output files does not reflect the %markernotes or %markername. (see attachment)

Am I doing anything wrong or do I really have to write a python script to create the Render Queue by %makernote with markerlength?

Request:
Please add an option to export multiple clips (as the full composed output) with %markername or %variablename
Screenshot 2022-05-18 154739.jpg
Screenshot 2022-05-18 154739.jpg (452.47 KiB) Viewed 3663 times


Screenshot 2022-05-18 160850.jpg
Screenshot 2022-05-18 160850.jpg (281.53 KiB) Viewed 3663 times

Re: %markername as filename multiple clip export

PostPosted: Wed May 18, 2022 2:19 pm
by Jim Simon
Try using Single clip mode with In/Out points.

Re: %markername as filename multiple clip export

PostPosted: Wed May 18, 2022 4:07 pm
by TimElschner
Jim Simon wrote:Try using Single clip mode with In/Out points.


of course you can name every single clip by hand and set manually in and out points
but I am looking for an automated way.

Re: %markername as filename multiple clip export

PostPosted: Wed May 18, 2022 7:57 pm
by Igor Riđanović
You can do this using scripting. I'm just writing something of the sort right now. It takes some information from the timeline
name, timeline metadata, and from the markers to build render paths, filenames, and render jobs.

Re: %markername as filename multiple clip export

PostPosted: Tue Mar 07, 2023 5:35 pm
by safron
I had a very similar desire to auto generate ~30 render jobs from marker start to end with the marker name as the filename.

I attached the simple python script I made to accomplish this for my use case in case someone has a similar desire

It only renders markers attached to clips since that was more convenient for my workflow but it wouldn't be hard to adapt it to include timeline markers

Code: Select all
C:/ProgramData/Blackmagic Design/DaVinci Resolve/Fusion/Scripts/Utility/ExportMarkers.py

#!/usr/bin/env python3
print("Running ExportMarkers Script")

# resolve2 = dvr_script.scriptapp("Resolve")

project = resolve.GetProjectManager().GetCurrentProject()

if not project:
    print("No project is loaded")
    sys.exit()

timeline = project.GetCurrentTimeline()

video_tracks = timeline.GetTrackCount("video")
audio_tracks = timeline.GetTrackCount("audio")

exports = []



for i in range(video_tracks):
    video_clips = timeline.GetItemListInTrack("video", i+1)
    for clip in video_clips:
        marker_offset = clip.GetStart()
        markers = clip.GetMarkers()
        if markers:
            # e.g. {'color': 'Blue', 'duration': 4906, 'note': '', 'name': 'Ambassadors of Audacity', 'customData': ''}
            for frame, marker in markers.items():
                if marker['duration'] > 1:
                    exports.append((frame, marker_offset, marker))


for i in range(audio_tracks):
    clips = timeline.GetItemListInTrack("audio", i+1)
    for clip in clips:
        marker_offset = clip.GetStart()
        markers = clip.GetMarkers()
        if markers:
            # e.g. {'color': 'Blue', 'duration': 4906, 'note': '', 'name': 'Ambassadors of Audacity', 'customData': ''}
            for frame, marker in markers.items():
                if marker['duration'] > 1:
                    exports.append((frame, marker_offset, marker))


for frame, offset, export in exports:
    print(frame, export)
    project.SetRenderSettings({
        "SelectAllFrames": False,
        "MarkIn": frame + offset,
        "MarkOut": frame + offset + export['duration'] - 1,
        "CustomName": export["name"],
    })
    project.AddRenderJob()

Re: %markername as filename multiple clip export

PostPosted: Tue May 09, 2023 2:17 pm
by dimsum
safron wrote:I had a very similar desire to auto generate ~30 render jobs from marker start to end with the marker name as the filename.


This is great! Exactly what I was looking for. Thanks so much for posting!

Here is a script for green timeline markers, if anyone may need it

Code: Select all
project_manager = resolve.GetProjectManager()
project = project_manager.GetCurrentProject()

timeline = project.GetCurrentTimeline()
markers = timeline.GetMarkers()

# get marker frames, green only and names
mf = []

for frame,marker in markers.items():
    if marker['color'] == "Green":
        mf.append((frame, marker['name']))

mf.append((timeline.GetEndFrame(),"end")) #add end

# iterate through list, skipping last item used only for end frame
for i in range(len(mf)-1):
        project.SetRenderSettings({
            "SelectAllFrames": False,
            "MarkIn": mf[i][0],
            "MarkOut": mf[i+1][0],
            "CustomName": f"{i:02}-" + mf[i][1],
        })
        print(i)
        project.AddRenderJob()

Re: %markername as filename multiple clip export

PostPosted: Thu Jul 13, 2023 5:10 am
by JasonTheRoberts
Hi I just made a vid showing how to do this with a LUA script so you don't have to install Python:

Re: %markername as filename multiple clip export

PostPosted: Mon Oct 21, 2024 3:29 pm
by DerPaule13
dimsum wrote:Here is a script for green timeline markers, if anyone may need it

Thank you! Unfortunately I couldn't get it to work for me.
Over at steakunderwater.com from user white_wizard I found another Py3 script that I modified a bit. This script is quite easy to use as all the individual parameters are at the top:

It renders all timeline markers with the specified color, uses their duration to set in and out points and uses their name for the exported file name. Specifying a Render Preset is also possible.
Important: It does NOT jump to the next timeline marker. Instead, it renders the duration of each individual timeline marker! (Use alt+left click on a marker to adjust its duration.)

I also added a prefix option for the file name and corrected a line so that all timeline markers are rendered if no color is specified.
I also added the list of timeline marker color names in the correct order so you don't have to look them up every time.

Code: Select all
#######CUSTOM PARAMETERS########
#Choose render path in delivery page first! Then:
marker_filter = 'Green' #choose which marker color to render. If no color is specified, all markers will get rendered.
#Timeline marker names in correct order are: Blue, Cyan, Green, Yellow, Red, Orange, Pink, Purple, Fuchsia, Rose, Lavender, Sky, Mint, Lemon, Sand, Cocoa, Cream
render_preset_name = '' #change this to the name of your render preset. Otherwise, the current settings will be used.
filename_prefix = '' #write something between quotes to add a prefix to the filename (e.g. 'Film 1 - ')
################################
 
pm = resolve.GetProjectManager()
project = pm.GetCurrentProject()
timeline = project.GetCurrentTimeline()
 
#set render preset
render_preset = project.LoadRenderPreset(render_preset_name)
 
#Get Markers
marker_offset = timeline.GetStartFrame()
markers = timeline.GetMarkers()
 
def renderjob_create( vfx_name, start_frame, end_frame ):
    render_settings = project.SetRenderSettings({'CustomName': vfx_name, 'MarkIn': start_frame, 'MarkOut': end_frame})
    project.AddRenderJob()  #add renderjob
 
for marker in markers:
    marker_color = markers[marker]['color']
 
    if not marker_filter or marker_filter.lower() == 'all' or marker_color == marker_filter:
        marker_name = markers[marker]['name']
        marker_startframe = marker + marker_offset
        marker_endframe = ( marker_startframe + markers[marker]['duration'] - 1 )
 
        print(f"Adding {marker_name} to Render Queue. Frames: {marker_startframe} - {marker_endframe}")
        renderjob_create(filename_prefix + marker_name, marker_startframe, marker_endframe)

Re: %markername as filename multiple clip export

PostPosted: Wed May 07, 2025 2:53 pm
by dsol1980
This guy's script works for any marker! use the scripting console Lua language and copy the code into there and voila you get a ton of render jobs in the cue based solely on timeline marker name.
https://jason-roberts-shop.fourthwall.c ... duct_shelf