Skip to content

Instantly share code, notes, and snippets.

@wuziq
wuziq / Timer.cpp
Created May 21, 2021 20:24 — forked from mcleary/Timer.cpp
C++ Timer using std::chrono
#include <iostream>
#include <chrono>
#include <ctime>
#include <cmath>
class Timer
{
public:
void start()
{
@wuziq
wuziq / ffmpeg-watermark.md
Created December 14, 2020 19:40 — 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.

@wuziq
wuziq / git diff patch between branches.md
Created November 13, 2020 23:13 — forked from patkujawa-wf/git diff patch between branches.md
If you want to get the difference between two branches as a diff patch

If you want to get the difference between two branches, say master and branch-name, use the following command: git diff master..branch-name

If you want that same diff in a patch, because patches are handy, just add the output redirect: git diff master..branch-name > branch-name.patch

If you need to import that patch into something like Crucible then you'll need to get rid of the a and b prefixes that git adds: git diff --no-prefix master..branch-name > branch-name.patch

@wuziq
wuziq / building transmission
Created September 21, 2019 04:34
how to build transmission with openssl
brew install/upgrade openssl
homebrew tells you where it's installed and what LD/CPP flags to use. for me it was:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
seems that transmission is also looking for OPENSSL_ROOT_DIR, so:
export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
@wuziq
wuziq / encode.sh
Created September 2, 2018 03:16 — forked from mikoim/README.md
YouTube recommended encoding settings on ffmpeg (+ libx264)
#/bin/sh
ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low output
@wuziq
wuziq / nv21-convert.sh
Created August 23, 2017 17:39 — forked from neilpa/nv21-convert.sh
Use ffmpeg to convert raw Android camera frame buffers
# Assuming the raw byte[] buffer from onPreviewFrame was written at $1
INPUT=$1
# Need preview size since we dumped to a raw file w/out header info
SIZE=1280x960
# Converting to JPEG
ffmpeg -f image2 -vcodec rawvideo -s $SIZE -pix_fmt nv21 -i $INPUT out.jpeg
# Converting to PNG
@wuziq
wuziq / .vimrc
Last active August 29, 2015 14:23 — forked from rocarvaj/.vimrc
" VIM Configuration File
" Description: Optimized for C/C++ development, but useful also for other things.
" Author: Gerhard Gappmeier
"
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)