Iterating through video files in Google Drive after Mounting the Drive in Google Collab

Viewed 12

I have 100 or so .mov video clips that I need to convert into .mp4 format. I have a function that takes in a .mov file and does that. But I am having a hard time iterating through the files in Google Drive through Google Collab. I created a "TestFolder" in my Google drive with one clip to test it out. I was able to mount my Google drive using the following code:

from google.colab import drive
drive.mount('/content/drive/')

In order to iterate through the folder, I tried using the code below:

import glob    
path = '/content/drive/MyDrive/TestFolder/*.*'
for file in glob.glob(path):
  mov_to_mp4(file,output="/content/drive/MyDrive/TestFolder/testvideoout.mp4")

print("Finished Converting")

When I run the cells, I am not seeing any errors. The function runs but I am not seeing the converted mp4 files.

I tested out the function locally on my computer and that seems to be working fine so I think my issue is that I am unable to iterate through the files in the Google Drive. I appreciate any details from anybody. Thanks in advance.

0 Answers
Related