Skip to content

Instantly share code, notes, and snippets.

@wrenth04
wrenth04 / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Created July 25, 2021 04:09 — forked from Brainiarc7/VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".

@wrenth04
wrenth04 / ffmpeg-wrapper
Created January 21, 2021 05:46 — forked from BenjaminPoncet/ffmpeg-wrapper
Synology VideoStation ffmpeg wrapper with DTS, EAC3 and TrueHD support (Installation instructions in 1st comment)
#!/bin/bash
rev="12"
_log(){
echo "$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - $1" >> /tmp/ffmpeg.log
}
_log_para(){
echo "$1" | fold -w 120 | sed "s/^.*$/$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - = &/" >> /tmp/ffmpeg.log
@wrenth04
wrenth04 / subtitle.md
Last active September 17, 2019 09:34
ffmpeg subtitle

Install Font

cp msyh.ttf /usr/share/fonts/
fc-cache -fv  

gbk to big5

iconv -f utf8 -t gb2312 subtitle.srt | iconv -f gb2312 -t big5 | iconv -f big5 -t utf8 -o subtitle.srt
@wrenth04
wrenth04 / virtualenv.md
Created July 30, 2019 05:52
python virtualenv

Enter virtualenv

pip install virtualenv
virtualenv venv
source venv/bin/activate

Exit virtualenv

deactivate
@wrenth04
wrenth04 / setup.md
Last active August 22, 2019 07:25
TF2 CycleGAN

https://github.com/LynnHo/CycleGAN-Tensorflow-2

Host

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-driver-410 nvidia-docker2
sudo reboot
docker run -ti --runtime=nvidia  -e NVIDIA_DRIVER_CAPABILITIES=all -v $PWD:/disk tensorflow/tensorflow:2.0.0a0-gpu-py3 bash
@wrenth04
wrenth04 / qemu.md
Created March 18, 2019 06:31
docker qemu
qemu-img create -f qcow2 hdd.qcow2 100G
qemu-system-x86_64 -m 40960 -hda hdd.qcow2 -cdrom virtio-win-0.1.141.iso -enable-kvm -cpu host -smp 16 -redir tcp:8080::80
@wrenth04
wrenth04 / gcloud.md
Created February 15, 2019 00:39
gcloud docker login
gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://[HOSTNAME]

or

docker login -u oauth2accesstoken -p "$(gcloud auth print-access-token)" https://[HOSTNAME]
  • 其中,[HOSTNAME] 是 gcr.io、us.gcr.io、eu.gcr.io 或 asia.gcr.io。
@wrenth04
wrenth04 / changeip.sh
Created September 6, 2018 07:50
AWS change ip
#!/bin/bash
INSTANCE_NAME="Ubuntu-512MB-Tokyo-2"
STATIC_IP_NAME="sjp"
get_public_ip() {
n=$(aws lightsail get-instance --instance-name "$INSTANCE_NAME" | grep publicIp)
n=${n%\"*}
echo ${n##*\"}
}
@wrenth04
wrenth04 / ffmpeg-minimalist-build-nvenc-static.md
Created August 8, 2018 02:54
Static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Minimalist static FFmpeg build on Ubuntu 16.04 with Nvidia NVENC enabled.

Original guide with a standard build is here.

With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.

First, prepare for the build and create the work space directory:

cd ~/

@wrenth04
wrenth04 / mysql.md
Last active June 28, 2018 07:45
mysql docker
docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=$passowrd mysql
修改 root 用户密码: 
mysql>ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '$password'; 

import data