Project Management


#ffmpeg


Trulli

To compression is crucial for Project Management


Trulli

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 11 22:52:36 2022

@author: clc
"""

print("hello world~!!")
import os
path="./"
dir_list = os.listdir(path)
print(dir_list)
mov=[]

for i in dir_list:
    if ".mov"  in i  or "mp4" in i :
        mov.append(i)

print(mov)
cwd = os.getcwd()
print(cwd)
try:
    os.mkdir(cwd+"/compressed")
except:
    print("the folder is existed")
run_code='cd ffmpeg -- ffmpeg -i *% -b 800k *compressed/^.mp4'


for i in mov:
    run_code='ffmpeg -an -i *% -vcodec libx264 -b:v 1000k -vf scale=-2:1080  *compressed/^'
    run_code=run_code.replace("%",i)
    run_code=run_code.replace("^",i.replace("mov","mp4"))
    run_code=run_code.replace("*",cwd+"/")
    print(run_code)
    import subprocess
    result = subprocess.call(run_code, shell=True)
    print(result)
    


Sept 14 2022