domingo, 22 de junio de 2014

Create a .gif from video

This command line should work but will generate a giant file:
ffmpeg -i yesbuddy.mov -pix_fmt rgb24 output.gif
Note that you probably want to reduce the frame rate and size when you convert, as well as specify a start time and duration. You probably do not want to convert the entire file at its original resolution and frame rate.
ffmpeg -ss 00:00:00.000 -i yesbuddy.mov -pix_fmt rgb24 -r 10 -s 320x240 -t 00:00:10.000 output.gif
The file size will still be huge. You may be able to use ImageMagick's GIF optimizer to reduce the size:
convert -layers Optimize output.gif output_optimized.gif


Source: http://superuser.com/a/436109

domingo, 8 de junio de 2014

Screenshot on Xfce4 using Imp Pant button

Xfce4 comes with one tool to take pictures of your actual window, this tool is xfce4-screenshooter. It has a prompt that let you select which window or region to capture, if you want your mouse to appear, and how many seconds of delay you want it to wait before taking the picture. It can be very useful, but the problem is assigning this tool to the "Imp Pant" button. In that case it will ask you to fill all this information. However, you can specify some of the options using some arguments, but still you need to specify the file-name in the prompt.

I found somebody asking for a functionality for not showing the prompt, but in the words of the developer it was done before without succes. (https://bugs.launchpad.net/ubuntu/+source/xfce4-screenshooter/+bug/585478)

In order to solve this problem I found in Archlinux wiki a very good explanation about different methods to take screenshots:

https://wiki.archlinux.org/index.php/Taking_a_screenshot

I really liked this method:

$ import -window root screenshot.jpg

Then I wanted to add this command to "Imp Pant" button, the problem is that it is not able to execute the inner command "date" in the same command line.

$ import -window root /home/maikel/screenshot/screenshot_`date +%F_%H%M%S`.png

For that reason you just need to create a small script that executes these lines:

#!/bin/bash
FOLDER=/home/maikel/screenshot
FILENAME=screenshot_`date +%F_%H%M%S`
import -window root ${FOLDER}/${FILENAME}.png

I created this script just open some editor and paste the above code (change the FOLDER and point to the desired one, make sure the folder exists, as I didn't want to make this script slower just by looking if the folder exists and creating it in case it doesn't.

vi /home/maikel/bin/screenshot

And added the execution flag

chmod u+x /home/maikel/bin/screenshot

The just open the keyboard settings

$ xfce4-keyboard-settings

go to application shortcuts



Click add buttom, and write the path to your script (in my case)

/home/maikel/bin/screenshot

Then just press OK and the desired button to assign this script : "Imp Pant"

Now you can just press the button "Imp Pant" and your shots will be saved in the specified folder.