omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    3
    5
    4159
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • NoBetterName
      NoBetterName last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        there is a special process for videos. See
        https://gist.github.com/jsbain/de01d929d3477a4c8e7ae9517d5b3d70

        on 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.

        1 Reply Last reply Reply Quote 0
        • abcabc
          abcabc last edited by

          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

          1 Reply Last reply Reply Quote 0
          • NoBetterName
            NoBetterName last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors