Uploading to Stream from Google Drive

Has anyone been able upload videos from Google Drive to Cloudflare Stream? I’ve got a bunch of videos which are taking aaaaages uploading from my harddrive (as per other threads).

They’re also on Google Drive but as there’s no .mp4 link from GDrive I don’t know if I can use the link option?

I didn’t try it out yet, but a workaround would be to upload the videos from Google Drive to YouTube and then from YouTube to Cloudflare Stream. Here’s a link to the Google Drive to YouTube part:

Check out the “Upload from a URL” API: https://api.cloudflare.com/#stream-videos-upload-a-video-from-a-url

You can get a URL for the file in Google Drive like describe in this article: https://dev.to/kojikanao/download-files-from-google-drive-with-curl-wget-5e4o and put the URL in the dashboard:

1 Like

I’m having difficulties with this… from googling and testing I’m almost positive it’s because of the no virus scan warning on files above 100mb in google drive. I successfully used this method with a 77mb video file but trying with all larger files pops the warning “Invalid URL (Code: 10010)”.

The curl and tuspy scripts that I’ve tried also seem to fail when trying to pull google drive videos, presumably also because of the virus scan warning.

Any known way around this? Would be nice to find a solution as I have many GB of video to move from google drive to cloudflare and it’s very painful downloading and re-uploading in the cloudflare UI.

Is there a way you can share an exmaple URL that fails for you so we can try to encounter the issue on our computers?

@renan sure.

You’re right, looks like the virus check steps prevents Stream from downloading the file.

I stumbled upon this article: https://medium.com/@philipplies/transferring-data-from-google-drive-to-google-cloud-storage-using-google-colab-96e088a8c041 and this simple code: https://colab.research.google.com/drive/1Xc8E8mKC4MBvQ6Sw6akd_X5Z1cmHSNca

Maybe one solution could be to transfer data from Google Drive to Google Cloud Storage (which I assume should be very fast since all is in Google’s infrastructure) and then use the public link from google cloud in Stream. This step should also be fast since all of the transfer happens in the cloud.

There are quite a few customers that use Google Cloud Storage to transfer videos to Stream, so once the videos are in Google Cloud from Google Drive, there should be no problems.

Do you think this is something you can try?

@renan well it’s better than what I’m doing now so I suppose it’s worth a try. Thanks for the link. I’ll give it a shot and updated here.

@violetasredojevic let us know if you succeed with this method!

Updating this for anyone who needs it. Cloud is indeed the way to go if your media is in google drive and files are above 100mb.

Expanding on the reply that @renan gave above:

If your files were in a shared folder, as was my case, copy them as original files to your own drive in colab: https://webapps.stackexchange.com/a/141694

Upgrade your storage size before doing this if you need to so you don’t run out of space mid-transfer.

Once they’re in your own drive move them to your cloud storage as linked above: https://medium.com/@philipplies/transferring-data-from-google-drive-to-google-cloud-storage-using-google-colab-96e088a8c041

Set your bucket to uniform access permissions so all objects in the bucket inherit the permissions, and grant the bucket public access to make the transfers: https://cloud.google.com/storage/docs/access-control/making-data-public#buckets

Objects are then assigned public URLs which are recognized by cloudflare stream’s URL uploader and I’m sure they’ll work programmatically as well.

Or use file-specific permissions if your case calls for it. Regardless remember to revoke public access in the cloud bucket after uploading to stream.

This is a million times faster than downloading from drive and uploading to stream through the ui.

HTH and thanks again @renan for pointing in the right direction.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.