Skip to content

Instantly share code, notes, and snippets.

View nanake's full-sized avatar
:octocat:
flaneuring

ななけだよ nanake

:octocat:
flaneuring
View GitHub Profile
@nanake
nanake / ffmpeg-hevc-encode-nvenc.md
Created October 31, 2020 12:16 — forked from jbboehr/ffmpeg-hevc-encode-nvenc.md
This gist shows you how to encode specifically to HEVC with ffmpeg's NVENC on supported hardware, with a two-pass profile and optional CUVID-based hardware-accelerated decoding.

Encoding high-quality HEVC content in a two-pass manner with FFmpeg - based NVENC encoder on supported hardware:

If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.

Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:

ffmpeg  -i <inputfile> -pass 1 \
-filter:v hwupload_cuda,scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos,hwdownload,format=nv12 \

-c:v hevc_nvenc -profile main -preset slow -rc vbr_2pass \

@nanake
nanake / ffmpeg.md
Created September 18, 2020 03:15 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
@nanake
nanake / compile-ffmpeg-nvenc.sh
Last active September 9, 2020 04:31
This bash script will compile a static Ffmpeg build with NVENC and VAAPI hardware-accelerated support on Ubuntu in your home directory. You can modify the script to customize the build options as you see fit.
#!/bin/bash
#This script will compile and install a static ffmpeg build with support for nvenc un ubuntu.
#See the prefix path and compile options if edits are needed to suit your needs.
#install required things from apt
installLibs(){
echo "Installing prerequisites"
sudo apt-get update
sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \
@nanake
nanake / ungrayscale.js
Last active October 21, 2016 05:01
Remove grayscale on websites
for (var element of document.querySelectorAll("html body div img video".split(" "))) {
window.getComputedStyle(element, null)
.getPropertyValue("filter")
.startsWith("grayscale") &&
element.style.setProperty("filter", "none", "important")
}
@nanake
nanake / gist:1046645
Created June 25, 2011 16:41
Ichimoku
ST:=(HHV(H,26)+LLV(L,26))/2;
TL:=(HHV(H,9)+LLV(L,9))/2;
DL:=Ref(C, 26);
1Span:=Ref((ST+TL)/2,-26);
2Span:=Ref((HHV(H,52)+LLV(L,52))/2,-26);
ST;
TL;
DL;
1Span;