Xubuntu – turn Compositor ON and OFF

A little script to add to a launcher or keyboard shortcut to quickly turn the compositor on and off. this is useful if you get screen tearing when playing video

ffmpeg – make a time lapse video from a video

So you have a video that goes on a bit, why not make a time lapse video of it?

For this example I will take a video, extract 1 frame per second from it, and create a new video running at 25 frames per second. If your original video was 1 hour long, the new video would be only 2 minutes 20 seconds in length. You lose the original sound, but you can add a soundtrack back later if you want.

Grab all the frames from the original video (for a 1 hour video this will create @ 3600 images):

Mux back to a video:

Add audio track (mp3) to output video:

There are many options for ffmpeg you can apply to both the video and audio, but here are the basics

Nice and Easy Playlist Maker Script with full paths

Just for mp3’s but this works well for Audacious, so might work well for other players too….

It’s a bash script, let’s call it playlistmaker.sh so copy the code and make sure you make it executable.

To run it, you simply need to feed the script a directory location and filename and it will produce a playlist you can put anywhere on the same system:

This points the script at ~/Music and names the playlist music.m3u (which gets saved in your current directory). It will give you full paths to each file, for all mp3 files, recursively. You can of course expand the script by running the line several times and hard coding the directories and filenames, so you can easily update static playlists for specific directories that you might add to regularly.

More fun with xrandr

  • NB: double hyphens (with no space between!) are used for all options in xrandr

Sorting out my front screen display for my car pc has proven a bit of a nightmare, given its native resolution of 400 x 234/240. The vga converter I am using doesn’t offer 800×480.

So I looked to xrandr to help me out. The specific options for this are “- -mode”, “- -scale” and “– -pos

With “– -mode” I can set the resolution, in this case 800×600

With “– -pos” I can position the display offset, e.g. – -pos 10×10 would position the display 10pixels down and 10 pixels right. This is useful because the display doesn’t align centrally be default.

Continue reading

Xrandr – turn off one of your multiple monitors

Xrandr is not just for setting up resolutions and multiple monitors, it will do all sorts of other stuff too, but one thing I need for my carpc project was to be able to programmatically turn off the screen on the netbook (carpc) once it was up and running on the main screen on the car dash. I couldn’t play with X because both screens were running from “one display”. Xrandr to the rescue:

xrandr -q

will give you the names of the screens you have running. Once you know this you can issue a command to turn off which ever screen you like:

xrandr –output LVDS1 –off

where LVDS1 is the name of my netbook display (there are two double hyphens in the above code!)

xrandr –output LVDS1 –auto or  xrandr –output LVDS1 –on will bring it back on

HTML Auto Slideshow using Javascript and php with dynamically generated array of Images

Another holy grail for me, to be able to just add images to a directory and have the slideshow automatically pick them up and display them withoput having to edit html /javascript code. Most scripts I had found for an html slideshow required the array created inside the script, this way you use php to generate the array and then the javascript runs with it. Only downside is you will need php up and running, but most web servers online have this by default now.

My blog is a bit broken at the moment so will have to link the files to Ubuntuforums

http://ubuntuforums.org/showpost.php?p=11339174&postcount=2

  1. Images will be shown at their actual size, so you may need to add some html code to the tag in the to restrict the images size.
  2. On your server, go to the place where you want the html file to be and upload the index.html file there, then create a sub-directory called pics and upload the getimages.php file to the pics directory.
  3. Next upload all your images to the pics directory.
  4. Done.

Acknowledgements to all the clever people who wrote the original scripts and files

Auto Web Page Changer using iframe

Oh I like this. In seeking to setup a rolling web browser display display at work, I came upon this small but very clever bit of javascript, which on a timer will change the web page being viewed inside an iframe. Just edit the defaults to you preferred pages and timings and away you go:

 <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Changing Pages… Please Wait</title>
<script type=”text/javascript”>
var frames = Array(‘http://www.google.com/’, 15,
‘http://www.yahoo.com/’, 15,
‘http://www.ask.com/’, 15,
‘http://www.dogpile.com/’, 15);
var i = 0, len = frames.length;
function ChangeSrc()
{
if (i >= len) { i = 0; } // start over
document.getElementById(‘frame’).src = frames[i++];
setTimeout(‘ChangeSrc()’, (frames[i++]*1000));
}
window.onload = ChangeSrc;
</script>
</head>
<body>
<iframe src=”” name=”frame” id=”frame” width=”100%” height=”100%”></iframe>
</body>
</html>

Continue reading

Simple Linux Slideshows

For running in X:

Use feh

sudo apt-get install feh

Set up a directory with photos in it, e.g. ~/photos or ~/Pictures and then run this command:

feh -zZxF -D 10 ~/photos

(-z for random, -Z for autozoom, -x for borderless windows, -F for fullscreen, -D for time on screen)

You might try using unclutter to get rid of the mouse cursor, but on some setups this doesn’t work well with feh, alternatively just move the mouse down into a corner somewhere

Continue reading

Jinamp Party Piece

Jinamp Party Piece

Ok, daughter having birthday party, kicking us out of the house for the evening. Last year, I set her up with Audacious on the htpc so that she and her guests could chose music to play, with a couple of backup options of using xbmc or a DVD full of mp3s. This year we have a new machine running as htpc, no DVD drive. Also, daughter just wants a shuffled playlist to run, with no intervention.

A few weeks ago I was mooching about on KMandla’s new wiki of CLI apps, and came across jinamp , which is a sort of background player. What it does is takes the feed of a directory or playlist, shuffles it, then sequences it to a player of its or your choice, then disappears off into the background.

Continue reading