Linux: Animated gifs from youtube videos

February 21st, 2013

The following animated gifs are short scenes from youtube videos. They are looped, which occasionally gives a mesmerizing effect.



The original videos can be found here, here, and here. Programs that I use are youtube-dl, avidemux, and mplayer. I have taken the following steps to create these gifs.

  • Download the entire video:
  • Use avidemux to select the desired part and save it as bestand-1.avi
  • Remove the sound:
    mencoder -ovc lavc -nosound bestand-1.avi -o bestand-2.avi
  • Crop the video:
    mencoder -ovc lavc -vf crop=140:140:105:45 bestand-2.avi -o bestand-3.avi
  • Resize to 100×100:
    mencoder -ovc lavc -vf scale=100:100 bestand-3.avi -o bestand-4.avi
  • Convert to animated gif in black/white:
    mplayer bestand-4.avi -saturation -100 -vo gif89a:output=bestand-5.gif:fps=30
  • Or convert to animated gif, colors:
    mplayer bestand-4.avi -vo gif89a:output=bestand-5.gif:fps=30

Note that gif images are limited to 256 colors; it is for this reason that black/white gifs almost always yield better results.

Comments Off | Category: linux

Linux: Youtube videos integrated in desktop

May 29th, 2012

Shantz xwinwrap (see previous post) can integrate pretty much any video on the desktop, simply by calling mplayer. In combination with the tool youtube-dl you can also view any youtube videos, directly on the desktop. Without any advertisements. As an example, the following command plays Lady Gaga’s Poker Face. Interesting mplayer options are to play the video in black and white, and to mute the sound. Simply change the URL to view any other video.

color, sound:
xwinwrap -g 640x480+100+100 -ov -ni -s -st -sp -b -nf -- mplayer -wid WID -hue 0 -saturation 0 -volume 100 $(youtube-dl -g "")

black and white, muted:
xwinwrap -g 640x480+100+100 -ov -ni -s -st -sp -b -nf -- mplayer -wid WID -hue -100 -saturation -100 -volume 0 $(youtube-dl -g "")

Comments Off | Category: linux

Linux: Live stream tv integrated in desktop

April 30th, 2012

One of the cool things of Linux is that you can pipe the output of any program into another program, and in this way combine various programs. With the combination rtmpdump and mplayer you can view live streaming tv, outside the flash applet of the web browser. Streams that can be viewed include Al Jazeera, Russia Today, and France 24 (see the topics on Crunchbanglinux and Reddit for more information). As an example, Al Jazeera English can be viewed with the following command:
rtmpdump -v -r "rtmp://" | mplayer -

From this starting point, I wanted to integrate the stream on the desktop. I couldn’t figure out how to do this initially, but with the help of the people on the Archlinux forums and after some tweaking with a program called shantz xwinwrap, I now have integrated live streams on the desktop. This can be done by issuing the following command:
rtmpdump -v -r "rtmp://" | xwinwrap -g 640x360+100+100 -ov -ni -s -st -sp -b -nf -- mplayer -wid WID -

For a screenshot, click here. You can see that the video is completely integrated, and that the fluxbox menu remains accessible too. Of course any other live stream can be viewed and integrated too. For this you need to sniff the rtmp stream with a program called wireshark. There’s a tutorial on Youtube how to do this.

Comments Off | Category: linux