Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Save video from camera roll
-
I have the user select an image through ui.pick_image(). I have the code to save a photo to a special folder in my app. If they pick a video, though, I can't save it to the folder. They already typed in the name and everything. What do I have to do to save an .mov file from the camera roll to this folder?
-
there is a special process for videos. See
https://gist.github.com/jsbain/de01d929d3477a4c8e7ae9517d5b3d70on line 40 you could just use
shutil.copy(str(A.resolvedURL().resourceSpecifier()), destination)
or else use the the file object on line 47 to fread from, and write to a new file. -
You may also look at this discussion.
https://forum.omz-software.com/topic/3728/having-trouble-writing-a-video-file-to-local-storage-ends-up-corrupted -
Thanks everybody for your quick replies. I need a way to add anything selected from the pick_asset function to a folder in my app. I can't have it ever fail, because I intend to release this app. @omz said that that function won't work for time lapse videos. Is there a completed function out there that somebody made that I can modify to what I need? I don't even know where to start with modifying that to allow storing time lapse videos. Could anybody at least get me started in the right direction?
-
@omz's approach should work fine, as long as you use the returned filename to derive the filename to write, instead of forcing an m4v filename (i.e use os.path.split). Timelapses seem to be .mov files, but in my quick testing seems to copy just fine.