-
-
Save jperl/7514ba35bccdaace4272c0163c632cad to your computer and use it in GitHub Desktop.
Screen recording using a dockerized ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker run -it --rm --privileged --net host \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix \ | |
-v $PWD:$HOME/workspace \ | |
-v $HOME/.Xauthority:$HOME/.Xauthority \ | |
-e HOME=$HOME \ | |
-e DISPLAY=$DISPLAY \ | |
--entrypoint /usr/sbin/ffmpeg \ | |
kfei/ffmpeg $* | |
# Now you can alias ffmpeg to this script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Example of screen recording | |
OUTFILE="$HOME/workspace/output.mp4" | |
ffmpeg -f x11grab -r 15 -s 1920x1080 -i :0 -vcodec h264 -crf 30 -y $OUTFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Example of screen recording (to a specific window) | |
# Reference: http://www.reddit.com/r/linux/comments/1nioax/til_that_you_can_record_your_desktop_with_vlc/ | |
INFO=$(xwininfo -frame) | |
WIN_GEO=$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+') | |
WIN_XY=$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) | |
ffmpeg -f x11grab -r 15 -s $WIN_GEO -i :0.0+$WIN_XY -vcodec h264 -preset ultrafast -y $OUTFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment