Skip to content

Instantly share code, notes, and snippets.

@ogmkp
ogmkp / ffmpeg-minimalist-build-nvenc-static.md
Created April 7, 2020 22:43 — forked from gfodor/ffmpeg-minimalist-build-nvenc-static.md
This gist will show you how to build a minimalist, statically-linked ffmpeg binary under the ~/bin subdirectory on your home on Ubuntu 16.04LTS. Comes with (optiona) NPP, CUDA and NVENC capabilities. See notes in the warning section.

Minimalist static FFmpeg build on Ubuntu 18.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.

Warning:

If all you require is NVENC's enablement, you do NOT need the CUDA SDK. The nv-codec-headers (below) is ALL you require.

@ogmkp
ogmkp / README.md
Created July 6, 2020 23:40 — forked from mrbar42/README.md
Secured HLS setup with Nginx as media server

Secured HLS setup with Nginx as media server

This example is part of this article.

This is an example for an HLS delivery with basic security. Nginx compiled with nginx-rtmp-module & secure-link is used as media server. Features:

  • Domain filtering
  • Referrer filtering
  • Embed buster
@ogmkp
ogmkp / CMakeLists.txt
Created July 12, 2020 16:27 — forked from atgeoriw/CMakeLists.txt
Using v4l2 to broadcast Logitech C920 compressed mjpeg stream using NewTek Network Device Interface(NDI) using Raspberry Pi
cmake_minimum_required (VERSION 2.8)
project (Main)
SET(CMAKE_BUILD_TYPE DEBUG)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_C_FLAGS "-Wall")
SET(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
SET(CMAKE_CXX_FLAGS "-g -O2 -ldl -Wall -std=c++11 -D__STDC_CONSTANT_MACROS")
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
@ogmkp
ogmkp / kvm-gpu-passthrough-on-debian-buster.md
Created December 15, 2020 20:12
Setting up KVM with GPU passthrough in Debian Buster

Here's how to set up a Windows 10 virtual machine in KVM with PCI passthrough. The VM will have access to an NVIDIA graphics card while the host machine (running Debian Buster) uses Intel integrated graphics. This is mostly for my own reference so I don't forget how I did it.

Hardware

  • Intel i5 (an old one) with integrated graphics: this will be used as the graphics card for the host machine running Debian Buster
  • NVIDIA Geforce 1070: this will be used as the graphics card for the Windows 10 VM

Step 1: Enable IOMMU

In order to do hardware passthrough with KVM at all, you need to enable the Intel Vt-d virtualization extensions. Edit /etc/default/grub and edit the GRUB_CMDLINE_LINUX_DEFAULT line so that it reads like:

@ogmkp
ogmkp / Readme.md
Created December 28, 2020 20:13 — forked from LukasKnuth/Readme.md
ffmpeg Merge two Audio Streams into one

This script takes a single input file and

  1. Reduces the volume of the third audio-track in the file by half
  2. Writes the reduced volume track into l
  3. Mixes both the second audio-track and the lowered l-track together and stores them into a
  4. Maps the original video to be the first track
  5. Adds the newly mixed audio-track a as the sole audio track
  6. Enables pass-through for the video-track
  7. Configures the mixed audio-track to be AAC at 192kbit/s
@ogmkp
ogmkp / gist:1198bdddd5259af547919529e8ce472e
Last active April 22, 2021 18:46
Debian 10 simple - AMDGPU Temperatures
Install a Polaris 10/11/12/20 in the PCIE socket of your motherboard.
Boot Debian, enjoy !
Card used in case: AMD RX 560 14CU/896sp or R9 380
To read AMD GPU card info:
$ sudo cat /sys/kernel/debug/dri/0/amdgpu_pm_info
To control dynamic frequencies:
$ watch -n 1 cat /sys/class/drm/card0/device/pp_dpm_sclk
@ogmkp
ogmkp / gist:578d6a270c659711effa621800ae72e9
Created July 16, 2021 19:15 — forked from alishutc/gist:a6b1b0fc11a28a627897
Play a random embedded youtube video
<!DOCTYPE html>
<html>
<head>
<script>
var videos = ["https://www.youtube.com/embed/9bZkp7q19f0", "https://www.youtube.com/embed/dQw4w9WgXcQ"];
window.onload = function () {
var playerDiv = document.getElementById("random_player");
var player = document.createElement("IFRAME");
var randomVideoUrl = videos[Math.floor(Math.random() * videos.length)];
@ogmkp
ogmkp / worker nginx conf
Created November 22, 2021 13:48 — forked from fqrouter/worker nginx conf
Youtube Reverse Proxy
resolver 8.8.8.8;
location /video/ {
if ($request_uri ~ "^/video/(.+?)/.+") {
set $upstream_host $1.googlevideo.com;
add_header Content-Disposition "attachment; filename=video.mp4;";
}
rewrite /video/.+?/(.+)$ /$1 break;
proxy_buffering off;
proxy_pass https://$upstream_host;
proxy_set_header Host $upstream_host;
@ogmkp
ogmkp / compile-ffmpeg-nvenc.sh
Created December 16, 2021 14:26 — forked from ransagy/compile-ffmpeg-nvenc.sh
Script to build a static FFMpeg binary with NVENC support
#!/bin/bash
# This script will compile and install a static ffmpeg build with support for nvenc in ubuntu.
# See the prefix path and compile options if edits are needed to suit your needs.
# NOTE: This build is made to target Ubunutu 16.04 Data-Science Azure VMs - With nVidia 418.xx drivers and CUDA SDK 9.0.
# It also relies on a hack described in https://trac.ffmpeg.org/ticket/6431#comment:7 to make glibc dynamic still.
# Long story short, you need to edit your ffmepg's configure script to avoid failures on libm and libdl.
# in function probe_cc, replace the _flags_filter line to: _flags_filter='filter_out -lm|-ldl'
@ogmkp
ogmkp / nvidia-driver-realtime.sh
Created December 20, 2021 11:48 — forked from pantor/nvidia-driver-realtime.sh
Installing NVIDIA drivers on a realtime Linux (PREEMPT-RT)
# Tested on Ubuntu 16.04 and X11, 2019
# 1. Download NVIDIA driver as a .run file
# 2. Stop X-Server
sudo service lightdm stop
# 3. Blacklist Nouveau driver
sudo nano /etc/modprobe.d/blacklist-nouveau.conf