HOWTO: recording desktop video with ffmpeg
Posted: 07 Jun 2023, 11:24
It appears that Peek is no longer maintained. So there's need for a replacement.
For those who don't know it, Peek is a tool that allows you to generate a .gif capturing the desktop. Very convenient when it comes to show the (in)correct operation of something (and therefore to help or ask for help).
Fortunately, we have ffmpeg. This is what I'm using by now:
Then, you convert to (720 height) .gif:
or if you want full resolution, in which case, you will have to upload to another service, because the output file will be too large to be hosted at a free pic hosting server:
As the generated .gif will be too large, you can reduce its size (and quality) with:
or use imagemagick:
Play with the fuzz value to compare results. Lower value means bigger size and better quality.
Then you can upload to your free image hosting service of choice. For example IBB
For those who don't know it, Peek is a tool that allows you to generate a .gif capturing the desktop. Very convenient when it comes to show the (in)correct operation of something (and therefore to help or ask for help).
Fortunately, we have ffmpeg. This is what I'm using by now:
Code: Select all
ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 input.mp4 (grabs the full 1920x1080 screen)
ffmpeg -video_size 1280x800 -framerate 25 -f x11grab -i :0.0+50,30 input.mp4 (grabs a 1280x800 res screen starting at coordinates 50,30 from the left-top)
Code: Select all
ffmpeg -i input.mp4 -vf "fps=10,scale=-1:720:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
Code: Select all
ffmpeg -i input.mp4 -vf "fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
Code: Select all
ffmpeg -i input.mp4 -vf "fps=10,scale=-1:720:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=128[p];[s1][p]paletteuse=dither=bayer" -loop 0 output.gif
Code: Select all
convert output.gif -loop 0 -delay 10 -fuzz 20% -layers optimize output-optimized.gif
Then you can upload to your free image hosting service of choice. For example IBB