/insta360-auto-converter

Automatically take insv(p) files from google drive and convert them to 360 mp4(jpg) and upload to google photos in docker

Primary LanguageHTMLCreative Commons Zero v1.0 UniversalCC0-1.0

insta360-auto-converter

Automatically take insv (insp) files from google drive and convert them to 360 mp4 (jpg) and upload to google photos

image

Why this project?

I have a insta360 one X, and I record with it very often, I got full 128GB insv (insp) files almost every trip.

Pain points:

  1. To convert 128GB files to mp4 means I need ~128x2 = 256GB free on my mac which is sometimes too much.
  2. Using the official 360Studio software to convert them will cost high CPU usage, almost can't do other things.
  3. I'll have to upload them to google photos to enjoy the 360 experience in cardboard or on my phone/mac, but using the google photos web UI is a terrible experience.

Prerequisite:

  1. You know what python3 and docker are and how to run them.
  2. You have enough space for your google drive and photos (Gsuite for biz for education).
  3. You have a cloud linux machine which can run docker (or a spare mac to run it 24/7), ex: AWS EC2, Google cloud instance...

Getting Start:

  • Clone this project to your instance that runs the docker or (download the zip)

  • Due to security and NDA issues, you have 4 sub tasks to do which might take a while, but if those pain points can be eliminated, I think it's worth it.

  1. Follow the guide to get insta360 Media SDK (link)
  2. Follow the guide to get your own Google Drive service account credential. (link)
  3. Follow the guide to get your own Google photos OAtuh credential. (link)
  4. Follow the guide to setup the config files (link)

Put it all together

  1. Check if you are ready to build the docker image

    • MediaSDK folder is in this project folder insta360-auto-converter
    insta360-auto-converter
    ├── Dockerfile
    ├── MediaSDK
    └── apps
    
    • You followed the guide above and have the metadata folder somewhere else, ex: /Users/wmou/Documents/insta360-auto-converter-data, please keep in mind that files in this folder are confidential to you, DO NOT SHARE WITH OTHERS!
    insta360-auto-converter-data
    ├── auto-conversion.json 
    ├── configs.txt 
    └── gphotos_auth.json 
    
  2. Build the docker image under the folder which contains the Dockerfile, the last "." is required.

$ sudo docker build -t insta360-auto-converter .
  1. run the docker image as container please note that the folder you mount with -v should be your own metadata folder.
$ sudo docker run -d -v /Users/wmou/Documents/insta360-auto-converter-data:/insta360-auto-converter-data insta360-auto-converter

Where/How do I put insv (insp) files on the Google Drive?

  1. In the google drive setup sub task, you should have a working folder, then upload a folder under that working folder, which contains your insv (insp) files.
  2. Then this auto-converter will automatically upload the mp4 (jpg) to the Album of your google photos as the same name as the subfolder you uploaded.
  3. for example, "inst360_autoflow" is my working folder, then sub folder will be “測試1_360raw", and contains with many insv, insp files.

image

Multi-process

  • You can run multiple docker containers on different instance for the same google account, there's a task management based on flag-files on google drive, so N docker containers are less likely getting the same insta file to work. (There's still a chance but only wasting some computing power for the cheap task management implementation.)

Bug fix release notes:

  • Nov. 25, 2020
    • fix on stall of video conversion, some error handling added
    • using resumable upload to google photos, >2GB files now supported

Limitations:

  1. HDR photos can not be merged in the MediaSDK until they support it, so some of photos will not be stabilized.