Skip to content

Instantly share code, notes, and snippets.

@xarimanx
xarimanx / ffmpeg-watermark.md
Created September 24, 2019 14:16 — forked from bennylope/ffmpeg-watermark.md
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.

@xarimanx
xarimanx / bash.txt
Created December 4, 2018 23:13
change owner of tables
$ for table in `psql -tc "select tablename from pg_tables where schemaname = '${SCHEMA}';" ${DB}` ; do psql -c "alter table ${SCHEMA}.${table} owner to ${OWNER}" ${DB} ; done
@xarimanx
xarimanx / prawn_stamp.rb
Created November 13, 2018 12:30 — forked from henrik/prawn_stamp.rb
Rotate and center text with Prawn as a watermark, e.g. for "[PAID]" on an invoice.
create_stamp("stamp") do
fill_color "cc0000"
text_box "[PAID]",
:size => 2.cm,
:width => bounds.width,
:height => bounds.height,
:align => :center,
:valign => :center,
:at => [0, bounds.height],
:rotate => 45,
#!/bin/bash
cat /path/to/public_key | ssh root@yourdokkuinstance "sudo sshcommand acl-add dokku [description]"
@xarimanx
xarimanx / file_check.js
Last active May 23, 2016 16:23
check file size and info
#preview img{height:100px;}
<input id="browse" type="file" multiple />
<div id="preview"></div>
window.URL = window.URL || window.webkitURL;
var elBrowse = document.getElementById("browse"),
elPreview = document.getElementById("preview"),
useBlob = false && window.URL; // `true` to use Blob instead of Data-URL
function readImage (file) {
triggerMousemove = (x, y, target)->
triggerEvent({ pageX: x, pageY: y, target: target }, "mousemove")
triggerMousedown = (target)->
triggerEvent({ target: target }, "mousedown")
triggerMouseup = ->
triggerEvent({}, "mouseup")
triggerEvent = (props, name)->
@xarimanx
xarimanx / base_doc.rb
Created December 22, 2015 13:05 — forked from iliabylich/base_doc.rb
Apipie concerns
# A common concern,include into all doc modules
#
module BaseDoc
include Apipie::DSL::Concern
def namespace(namespace, options = {})
@namespace = namespace
@namespace_name = options[:name]
end
attr_reader :namespace_name
@xarimanx
xarimanx / ffmpeg-join.txt
Created December 17, 2015 08:57
ffmpeg video join
mkfifo intermediate1.mpg
mkfifo intermediate2.mpg
ffmpeg -i vv1.mp4 -qscale:v 1 -y intermediate1.mpg < /dev/null &
ffmpeg -i vv2.mp4 -qscale:v 1 -y intermediate2.mpg < /dev/null &
cat intermediate1.mpg intermediate2.mpg |\
@xarimanx
xarimanx / git-deletealltags.bsh
Created December 9, 2015 13:51
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done
# and for local
for t in `git tag`
do
git tag -d $t