This script may help people having less bandwidth but having large tutorial videos on their shared drive.
Below python (google colab) script converts your videos and store them on gdrive itself.
In my case tutorial videos are saved on shared drive and after conversion its saved into my personal gdrive.
After conversion 90mb files gets reduced to 12mb file.
import numpy as np
import os
#listOfFolders = !ls '/content/drive/Shared drives/Tutorials | Product of Web Premium. Pw/Learn Complete Python In Simple Way'
#print(listOfFolders)
#listOfFilesInsideFolder = !ls '''/content/drive/My Drive/Torrent/Python/3. Python Basics'''
filePath ='''/content/drive/Shared drives/learning/UDEMY/python-tutorials-for-by-navinreddy/'''
print("***********************************")
subfolders = list(filter(lambda x: os.path.isdir(os.path.join(filePath, x)), os.listdir(filePath)))
for j in subfolders:
from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(filePath+j+'''/''') if isfile(join(filePath+j+'''/''', f))]
print(onlyfiles)
for i in onlyfiles:
if i.endswith('''.mp4'''):
#print(i)
i=i.replace("\'","")
src = filePath+j+'''/'''+i
print("Source is --->",src)
try:
os.mkdir('''/content/drive/My Drive/python/'''+j)
except OSError as error:
print(error)
dest = '''/content/drive/My Drive/python/'''+j+'''/'''+i
print("Destination is --->",dest)
try:
os.system('''ffmpeg -i '%s' -s 720x480 -ar 44100 -async 44100 -r 29.970 -ac 2 -qscale 5 '%s' ''' %(src, dest) )
except OSError as error:
print(error)
else:
print("Files other than .mp4")
p.s. I am python beginner… so pardon me if any silly mistakes. Better approaches are always welcome.