adamsgaard.dk

my academic webpage
git clone git://src.adamsgaard.dk/adamsgaard.dk
Log | Files | Refs | README | LICENSE Back to index

commit f6af7728fcf842ad22da976b07d3cc67fc704240
parent 7fe6c041fbd322d068731a87e3962cc39c1d3db8
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue, 24 Mar 2020 19:25:35 +0100

Expand tabs in html version

Diffstat:
Mpages/004-screencasts.html | 98++++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/pages/004-screencasts.html b/pages/004-screencasts.html @@ -20,37 +20,37 @@ and stopping recording:</p> lockfile=/tmp/screenrecord.pid startrecording() { - out="$HOME/screenrecord-$(date '+%Y-%m-%d_%H:%M:%S').mkv" - ffmpeg -y \ - -f x11grab \ - -framerate 60 \ - -s "$(xdpyinfo | grep dimensions | awk '{print $2}')" \ - -i $DISPLAY \ - -f sndio -i default \ - -r 30 \ - -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ - "$out" >/dev/null 2>&1 & - printf '%s' "$!" > "$lockfile" - - sleep 1 - if [ ! -f "$out" ]; then - echo 'error: ffmpeg recording did not start' >&2 - notify-send -u CRITICAL "${0##*/}" 'ffmpeg recording did not start' - rm -f "$lockfile" - exit 1 - fi + out="$HOME/screenrecord-$(date '+%Y-%m-%d_%H:%M:%S').mkv" + ffmpeg -y \ + -f x11grab \ + -framerate 60 \ + -s "$(xdpyinfo | grep dimensions | awk '{print $2}')" \ + -i $DISPLAY \ + -f sndio -i default \ + -r 30 \ + -c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \ + "$out" >/dev/null 2>&1 & + printf '%s' "$!" > "$lockfile" + + sleep 1 + if [ ! -f "$out" ]; then + echo 'error: ffmpeg recording did not start' >&2 + notify-send -u CRITICAL "${0##*/}" 'ffmpeg recording did not start' + rm -f "$lockfile" + exit 1 + fi } stoprecording() { - kill "$(cat "$lockfile")" - rm -f "$lockfile" - notify-send "${0##*/}" 'recording ended' + kill "$(cat "$lockfile")" + rm -f "$lockfile" + notify-send "${0##*/}" 'recording ended' } if [ -f "$lockfile" ]; then - stoprecording + stoprecording else - startrecording + startrecording fi </code></pre> @@ -73,9 +73,9 @@ The following script toggles the video feed:<p> <pre><code>#!/bin/sh # remember to `chown $USER /dev/video0` if pgrep video >/dev/null 2>&1; then - pkill video + pkill video else - nohup video -s 320 >/dev/null 2>&1 & + nohup video -s 320 >/dev/null 2>&1 & fi </code></pre> @@ -97,14 +97,14 @@ concievable loss in quality:</p> <pre><code>#!/bin/sh encode() { - ffmpeg -y -i "$1" \ - -c:v libx264 -threads 0 -preset faster -pix_fmt yuv420p \ - -c:a aac -crf 10 \ - "${1%.*}_out.mp4" + ffmpeg -y -i "$1" \ + -c:v libx264 -threads 0 -preset faster -pix_fmt yuv420p \ + -c:a aac -crf 10 \ + "${1%.*}_out.mp4" } for f in "$@"; do - encode "$f" + encode "$f" done </code></pre> @@ -115,30 +115,30 @@ encounter when recording on my laptop:</p> <pre><code>#!/bin/sh synchronize() { - ffmpeg -y -i "$1" \ - -itsoffset 0.300 \ - -i "$1" \ - -map 0:v -map 1:a \ - -c copy \ - "${1%.*}_out.${1##*.}" + ffmpeg -y -i "$1" \ + -itsoffset 0.300 \ + -i "$1" \ + -map 0:v -map 1:a \ + -c copy \ + "${1%.*}_out.${1##*.}" } for f in "$@"; do - synchronize "$f" + synchronize "$f" done </code></pre> <figure class="pagefigure"> - <video poster="video/screencast.jpg" style="object-fit:fill;" - controls preload="none" class="mediaframe"> - <source src="video/screencast.webm" type="video/webm"> - <source src="video/screencast.ogv" type="video/ogg"> - <source src="video/screencast.mp4" type="video/mp4"> - <a href="video/screencast.mp4">Link</a> - </video> - <figcaption> - Example screen recording using ffmpeg(1) and video(1) - with the above scripts. - </figcaption> + <video poster="video/screencast.jpg" style="object-fit:fill;" + controls preload="none" class="mediaframe"> + <source src="video/screencast.webm" type="video/webm"> + <source src="video/screencast.ogv" type="video/ogg"> + <source src="video/screencast.mp4" type="video/mp4"> + <a href="video/screencast.mp4">Link</a> + </video> + <figcaption> + Example screen recording using ffmpeg(1) and video(1) + with the above scripts. + </figcaption> </figure>