Skip to content

Instantly share code, notes, and snippets.

@imorrish
imorrish / RecordHyperDecks.ps1
Created May 27, 2015 08:51
PowerShell to start recording on multiple Blackmagic HyperDeck devices
# record on multiple HyperDecks
$HyperDecks = @('10.0.0.34','10.0.0.35','10.0.0.36','10.0.0.37')
$fileName = 'Recording' + (Get-Date).tostring("dd_MM_yyyy_hh_mm")
$sb = {
param ([string] $HyperDeckIP, [string] $HDcommand)
try {
$socket = new-object System.Net.Sockets.TcpClient($HyperDeckIP, 9993)
$stream = $socket.GetStream()
$writer = new-object System.IO.StreamWriter($stream)
@jeoliva
jeoliva / gist:a3c4ef62b7f52926d0f339b395c0cd0c
Last active November 29, 2024 12:22
Get Keyframe interval (GOP size) of a stream/video using ffprobe
ffprobe -of compact -select_streams v -show_packets [VIDEO_FILE OR STREAM_URL] | grep K$ | awk 'BEGIN{FS="|";last=-1}{split($5,a,"="); if(last != -1) {print "Keframe pos: " a[2] ", Interval: " a[2]-last " seconds"} else {print "Keyframe: " a[2]}; last=a[2]}'
@nebgnahz
nebgnahz / gstreamer.md
Last active January 9, 2025 13:12
Collections of GStreamer usages

Most GStreamer examples found online are either for Linux or for gstreamer 0.10.

This particular release note seems to have covered important changes, such as:

  • ffmpegcolorspace => videoconvert
  • ffmpeg => libav

Applying -v will print out useful information. And most importantly the negotiation results.

@vo
vo / quad_video_wall.sh
Last active November 18, 2024 07:06
basic gstreamer quad video wall.
#!/bin/bash
# Basic gstreamer quad video wall application.
# Displays 4 videos.
# They have to be synced to eachother and playing for this to work.
PARAMS_NEEDED=4
if [ $# -ne $PARAMS_NEEDED ]
then
@jpriebe
jpriebe / ffmpeg_decklink_h264_qsv.sh
Created October 26, 2016 20:19
Example script to encode video from a Decklink Mini Recorder using h264_qsv
@mhanney
mhanney / ffmpeg-to-vmix.png
Last active April 18, 2021 08:46
Stream webcam and audio source from PC to remote IP address using mpegts encapsulation and encoded with h264 and aac
ffmpeg-to-vmix.png
@m1tk4
m1tk4 / smpte_bars_720.bat
Last active March 1, 2023 09:46
Create a test video file - SMPTE HD Bars with burn-in timecode and 1kHz sound
@echo off
:: Set duration in seconds
set duration=615
:: Note - this outputs 720p 59.94fps drop-frame sample
ffmpeg.exe ^
-f lavfi -i "smptebars=duration=%duration%:size=1280x720:rate=60000/1001" ^
-f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=%duration%" ^
-vf drawtext="fontfile=consola.ttf:\ timecode='00\:00\:00\;00':rate=60000/1001:fontsize=64:fontcolor='white':\ boxcolor=0x00000088:box=1:boxborderw=5:x=20:y=20" ^
-c:v mpeg2video -b:v 6000k ^
#!/bin/bash
INPUT="/srv/elias/assets/audio-bbc.mp4"
TARGET="rtmp://rtmp-api.facebook.com:80/rtmp/XXX"
FORMAT="flv"
VBITRATE="2000k"
VPRE="fast"
VPROFILE="main"
VLEVEL="3.1"
FPS=25
@max-verem
max-verem / hls_to_sdi.sh
Last active September 17, 2022 22:06
hls to sdi
#!/bin/bash
ffmpeg \
-i "http://live.m2.tv:80/hls/stream.m3u8" \
-vf "scale=720:576,fps=fps=25,setdar=dar=16/9,format=pix_fmts=uyvy422" \
-af "aresample=48000" -ac 2 \
-f decklink -y "DeckLink Mini Monitor" \
-acodec copy -vcodec copy \
-f mpegts \
-y "udp://239.1.100.2:10480?localaddr=10.1.5.57&pkt_size=1316&fifo_size=1000000" \
@garoto
garoto / ffmpeg-hevc-encode-nvenc.md
Created July 10, 2017 17:15
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 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>  \
-filter:v hwupload_cuda,scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos,hwdownload \

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