Add options to modify the behaviour and buffer

This commit is contained in:
Alex 2020-05-02 15:08:37 +02:00
parent b800618ca7
commit 283a938e4d
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 7 additions and 2 deletions

View File

@ -1,2 +1,7 @@
ffmpeg -hwaccel vdpau -video_size 1920x1080 -framerate 30 -f x11grab -i :0 -c:v libx264rgb -crf 0 -preset ultrafast -movflags +faststart -tune zerolatency -f segment -segment_time 4 -segment_wrap 6 -segment_list /tmp/list.m3u8 -segment_list_size 6 /tmp/seg\%d.ts
ffmpeg -y -i /tmp/list.m3u8 -c:v copy /tmp/snap.mp4
# Usage: have this script run as a service or in the background and send a SIGTERM to ffmpeg to capture the past X seconds
# $1 is the duration of the buffer, defaulting at 25-30 seconds depending on the progress of the last written file
# $2 is the base path, defaulting at /tmp for performance reasons
# $3 is the framerate, defaulting at 30fps
# $4 is the resolution, defaulting at 1080p
ffmpeg -hwaccel vdpau -video_size ${4:-1920x1080} -framerate ${3:-30} -f x11grab -i :0 -c:v libx264rgb -crf 0 -preset ultrafast -movflags +faststart -tune zerolatency -f segment -segment_time $(( ${1:-30} / 5 )) -segment_wrap 6 -segment_list ${2:-/tmp}/list.m3u8 -segment_list_size 5 ${2:-/tmp}/seg\%d.ts
ffmpeg -y -i ${2:-/tmp}/list.m3u8 -c:v copy ${2:-/tmp}/snap.mp4