From: Einar Jørgen Haraldseid Date: Tue, 28 May 2013 22:08:52 +0000 (+0200) Subject: Better header comments, better file output handling. X-Git-Url: https://git.slaskete.net/einar-bin/commitdiff_plain/140110eec0d5d2da5c927be9500a629b7d71f41d?ds=inline;hp=8e230a3828e95a6a33aff1d443f823f37688afd7 Better header comments, better file output handling. --- diff --git a/screencast.sh b/screencast.sh index f1a2668..4520980 100755 --- a/screencast.sh +++ b/screencast.sh @@ -1,13 +1,16 @@ #!/bin/bash -# WARNING: This is a terribly dirty and messy shellscript, written over a couple of late nights -# There was alcohol -# You probably need to install all the gstreamer-plugins (at least -ugly and -ffmpeg) to get this to work -# I wanted to make mp4 with x264, I didn't bother with free codecs - -# This script allows you to create screencasts on Linux, with optional sound inputs (both Mic and system sounds) -# You also get to choose to record from the whole screen or just a specified window. It has only been tested -# on Fedora 18. - +# WARNING: This is a terribly dirty and messy shellscript, written over a couple of late nights. +# There was alcohol … +# You probably need to install all the gstreamer-plugins (at least -ugly and -ffmpeg) to get this +# to work. I wanted to make mp4 with x264, I didn't bother with free codecs. +# +# So this script allows you to create screencasts on Linux, with optional sound inputs (both Mic +# and system sounds). It stores system sounds and mic in separate audio streams. +# You also get to choose to record from the whole screen or just a specified window. It has only +# been tested on Fedora 18. +# +# It dumps the recording in your $HOME directory with filename screencast-YYYY-MM-DD-HH-MM-SS.mp4 +# # Written by Einar Jørgen Haraldseid (http://einar.slaskete.net) # License: http://sam.zoy.org/wtfpl/COPYING @@ -71,6 +74,9 @@ HEIGHT=$(echo "${XWININFO}" | grep "Height: " | cut -d ":" -f 2 | awk '{print $1 # Calculate a suitable bitrate based on window dimensions BITRATE=$(echo "${WIDTH} * ${HEIGHT} * 0.006" | bc | cut -d "." -f 1 ) +# Set file name. +FILENAME="screencast-$(date +%F-%H-%M-%S).mp4" + # Enable inputs as suitable if [ ${PLAYMON} != "none" ]; then MONITORARG="pulsesrc device=${PLAYMON} slave-method=0 provide-clock=false ! audiorate ! audioconvert ! ffenc_aac bitrate=256000 ! queue2 ! mux." @@ -83,5 +89,5 @@ fi gst-launch -e ximagesrc xid="${WID}" do-timestamp=1 use-damage=0 ! video/x-raw-rgb,framerate=30/1 \ ! ffmpegcolorspace ! videoscale method=0 ! video/x-raw-yuv,width=${WIDTH},height=${HEIGHT} \ ! x264enc speed-preset=ultrafast bitrate=${BITRATE} ! queue2 \ - ! mp4mux name="mux" ! filesink location="output.mp4" $MONITORARG $MICARG + ! mp4mux name="mux" ! filesink location="${HOME}/${FILENAME}" $MONITORARG $MICARG