updated a bit

pull/1/head
Gotbletu 12 years ago
parent 860009e8fe
commit 6f44d85e66

@ -1,9 +1,15 @@
#-------- FFMPEG Screencasting
# compile ffmpeg: http://ubuntuforums.org/showthread.php?t=786095
# proper screencast: http://ubuntuforums.org/showthread.php?t=1392026
#-------- FFMPEG X11GRAB Screencasting
#------------------------------------------------------
# compile ffmpeg: http://ubuntuforums.org/showthread.php?t=786095
# proper screencast: http://ubuntuforums.org/showthread.php?t=1392026
# http://nowardev.wordpress.com/2011/05/23/how-to-screencast/
# press q to quit
# Original Code:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 -y screencast_out.mkv
# orginal one line code for fullscreen
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 -y screencast_out.avi
# record single window, use mouse to click on the window to start recording
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -frame | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+') -i :0.0+$(xwininfo -frame | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 -y screencast_out.avi
# -y = will overwrite output file
@ -15,37 +21,74 @@ ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geom
#Note 2: If you like to scale down your videos at the same time when recording
# add in for example
# -vf "scale=1280:720"
# The reason this is useful is becuase I have a 16:10 resolution but youtube only supports 16:9
# So I can avoid the black bars on left/right side of the videos with this option
#============================================
# This is What i Use
#==============================================
# This is what I use, added to bashrc/zshrc
# Using FFmpeg, fullscreen capture scaled down to 16:9(1280:720) for youtube upload
ffx-fullscreen-hw() { ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 \
-s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 \
-acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 \
-vf "scale=1280:720" \
-y ~/Public/screencast/aa_screencast_baking.mkv ;}
FFX_MONO="1" # mono
FFX_DUAL="2" # dual channel
FFX_HW="hw:1,0" # alsa; run 'cat /proc/asound/pcm' to change to the correct numbers
FFX_PULSE="pulse" # pulseaudio; might have to install pavucontrol to change volume
FFX_FPS="30" # frame per seconds
FFX_WIN_FULL=$(xwininfo -root | grep 'geometry' |awk '{print $2;}') # record fullscreen
FFX_AUDIO="pcm_s16le" # audio codec
FFX_VIDEO="libx264" # video codec
FFX_PRESET="ultrafast" # preset error? run 'x264 -h' replace with fast,superfast, slow ..etc
FFX_CRF="0"
FFX_THREADS="0"
FFX_SCALE="scale=1280:720" # scale resolution, no black bars on sides of video on youtube
FFX_OUTPUT=~/Public/screencast/aa_screencast_baking.avi
# Note: -vf is optional delete if you want, -y is to overwrite existing file
ffx-fullscreen-pulse() { ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 \
-s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 \
-acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 \
-vf "scale=1280:720" \
-y ~/Public/screencast/aa_screencast_baking.mkv ;}
# capture fullscreen using alsa or pulseaudio
ffx-full-hw() { ffmpeg -f alsa -ac $FFX_MONO \
-i $FFX_HW -f x11grab -r $FFX_FPS -s $FFX_WIN_FULL -i :0.0 \
-acodec $FFX_AUDIO -vcodec $FFX_VIDEO \
-preset $FFX_PRESET -crf $FFX_CRF -threads $FFX_THREADS \
-vf $FFX_SCALE \
-y $FFX_OUTPUT
}
ffx-full-pa() { ffmpeg -f alsa -ac $FFX_MONO \
-i $FFX_PULSE -f x11grab -r $FFX_FPS -s $FFX_WIN_FULL -i :0.0 \
-acodec $FFX_AUDIO -vcodec $FFX_VIDEO \
-preset $FFX_PRESET -crf $FFX_CRF -threads $FFX_THREADS \
-vf $FFX_SCALE \
-y $FFX_OUTPUT
}
# capture single window, use mouse cursor to select window you want to record
ffx-winselect-hw() {
FFX_INFO=$(xwininfo -frame)
# Using FFmpeg, select specific single window with mouse to capture
ffx-windowspecific-hw() { ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 \
-s $(xwininfo -frame | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+') \
-i :0.0+$(xwininfo -frame | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' \
| grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) \
-acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 \
-y ~/Public/screencast/aa_screencast_baking.mkv ;}
ffmpeg -f alsa -ac $FFX_MONO \
-i $FFX_HW -f x11grab -r $FFX_FPS \
-s $(echo $FFX_INFO | grep -oEe 'geometry [0-9]+x[0-9]+'\
| grep -oEe '[0-9]+x[0-9]+') \
-i :0.0+$(echo $FFX_INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' \
| grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) \
-acodec $FFX_AUDIO -vcodec $FFX_VIDEO \
-preset $FFX_PRESET -crf $FFX_CRF -threads $FFX_THREADS \
-vf $FFX_SCALE \
-y $FFX_OUTPUT
}
ffx-winselect-pa() {
FFX_INFO=$(xwininfo -frame)
ffx-windowspecific-pulse() { ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 \
-s $(xwininfo -frame | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+') \
-i :0.0+$(xwininfo -frame | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' \
| grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) \
-acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 \
-y ~/Public/screencast/aa_screencast_baking.mkv ;}
ffmpeg -f alsa -ac $FFX_MONO \
-i $FFX_PULSE -f x11grab -r $FFX_FPS \
-s $(echo $FFX_INFO | grep -oEe 'geometry [0-9]+x[0-9]+'\
| grep -oEe '[0-9]+x[0-9]+') \
-i :0.0+$(echo $FFX_INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' \
| grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) \
-acodec $FFX_AUDIO -vcodec $FFX_VIDEO \
-preset $FFX_PRESET -crf $FFX_CRF -threads $FFX_THREADS \
-vf $FFX_SCALE \
-y $FFX_OUTPUT
}

Loading…
Cancel
Save