Skip to content

Instantly share code, notes, and snippets.

@ammar-faifi
Created July 28, 2023 07:44
Show Gist options
  • Save ammar-faifi/f58aa799918bac7de3e9457a8cce9d40 to your computer and use it in GitHub Desktop.
Save ammar-faifi/f58aa799918bac7de3e9457a8cce9d40 to your computer and use it in GitHub Desktop.
Read and convert `.mov` video into `.mp4` extension
from moviepy.editor import VideoFileClip
def convert_mov_to_mp4(input_file, output_file):
try:
video_clip = VideoFileClip(input_file, target_resolution=(1920, 1080))
video_clip.write_videofile(
output_file,
codec="libx264",
audio_codec="aac",
)
video_clip.close()
print(f"Conversion successful! {input_file} converted to {output_file}")
except Exception as e:
print(f"Error converting the file: {e}")
if __name__ == "__main__":
input_file_path = "./Stories/July/27/IMG_6194.MOV"
output_file_path = "./Stories/July/27/output.mp4"
convert_mov_to_mp4(input_file_path, output_file_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment