In Blender how I can get an ImageSequence source filename in video editor (VSE)?

77 Views Asked by At

In Blender, when you use Video Editor (VSE), you can parse items using Python like this :

import bpy
import os

for seq in bpy.context.sequences:
  sFull_filename = ""
  if seq.type == "MOVIE":
    sFull_filename = seq.filepath
  if seq.type == "SOUND":
    sFull_filename = seq.sound.filepath
  if seq.type == "IMAGE":
    sFull_filename = "??"  # How to get it for images ?
    sName = seq.name       # /!\ It is not the file name !
    sPath = seq.directory
  # Finally
  sAbsolute_name = bpy.path.abspath( sFull_filename )

As you can see, I get the filename for movies and sound, but how can I get it for images ?

On Blender api documentation website I don't found how to do it...

I try to get VSE images strip file names...

1

There are 1 best solutions below

1
Marcin Orlowski On BEST ANSWER

You can get the names from elements list of seq:

    ...
    elif seq.type == "IMAGE":
        # Get the first image filename
        sFull_filename = os.path.join(seq.directory, seq.elements[0].filename)  

    sAbsolute_name = bpy.path.abspath(sFull_filename)
    print(sAbsolute_name)

or if you want them all, iterate over seq.elements