Has anyone had any luck working with Burst mode files?
I have a script that I use to FTP photos for backup purposes. I've finally noticed that the burst files I have shot, only provide one image of the 'n' images that actually exist.
I haven't found any discussion regarding the iOS burst mode and the photos library, or anything else.
Since my target machine is Windows, I would like to save each individual "sub-image" as a separate photo for FTP and backup purposes, as an HEIC burst container will probably not be of much use on my Windows machine.
Thoughts? Places to explore for more info? Anything at all?
Thanks in advance,
@JonB - Thanks for the interest.
I found a work flow that does include my INI files.
The curious thing is about this is by "select"-ing the full directory does include the INI file when opening in Pythonista. However, if you merely open the directory (and then view all of the individual files within the directory), the INI file(s) and in my case README is grey and un-selectable (if that is a word). If you then click "select all", you do not get the INI file(s) or README.
I do not quite understand why this would be the case, but there is an actual, reasonable path for me to move forward.
The integration took me a while to figure out, but only because it was so simple that I never considered it. Very nice integration work.
I've recently been using Working Copy as a means of distributing code between devices and with the new integration it works wonderfully (as I am slowly learning). However,...
Working Copy does not allow me to move my config.ini into Pythonista and thus breaks my code, or at least it will no longer run.
Question: What am I doing incorrectly, or barring that what is the work around to move non-py/config files from Working Copy into Pythonista?
Thank you in advance,
@ccc: Sorry for the long delay.
I finally had some time to work on this and just finished running a full batch from my iPad mini.
I copied 1803 files, 32 of which are videos. The total time (not overly scientific, but with a simple take a time at the beginning and end to calculate the delta) was 28minutes and 34 seconds.
I've done nothing to optimize this, but it does work and that's not awful for a first attempt.
Thanks again for the help!
I have the video copy code in my ftp app. It now copies video files (MOV) over ftp to the server and the videos play perfectly.
So, thank you for the pointer. It works.
While attempting to understand the code I found myself stumbling on what was happening with the asset. A group of videos is sent to the script, they are then each processed by standard PHIImageManager into what appears to be an AVAsset rather than a Photos.Asset. I am guessing that is required to get at the video data. What is missing on the server side are the other meta-data (video creation date, etc.) that the AVAsset seems to imply should be there. So, the video data is copied, and nothing else. Ideas on improving this to get everything across, including meta-data.
This seems to work for a block of video assets, it would be nice to have it handle a single video file as well. Other than packing up a single video file asset into a collection (having only one element) and passing that to the script, does anyone understand what is happening in the OS enough to make the sample gist above work for just one file at a time?
Those are picky "wishlist" things, but I am investigation them for completion sake.
Finally, once again, thanks to everyone for their amazing pointers and help.
@cvp: No problem, I appreciate the time and effort.
@jonb: The linked code worked just as advertised. I have no experience, yet, with the real internals of iOS, nor with video files. I'm sure that there is a very good reason why videos are handled so much differently than pictures, but at some level they are all just files. Regardless, the code works and I can incorporate it into my existing solution. Thanks for the mind share!
Thanks for the input. I used your script from above and I get the same problem that I've grown to expect. It seems that get_image_data only returns the first frame (or something). A file with the correct name is created on the FTP server just as expected, however, the contents are not that of a valid video (.MOV). In fact the file size is approximately 110Kb on my Windows machine and that is rather small for a 30 second video.
This brings me back to the original problem.
I will try copying the video file from the photo assets to a sandbox/local directory and then pass that on to the FTP server.
I follow this for assets of type image (re: photos), however, this method just doesn't work for video.
Yes, I was attempting to open the video using the filename, and then use that binary file object as the direct source of sending it via FTP to the server. Although I can open the video file by name the FTP server says it cannot find the file of the same name.
video_filename = str(ObjCInstance(asset).filename())
video_file_object = open(video_filename, 'rb') #this is succesful
ftp.storbinary("STOR "+video_target_filename, video_file_object) #video file object has read method so it should work
This results in a file not found error for the video_filename.
My overall question is what is the preferred/best method of copying a video file via FTP since get_image_data doesn't work?
No, I did not copy the file locally. Since I had the filename I figured I would open it and use it. That is beginning to sound naive.
Does the step-by-step process have to look something like this:
- Get video filename
- Open video file.
- Save the video file someplace local (to the app/sandbox).
- Close the video file.
- Re-open the newly created video file in local-space and then hand that local-space video file to FTP
Is this close? If so, is there a better way? If not... gadzooks.
Thanks for putting up with my inane questions.