Skip to content

Instantly share code, notes, and snippets.

@wuziq
wuziq / Timer.cpp
Created May 21, 2021 — forked from mcleary/Timer.cpp
C++ Timer using std::chrono
View Timer.cpp
#include <iostream>
#include <chrono>
#include <ctime>
#include <cmath>
class Timer
{
public:
void start()
{
@wuziq
wuziq / ffmpeg-watermark.md
Created Dec 14, 2020 — forked from bennylope/ffmpeg-watermark.md
FFmpeg add a watermark to video
View ffmpeg-watermark.md

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 Nov 13, 2020 — forked from patkujawa-wf/git diff patch between branches.md
If you want to get the difference between two branches as a diff patch
View git diff patch between branches.md

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 Sep 21, 2019
how to build transmission with openssl
View building transmission
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 Sep 2, 2018 — forked from mikoim/README.md
YouTube recommended encoding settings on ffmpeg (+ libx264)
View encode.sh
#/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 Aug 23, 2017 — forked from neilpa/nv21-convert.sh
Use ffmpeg to convert raw Android camera frame buffers
View nv21-convert.sh
# 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 Aug 29, 2015 — forked from rocarvaj/.vimrc
View .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)