Skip to content

Instantly share code, notes, and snippets.


Ben Lopatin bennylope

View GitHub Profile
bennylope /
Created Apr 22, 2016 — forked from webkader/
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

bennylope /
Last active Oct 20, 2022
PostgreSQL migration script, Heroku -> Crunchy
#!/usr/bin/env python
import argparse
import os
import subprocess
import sys
import time
# Required so we don't generate tons of logs during restore
disable_logging_sql = "ALTER USER postgres RESET pgaudit.log;"
bennylope / gist:1894706
Created Feb 23, 2012
Canonical URLs with Jekyll
View gist:1894706
<link rel="canonical" href="{{ page.url | replace:'index.html','' }}" />
bennylope / LICENSE
Last active Aug 3, 2022
Django file that loads environment variables from a .env file per Honcho/Foreman
Copyright the authors of Honcho and/or Ben Lopatin
Licensed for reuse, modification, and distribution under the terms of the MIT license
function slacktime
while read line;
if [ (string match "*WORKTIME" "$line") ]
echo $line
end < /etc/hosts > /tmp/hosts
sudo cp /tmp/hosts /etc/hosts
bennylope / remotefiles.conf
Created Oct 19, 2011
nginx remote file proxying
View remotefiles.conf
location ~* ^/remote-files/(http[s]*://)(.*?)/(.*) {
# Do not allow people to mess with this location directly
# Only internal redirects are allowed
# nginx has to be able to resolve the remote URLs
# Location-specific logging
#access_log /usr/local/etc/nginx/logs/internal_redirect.access.log main;
from functools import wraps
def annotated(annotation_name):
Decorator for returning pre-calculated, annotated values
This should be used with model instance methods that fetch some
kind of related or calculated data. If the method is called on
a single instance in isolation, we should expect the method to
bennylope / ansible.yml
Created Apr 30, 2014
Deployment w/ Capistrano style deployments with Ansible & Capistrano
View ansible.yml
- name: Deploy new site release
user: deployer
hosts: all
- name: Fetch repo updates
git: >
bennylope /
Last active Aug 20, 2020
Create a named database and restore from the lastest downloaded file
#!/usr/bin/env bash
LATEST_DB="$HOME/Downloads/$(ls -t ~/Downloads | head -1)"
echo "Creating database name $DB from $BACKUP_PATH"
import requests
class RemoteFile:
Context manager for handling remote OR local files
Can be used like so:
>>> with RemoteFile("/path/to/local/file.txt") as f: