Skip to content

Instantly share code, notes, and snippets.

@KristianLentino99
Created April 8, 2022 08:27
Show Gist options
  • Save KristianLentino99/30fb281f0225a7e401f79f3e9ec7491a to your computer and use it in GitHub Desktop.
Save KristianLentino99/30fb281f0225a7e401f79f3e9ec7491a to your computer and use it in GitHub Desktop.
commando to compress a video with ffmpeg library
import sys
import os
from os import path, system
pathFile = args[1]
outputFile = args[2]
print("Converto file "+pathFile)
ffmpegCommand = f'ffmpeg -y -threads 0 -i {pathFile} -c:v libx264 -x264opts \'keyint=24:min-keyint=24:no-scenecut\' -profile:v high -level 4.0 -vf "scale=min\'(720,iw)\':-4" -crf 22 -movflags faststart -write_tmcd 0 {outputFile}'
#folderModifiche = folderModifiche + nomeProgetto
command = ffmpegCommand
print(command)
os.system(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment