Sometimes, when it comes to editing video in Blender, you might want to move your footage media files from one location to another. Such manipulations usually breaking the project file, because the sequence strips still referencing the old paths. Of course it is possible to fix the paths manually by rewriting it for each strip, but that’s really tedious for big projects.
So, we have created a simple script, which searches the paths of all sequence strips for particular text and replaces it with another text.
Download script: ReplacePaths.py
How to use it:
- Open the script in Blender’s Text Editor window.
- Change the ‘oldpath’ and ‘newpath’ variables according to your needs. The ‘oldpath’ variable represents the text to search, this text will be replaced with the value of ‘newpath’ variable.
- Then choose “Text” -> “Run Script” in the menu of Text Editor window, or just hit Alt+P.
Below you can see a video demonstration with detailed explanation of how it works.
12 Responses
Thanks a lot!
Do you thing your script is still working? I got some error … Thank you for help
Traceback (most recent call last):
File “/Users/filip/Dropbox/Public/master.blend/ReplacePaths.py”, line 31, in
File “/Users/filip/Dropbox/Public/master.blend/ReplacePaths.py”, line 15, in do_replace
AttributeError: ‘SoundSequence’ object has no attribute ‘filepath’
Error: Python script fail, look in the console for now…
Hello Filip! Thank you for reporting! I have made a fix for the script. Please re-download it and try again – https://raw.githubusercontent.com/morevnaproject/scripts/master/blender/ReplacePaths.py
Thanks for your attention, but also this version is not working on my mac. Error didnt appear, but also happened nothing. Console (or Terminal in my case) left this action without any reaction. So I don’t know how can I help now. I found addon “Path Editor”, that nicely change paths to a source, but if I have changed a name of source file, than I felt in a troubles. This addon stores each strip in separate field in a list so I have to manually insert copied path to these fields to get what I need. That’s not really for bigger project. http://blender-addon.blogspot.cz/2014/04/addon-blender-path-editor-05.html
Can you please record a video of your screen when you use our script? That way I can try to determine what’s wrong. Alternatively, you can send me a file of your project (without all linked files), so I can try the script myself. ^__^
P.S. By chance, do you use Meta Strips in your project?
video yes, metastrip no … blender 2.78c, tested also with Factory Setting
https://www.dropbox.com/s/5lzrw0rcrsdgb5p/ReplacePath.mp4?dl=0
(if you don’t have dropbox account just skip login window by small text at bottom)
Hello Filip! Thank you for providing a video. I found that there is an issue with handling images (and image sequences). The problem is that any image strip (or image sequence strip) in blender editor stores filename and filepath separately.
I.e. for “/Users/filip/A.png” it stores “A.png” in filename property and “/Users/filip/” in filepath property. Those strings are located in different places, so when the script tries to find “/Users/filip/A.png” then in finds nothing. With images you can replace only by filename “A.png” -> “B.png” or only by directory “/Users/filip” -> “/Users/john”. That’s how it works in Blender.
I’ve just published an updated version of the script, which allows to replace data inside of MetaStrips. ^__^
OK, so your script can be used for video only. OK. Primarily it wa say goal. Sometimes I have also image used in more than one strip, but not so often. Would be great to have one simple function for replacing external link. OK. I will try your script on video file. Thank you
I can’t edit my post, so just want to say thank you it works for video 🙂
unfortunately this doesn’t work anymore with the latest versions