Converting between video types¶
Problem statement¶
Screen recordings on a mac produce .mov files.
However video files are required to be in mp4 format to be playable on Domo.
Solution¶
This notebook is a proof of concept to convert video files from .mov to .mp4
Conditions¶
- Input .mov files should be stored on Google Drive
- Output .mop4 files will be written on to Google Drive
- Permissions granted to allow notebook access to Google Drive
In [ ]:
Copied!
!apt install ffmpeg
!pip install moviepy
!apt install ffmpeg
!pip install moviepy
Reading package lists... Done Building dependency tree Reading state information... Done ffmpeg is already the newest version (7:3.4.8-0ubuntu0.2). 0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded. Requirement already satisfied: moviepy in /usr/local/lib/python3.7/dist-packages (0.2.3.5) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from moviepy) (1.19.5) Requirement already satisfied: tqdm<5.0,>=4.11.2 in /usr/local/lib/python3.7/dist-packages (from moviepy) (4.41.1) Requirement already satisfied: decorator<5.0,>=4.0.2 in /usr/local/lib/python3.7/dist-packages (from moviepy) (4.4.2) Requirement already satisfied: imageio<3.0,>=2.1.2 in /usr/local/lib/python3.7/dist-packages (from moviepy) (2.4.1) Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from imageio<3.0,>=2.1.2->moviepy) (7.1.2)
In [ ]:
Copied!
from moviepy.editor import VideoFileClip
from moviepy.editor import VideoFileClip
In [ ]:
Copied!
# Mount for access to files on Google Drive
from google.colab import drive
drive.mount('/gdrive')
# Mount for access to files on Google Drive
from google.colab import drive
drive.mount('/gdrive')
In [ ]:
Copied!
video = VideoFileClip("/content/drive/MyDrive/Screen Recording 2020-07-28 at 4.00.14 pm.mov")
video = VideoFileClip("/content/drive/MyDrive/Screen Recording 2020-07-28 at 4.00.14 pm.mov")
In [ ]:
Copied!
# write out in mp4 type
video.write_videofile("/content/drive/MyDrive/Screen Recording 2020-07-28 at 4.00.14 pm.mp4")
# write out in mp4 type
video.write_videofile("/content/drive/MyDrive/Screen Recording 2020-07-28 at 4.00.14 pm.mp4")
99%|█████████▉| 2182/2207 [01:23<00:00, 27.45it/s] 99%|█████████▉| 2185/2207 [01:23<00:00, 27.07it/s] 99%|█████████▉| 2188/2207 [01:23<00:00, 26.26it/s] 99%|█████████▉| 2192/2207 [01:24<00:00, 26.15it/s] 100%|█████████▉| 2196/2207 [01:24<00:00, 27.00it/s] 100%|█████████▉| 2199/2207 [01:24<00:00, 27.41it/s] 100%|█████████▉| 2202/2207 [01:24<00:00, 26.72it/s] 100%|██████████| 2207/2207 [01:24<00:00, 26.08it/s]
[MoviePy] Done. [MoviePy] >>>> Video ready: /content/drive/MyDrive/Screen Recording 2020-07-28 at 4.00.14 pm.mp4
In [ ]:
Copied!