a few weeks ago i posted a thread on the flame forum asking how to export a clip in half resolution.
I managed to write a python script following the suggestion that Fred Warren gave me and i finally got to something that works.
Right now the script do the following step:
- create a new library
- create a new folder in the library
- copy a selected clip to the folder just created
- reformat by half
- export the clip with the new res to a default folder
- delete the lib just created
Since i’m not a good programmer at all, i “stitched” part of code here and there and i put together a code that works but that needs to be clean up, optimize and commented. Is anybody willing to have a look and help me with the fine tuning? I think i made a bit of a mess with the part where i have to pass the new location of the clip that i’ve copied. What would be the best way to proceed in order to share a decent script to the forum? Post it here or send it via PM to anybody willing to help?
Speaking of exporting half resolution… is there a way in python to extrapolate the proxy as you would do tool → clip → proxy extract and then export that to some location?
Thanks again Fred for the help,
Nice!!! You can absolutely post the .py file here as an attachment.
it says that i can’t upload files because i’m a new user.
Hmmm… did you try to upload earlier or j just now? I just tweaked something. I’m standing by.
Just now, still not working.
Thanks for your patience. Sometimes the site thinks new users attaching files is a bot or spam. As I check out the log files I just promoted you so if you wouldn’t mind trying again I’d appreciate it.
You are posting a .py right?
export_half_res.py (7,1 KB)
Yes, now it’s working. Thanks!
I just took a quick peek at your script. A few things that might help:
I would put your export_movie and export_movies functions inside of the ExportHalfRes class.
Instead of using globals, add self. to some of the variables. such as export_root. So instead of export_root it would be self.export_root. By adding self. to the variable it makes it part of the class which will allow it to be passed around to the different functions within the class without the need of using globals.
You could also probably skip the steps of creating a new library and folder and then deleting it later. Instead, just duplicate and resize the clip in the same location as the original and then just delete the newly created half res clip when the export is done. That would simplify things a bit.
You could something like this:
- duplicate your selected clip
self.new_clip = flame.duplicate(self.clip)
- after you set your resize variables, use this to resize
self.new_clip.reformat( width = half_res_x, height = half_res_y, ratio = 1.778)
- delete resized clip after export is done
i’ll work on it right away.
I had the feeling that putting all those global variables wasn’t a good idea
I copied in a different library to avoid two clip with the same name in the same folder, but with the duplicate function it should work.
Thanks also for the explanations and suggestion, very useful in this part of learning!
So, here is an update of the previous version.
export_half_res_v0_2.py (3,2 KB)
I followed Mike’s suggestions and i think that now is much cleaner.
In the part of the script, where it does the reformat, i’ve included to use the same ratio from the clip, so it should work in every scenario.