4
$\begingroup$

I used a video file in the VSE which is cut into many parts. When the project grew, I needed to reorganize the linked files. I renamed this video file. Now Blender doesn't see this file anymore.

enter image description here

In Motion5, there is a function "Replace Media" that lets you replace external files used in many strips by new ones for the whole project.

Does something similar exist in Blender by default or does anybody know a script that can do this?

$\endgroup$
2
  • 1
    $\begingroup$ Have you tried File->External Data->Find Missing Files? It should work on vse files. $\endgroup$
    – sambler
    Commented Oct 22, 2015 at 14:17
  • $\begingroup$ "Find Missing Files" function searches for files with the original file name. I need to replace the original file by file with different name. If it would be only one strip I can change only path to the file with changed name, but there are many strips using the same source file. $\endgroup$
    – vklidu
    Commented Oct 22, 2015 at 15:22

2 Answers 2

2
$\begingroup$

It maybe really outdated answer, but I think a described problem a pretty wide for everyone who works in Blender VSE. So I modified a script from @Samoth, so it only process Image Strips and Movie strips, be able to replace parts of the paths, work not only with filepaths abut also with directory paths. Tested on Blender 3.1.2

import bpy
old_name = 'old_path_frament'
new_name = 'new_path_fragment'
for seq in bpy.data.scenes['VSE'].sequence_editor.sequences_all:
    if type(seq) is bpy.types.ImageSequence:
        if seq.elements[0].filename.find(old_name) >= 0:
            seq.elements[0].filename = seq.elements[0].filename.replace(old_name, new_name)
        if seq.directory.find(old_name) >= 0:
            seq.directory = seq.directory.replace(old_name, new_name)
    if type(seq) is bpy.types.MovieSequence:
        if seq.filepath.find(old_name) >= 0:
            seq.filepath = seq.filepath.replace(old_name, new_name)
        
$\endgroup$
2
  • $\begingroup$ Thanks for enhanced script version :) At the same time - it is sad we still need to work this way 7 years later yet. BTW a path can be changed by File > External Data > Find Missing Files ... but yes if they are not missing (or instead moving them for such purpose) script could be better way. Also blender has an addon Batch Rename, but sadly it handles only data blocks. $\endgroup$
    – vklidu
    Commented Jun 8, 2022 at 11:03
  • $\begingroup$ Thanks for reviewing my script version. I tested it on my project, but it can have errors, despite its simplicity. My case is exactly like you described. I have long video with about 15 channels, holding many small parts, linked to several folders with images and movie clips, so after i changed project directory structure, it was really difficult to fix all the paths manually. So i found this thread, and started to modify script, because I have not only images and movies, but also effects strips, color strips and other types. This is the reason I added strip type filters. $\endgroup$
    – scadl
    Commented Jun 8, 2022 at 12:56
4
$\begingroup$

You can set the filepath attribute on your sequences with python:

import bpy
for seq in bpy.data.scenes['Scene'].sequence_editor.sequences_all:
    if 'image_a' in seq.elements[0].filename:
        seq.elements[0].filename = "image_b.png"

You can optionally change the files location setting seq.directory if needed.

$\endgroup$
4
  • 1
    $\begingroup$ Script fails in both cases, can you be more descriptive? Thank you for help. blend: dl.dropboxusercontent.com/u/55113627/%3E%20Blender/… screen: dl.dropboxusercontent.com/u/55113627/%3E%20Blender/… $\endgroup$
    – vklidu
    Commented Nov 21, 2015 at 1:39
  • $\begingroup$ Well, that's much better - providing a "test" file with your problem always helps so much more - great job! I updated the answer, it's working now with your blend file. Btw: you can use blend-exchange.giantcowfilms.com to upload a blend-file and use the insert image function here on stackexchange. Would be good if you'd update your question with your image - as good images always help for a better understanding of what you want to achieve. $\endgroup$
    – Samoth
    Commented Nov 21, 2015 at 9:22
  • $\begingroup$ Yeah, thank you very much :) now it works. Would be great to have a button for that :) But I will definitely save your script. And sorry if it wasn't enough clear from question. BTW what is zero in your script? $\endgroup$
    – vklidu
    Commented Nov 22, 2015 at 0:02
  • $\begingroup$ You mean the indices [0]? That's the first (zero based) element in a list of many. A sequence may consist of more than one file (e.g. a image sequence) with different names, but in your case as you use a video source only one file is used per sequence, so only this single one has to be altered. $\endgroup$
    – Samoth
    Commented Nov 22, 2015 at 0:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .