Skip to content

Instantly share code, notes, and snippets.

View Inge1234567890's full-sized avatar

Inge1234567890

View GitHub Profile
@Inge1234567890
Inge1234567890 / compress_video.py
Created August 6, 2022 08:44 — forked from ESWZY/compress_video.py
An example Python code for compressing video file to target size.
# Simplified version and explanation at: https://stackoverflow.com/a/64439347/12866353
import os
import ffmpeg
def compress_video(video_full_path, size_upper_bound, two_pass=True, filename_suffix='cps_'):
"""
Compress video file to max-supported size.
:param video_full_path: the video you want to compress.
:param size_upper_bound: Max video size in KB.