I'm trying to upload a video with a shareable link using Pydrive, but when I try to see the video using the link I get an error message: couldn't process the video.
I've tried with a small size video (7MB) and using different formats, such as MP4, WEBM, and MOV. But I get the same error. I wonder if you could help me. I really appreciate it.
Here is my code:
folderName = 'Videos'
folders = drive.ListFile({'q': "title='" + folderName + "' and mimeType='application/vnd.google-apps.folder' and trashed=false"}).GetList()
for folder in folders:
if folder['title'] == folderName:
folderId = folder['id']
import glob, os
os.chdir("C:/upload_recording/videos")
for file in glob.glob("*.webm"):
with open(file,"r") as f:
fn = os.path.basename(f.name)
file_drive = drive.CreateFile({'title':fn,'parents': [{'id': folderId}], 'copyRequiresWriterPermission': True, 'writersCanShare': False})
file_drive.Upload()
file_drive.InsertPermission({
'type': 'anyone',
'value': 'anyone',
'role': 'reader'})
files = drive.ListFile({"q": "'" + folderId + "' in parents and trashed=false"}).GetList()
for file in files:
keys = file.keys()
if file['shared'] and 'alternateLink' in keys:
link = file['alternateLink']
else:
link = 'No Link Available. Check your sharing settings.'
name = file['id']
print('name: {} link: {}'.format(name, link))