This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/python3 | |
| import subprocess | |
| import shlex | |
| import json | |
| # function to find the resolution of the input video file | |
| def findVideoMetada(pathToInputVideo): | |
| cmd = "ffprobe -v quiet -print_format json -show_streams" | |
| args = shlex.split(cmd) | |
| args.append(pathToInputVideo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # My project directory is /home/rahit/www/mysite. I am storing cache file in my project folder under cache folder. | |
| # You can use any of your prefered location in system. may be: /tmp/nginx | |
| # I am naming keys_zone name my_cache. You can give it yours. We will need it later on in proxy_cache. | |
| # Just make sure you put same zone name there | |
| proxy_cache_path /home/rahit/www/mysite/cache levels=1:2 keys_zone=my_cache:10m max_size=1G; | |
| # This is our media server, which will be used to resize and crop. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python2 | |
| # Requires: PIL, colormath | |
| # | |
| # Improved algorithm now automatically crops the image and uses much | |
| # better color matching | |
| from PIL import Image, ImageChops | |
| from colormath.color_conversions import convert_color | |
| from colormath.color_objects import LabColor | |
| from colormath.color_objects import sRGBColor as RGBColor |