Archive

Archive for the ‘Guides’ Category

Getting information about your video files

February 16th, 2010 Jonathan No comments

The other day, I wanted to find out which of the videos in my movie collection were encoded with multitrack (e.g. 5.1) sound.

I found a tool for Linux called themonospot. Happily, it’s packaged with Fedora and can be installed simply by doing

yum install themonospot-console

Once installed it’ll quickly give you information about your video files:

[jonathan@zeus ~]$ themonospot-console /media/public/Movies/Sunshine/Sunshine.avi
File path:               /media/public/Movies/Sunshine/Sunshine.avi
Codec name:              XVID
Codec desc:              xvid
Frame size:              704 x 288
Average video bitrate:   1,423 Kb/Sec
File size:               1,525,886 KB
Total time:              01:47:26.00 seconds
Frame rate:              24.00 frames/sec
Total frames:            154,574
Video data rate:         23 frames/sec
Video quality:           113
Packet Bitstream:        False
ISFT data:               VirtualDubMod 1.5.10.2 (build 2540/release)
JUNK data:               VirtualDubMod build 2540/release
USER data:               XviD0046
Audio 01:                0x2000 (AC3) 448.00 Kb/Sec - 48000 Hz (6 Channels)

As you can see, my copy of Sunshine has 6-channel audio (i.e. 5.1). But what if you want to run a batch job to check all of your films and see which ones have surround sound?

Then use perl.

I wrote an extremely hacky script that takes a path as an argument and whizzes round to fetch the encoding of all .avi or .AVI files in the directory. It prints the names of any that have more than 2 audio channels (i.e. better than stereo).

It sometimes goes wrong if the output of themonospot-console varies, as it occasionally does.

So you get output like this…

[jonathan@zeus ~]$ ./findAudioEncoding.pl /media/public/Movies/
/media/public/Movies/Catch Me If You Can/Catch Me If You Can.avi : 6
/media/public/Movies/National Treasure - Book of Secrets/National Treasure - Book of Secrets.avi : 6
/media/public/Movies/Never Been Kissed/Never Been Kissed.avi : 6
/media/public/Movies/Rescuers, The/Rescuers, The.avi : 5
Argument "" isn't numeric in numeric gt (>) at ./findAudioEncoding.pl line 12.
/media/public/Movies/Brideshead Revisited/Brideshead Revisited.avi : 5
/media/public/Movies/Passion of the Christ, The/Passion of the Christ, The.avi : 6

If you’re interested in the source, here it is. If you find this useful, why not “like” my post? (The at the bottom)

#!/usr/bin/perl -w
# findAudioEncoding.pl

use strict;
my $path = $ARGV[0];
chomp (my @files = `find $path 2> /dev/null | grep -i .avi`);
foreach my $file (@files) {
        chomp (my $channels = `themonospot-console "$file" | grep \"Audio 01\" | awk \' { print \$10 } \'`);
        $channels =~ s/\(//g;
        if ($channels > 2) {
                print "$file : $channels\n";
        }
}
Categories: Guides, Linux Tags: , , , ,

CameraTutor

January 4th, 2010 Jonathan No comments

My friend Stu (former organiser of the Photo Challenge and professional photographer based in Leicestershire) has recently launched a photography tutorial website called CameraTutor. There’s not much more I can add other than this info from the site itself, and my encouragement to follow the blog if you are interested in photography yourself.

Starting on the 1st of January, 2010 will be a series of photography tutorials to help you get the best from your camera – it doesn’t matter if you have a top-of-the-range SLR or a point and shoot, there should be something for everyone here. A new tutorial will appear each Friday morning, giving information on a single technique, concept or other thinking point. I hope not to make anything too complicated, and welcome questions and comments on each post in the comments section.

So come along for the ride – I hope I will learn from you as much as you will learn from me, and we can all improve together.

Categories: Guides, Photography Tags: ,

Taking screenshots on an Android-based phone

December 10th, 2009 Jonathan 2 comments

Yesterday I got an Android-based smartphone (an HTC Magic). Today I want to document some of its features, which also includes taking screenshots.

Unfortunately there is no way of taking screenshots with the provided software, and the only screenshot app in the Market requires you to have a rooted phone.

I eventually came across this guide which explains how to take screenshots using a PC and the Android SDK. However not all of the steps are necessary so I’ve prepared a slightly simplified version.

  1. On your Android phone, go to Settings, then Applications, and then Development. Check the checkbox to enable USB debugging.
  2. Download the Android SDK for your platform here.
  3. Unzip the SDK in a convenient location.
  4. Run the DDMS program from the tools folder, inside the folder that you just unzipped.
  5. Plug your Android handset into a USB port on your computer, if it is not plugged in already.
  6. You should see your Android phone appear in the top-left pane of the program. Select it.
  7. Click on the Device menu and choose Screen capture.
  8. From the box that pops up, you can see what’s on your Android device and either save or copy the screenshots.

Christina Warren goes on to say:

There is a caveat: Because your device has to be plugged into USB to be accessed by the SDK, the SD card cannot be used for taking photographs, playing music or downloading music from the Amazon.com MP3 store. You can take pictures of some of those screens, but to actually download anything, take movies, or take a photo, you cannot have your device plugged into the computer and accessed by the SDK.

I can’t comment on that – like I said, I’ve only had the Magic since yesterday and I haven’t tried much on it yet.

This method is not quite as convenient as on other platforms, but it’s your only choice if you’re not prepared to root your phone. It’s good enough for stuff like these email instructions, anyway.

Categories: Guides Tags: , ,

My 35mm pinhole camera

December 1st, 2009 Jonathan 2 comments

After I posted the other day about building a pinhole camera, I immediately ordered a body cap from eBay. Last night it arrived, and here’s how I made my pinhole camera.

Making the pinhole “lens”

Not only do pinholes have to be tiny in diameter, they should also be made through a thin material. I didn’t even attempt to make a pinhole directly in the body cap. I drilled a 10mm hole and superglued a piece of tin foil over the hole. Using a fine pin, I made a small hole.

Front of pinhole lens

Front of pinhole lens

Rear of pinhole lens

Rear of pinhole lens

Uh, that’s it. Most guides I write have more steps than this, but making a pinhole “lens” for an SLR really is this easy.

What’s the f-number?

The formula for working out the f-number is pretty simple:

           focal length
f-stop = -----------------
         aperture diameter

The aperture diameter is the diameter of the pinhole, and the focal length is the distance between the film and the pinhole.

The Canon AE-1 Program has a small mark on the side to indicate the position of the film plane. The rough distance between this mark and the pinhole is 36mm. Getting a decent estimate of the pinhole is a little trickier, as I need to measure the diameter of the pinhole. The best I could come up with was to take a picture of the pinhole next to a ruler with my Fuji S9600 and a macro lens.

The pinhole

The pinhole

I reckon that’s approximately 0.2mm across.

          36
f-stop = ----- = 180
          0.2

So this is a pretty tiny aperture, and we are going to need long exposures to get it to make a decent picture on film.

Earlier on I pointed the camera out of my window. With the shutter set to its slowest value of 2 seconds, the meter reckoned it wanted an aperture of 8. 180 is 22 times greater than 8, so I need to make my shutter 22 times longer than 2. So we are talking 40-odd seconds for outdoor landscape photography in daylight on ISO200 film. In lower light conditions and perhaps on ISO125 film (such as my Ilford FP4) it’s easy to see that I might need to expose for 2 or 3 minutes.

Although 2 seconds is the longest my SLR can do automatically, it has a mode where the photographer can hold the shutter release for as long as necessary. Never thought I’d need a stopwatch for my photography! :)

My 35mm pinhole camera

My 35mm pinhole camera

The advantage of making a removable pinhole lens is that I can carry it around and easily change between lenses.

Keep an eye on my photo blog. When I’ve got this film developed I’ll scan and post the pinhole images there.

Update: I have now uploaded some of the pinhole photos.

Calibrating a TFT monitor

October 26th, 2009 Jonathan No comments

I hadn’t realised how important it is to calibrate a monitor correctly.

My former method of “calibration” was simply to set the monitor’s contrast to maximum, and set the monitor’s brightness to a value that looked comfortable to me. I didn’t bother changing any settings in software.

But I got caught out.

Last night I took some photos and tweaked them on my PC so they looked OK. I published them and thought nothing of it. But several of my friends commented that they looked a bit dark, and when I checked the pictures out on two of the computers at work, they were indeed too dark.

My badly-calibrated monitors at home caused me to wrongly edit an image. So I read up on how to calibrate a monitor. There are many ways, but the method I’m writing about here is nice and simple.

  • If you have TFTs, they are sensitive to the angle you look at them. Tilt them so they face directly at you.
  • Turn the lights off in the room you are working in.
  • On the monitor, set the colour temperature to 6500K
  • On the monitor, set the contrast to 100%
  • Look at the gamma black chart below. Adjust the brightness on the monitor until:
    • Bar A is just visible at the bottom
    • Bar B is visible from the bottom to about halfway up the chart
  • Gamma black chart

    Gamma black chart

  • Absolute black on your monitor is now calibrated.
  • Find how to adjust the gamma on your computer. For example, I am running the proprietary nVidia X driver on Fedora and it comes with a convenient control panel. You can use Adobe Photo Shop to adjust the gamma, or xgamma under X Windows on Unix/Linux systems.
  • Now look at the gamma chart below. Sit as far as possible from the monitor and squint so the lines blur together.
  • Gamma chart

    Gamma chart

  • Adjust the gamma on your computer so the shade of grey completely across the gamma column is the same at 2.2.
  • The monitor is now calibrated.

References

Categories: Guides, Photography Tags: , , ,

How to develop black & white film

October 23rd, 2009 Jonathan No comments

As my interest in photography progressed, it was only natural I’d one day end up wanting to develop film. I developed my first roll last night by following this guide. It was extremely helpful – but there were a few points it didn’t cover. I made notes while I was developing, and so here’s a modified version of the guide, including my advice.

If you’re interested in seeing what I was able to achieve, some samples are here.

What you’ll need

These are the items in my inventory. I’ve bought “proper” gear where necessary but most of the kitchen-type items came from a supermarket for pennies. I bought the developing tank from eBay, and the same seller was also offering a kit with all the chemicals, listed as Ilford Black & White Film Developer’s pack

  • Developer
  • Stop bath
  • Fixer
  • Wetting agent (cheap washing up liquid will do)
  • A developing tank
  • 3 water bottles – preferably one litre
  • 3 plastic jugs – at least one litre
  • Funnel
  • Kitchen timer (get one with a mechanical knob rather than a digital one)
  • Clothes pegs
  • A place to hang the negatives sufficiently high that they won’t touch the ground
  • A dim light. Colour doesn’t matter- perhaps a torch with half-flat batteries.
  • Scissors
  • Bottle opener
  • Something to stir the chemicals with. I used old picnic cutlery!
  • A storage box for all of the above, with a lid.
  • Room thermometer

    Preparation

    If this is your first time developing a film, there are some things you should do first. You should probably do them before every time you develop a film, even if you’ve been doing it for years :)

  1. Familiarise yourself with how to mix each of the chemicals – how much concentrate to how much water, how much you want to end up with, etc.
  2. Make a note of how much of each chemical your tank requires you to use.
  3. Calculate and make a note of how long each of the three phases should take.
  4. Label each of your empty bottles and jugs with a permanent pen so you know which chemical belongs in which jug.
  5. Loading the film

  6. Take film, bottle opener, scissors, developing tank and reels into a lightproof room.
  7. Organize the materials on a table. You’ll need to know where each item is in the darkness.
  8. Turn off the light.
  9. Open the film canister at either end with the bottle opener.
  10. Take the film out of the canister and cut off the leading tab at the end to create a straight edge.
  11. Load the film onto your tank’s spool. The method varies depending upon your tank, but I found my Paterson System 4 tank easy to use.
  12. Pull or cut the end of the film off the spool and remove the tape.
  13. Drop the loaded reel into the developing tank and secure the lid.
  14. Turn the light back on.
  15. Developing the Film

  16. Mix chemicals according to directions.
  17. Put the right amount of each chemical into the three jugs.
  18. Put any leftover chemicals into the plastic bottles for storage.
  19. Technically with a good tank you should be safe to have the light on, but it never hurts to be cautious, so at this point I switched the main light off and worked by the light of a dim torch, pointing at the ceiling to softly illuminate the whole room. If you wait a minute or two, your eyes will get accustomed to the low light.
  20. Take the top off the developing tank.
  21. Pour the pre-measured developer into the top of the tank.
  22. Tap the tank against the counter to dislodge bubbles.
  23. Agitate the tank by slowly inverting it and turning it back over for the first 15 seconds.
  24. Repeat every 30 seconds for the recommended time (usually 5 to 10 minutes).
  25. Pour the developer back into the jug.
  26. Pour stop bath into the now-empty developing tank.
  27. Agitate the stop bath and let stand for 1 minute.
  28. Pour out the stop bath and replace with fixer.
  29. Agitate the fixer for 15 seconds and then for 15 seconds once every minute for the allotted time.
  30. Pour the fixer back into its jug.
  31. Remove the lid of the tank and run water into the tank for 15 minutes.
  32. Add wetting agent to the water to expedite drying. If you are using washing up liquid, add a tiny drop to the water in the tank and let it sit for a minute.
  33. Remove the film from the tank.
  34. Gently pull the film off the reel.
  35. Attach a clip to the top of the film and hang it up. I hung mine from a clothes horse in the bath.
  36. Attach another 2 or 3 clips at the bottom, to prevent the film from curling as it dries.
  37. Hang the film in a dry, dust-free area.
  38. I don’t know how long it really takes them to dry, because I went to bed at this point. When I woke up, the film was dry and straight.
  39. Cut the film into appropriate length chunks for your scanner / envelopes / etc.
  40. Store dry negatives in plastic negative sleeves.
  41. Afterwards

  42. You can usually re-use the developer several times (although it takes longer each time). Store it in a clearly labelled bottle.
  43. You can re-use the fixer. Store it in a clearly labelled bottle.
  44. Rinse all of the “dirty” components in warm water and dry them thoroughly before putting them away in a clean place.

Tips & warnings

  • The optimal temperature for most developers is 20°C. Processing at a significantly higher or lower temperature will result in soft, easily damaged film or flat negatives. Some developers have a chart on the packaging to give the time correction if your room temperature is different from this.
  • Do not remove the top of the developing tank to look at the film until after the fixing stage.
  • Use storage bottles that are just the right size for the amount of developer you are mixing. Label a chemical with its name, date and dilution.
  • Begin timing each step as you pour chemicals into the developing tank, and start draining chemicals 10 seconds before the time is up.

Building a bottle battery

October 18th, 2009 Jonathan No comments

If you read my blog, you’ll have seen my recent review of my RSP Asteri 2 bike lights. I talked about making a bottle battery, and now I have.

Unfortunately I forgot to take photos after the first couple of steps but never mind.

What you’ll need

I used the following parts, but you can use whatever you like.

Qty Part Notes Store Price
1 Bottle I bought a PwrTek bottle for mixing protein shakes. It had a wide neck and an offset “spout” ASDA £4.00
2 D rechargeable NiMH 8000mAh 2pk You can use any type you like. Check the mAh rating. Maplin £25.98
4 Battery holder Optional. I just didn’t fancy soldering directly on the battery. Maplin £3.16
1 DC connector 2.5/5.5mm Maplin £0.99
1m Single core cable Should be flexible for use inside the bottle Maplin £0.69
1m Twin core rounded cable For use on the frame. Maplin £0.69
Total £35.51

A note on batteries

  • It doesn’t matter what kind of rechargeable batteries you use – NiCd, NiMH and Li-Ion are all fine.
  • It doesn’t matter what size of batteries you use. If you wanted to make a smaller “pouch” of batteries you could use C type.
  • You must have precisely 4 batteries in each series loop, but there’s nothing to stop you using 8 batteries and having two series loops in parallel.
  • The capacity (measured in mAh) is an indicator of how long the batteries might last.
    • The batteries that come with the RSP Asteri 2 are AA NiMH batteries; 1600 mAh each. The manufacturer reckons you can get 1-2 hours on full power and 6 hours on flashing.
    • Inexpensive D type batteries might give you around 3000 mAh, which immediately doubles your battery life.
    • My D type batteries give a claimed 8000mAh. Scaling up the manufacturer’s estimate, I might be able to get 5-10 hours on full power, or 30 hours flashing. This basically gives me the ability to do a week’s commuting on full power without recharging until the weekend.

Building it

I cable-tied the battery holders back-to-back as they happened to have holes in the right place. A pair of D batteries just about fitted through the neck of the bottle if I squeezed the bottle. I attached the batteries in two pairs so they could sit on top of each other.

I soldered the battery holders together in series using the single-core wire. I used fairly long stretches of wire (about 8″) between the upper and lower pairs of batteries, to make it easier to feed the batteries into the bottle.

Wiring diagram

Wiring diagram

I taped up the exposed solder with insulating tape so there was no chance it could make a short circuit if the batteries moved around once in the bottle. I packed the batteries into place with bubble wrap so they wouldn’t rattle and risk damaging the solder.

At the neck of the bottle, I terminated the two single cored with a terminal block and connected the twin-core cable to the other side. I threaded it through the spout of the bottle and screwed the cap on. The terminal block also allows you to easily reverse the polarity of the circuit if you accidentally wire it back to front for your LEDs. ;)

I measured the trailing cable to make sure I had the right length, before trimming it and soldering the DC power connector on the end.

The screw cap seemed tight and waterproof so I left it alone, but I plugged the gap around the cable through the spout with hot-melt glue gun.

The batteries I bought claim to come fully charged so I was able to test it immediately. Which brings us on to our next section.

Recharging

Obviously it’s going to be a bit of a pain to remove the batteries to recharge them, so we will charge them through the neck cable. Buy a female DC socket to match the plug you bought for the bottle battery. Also buy a female connector to match the RSP charger’s plug. Solder them together and ta-da! You have an adapter cable to connect your battery to the charger. Watch the polarity here, or you might set fire to your house.

If you don’t want to take the risk of breaking your original RSP charger, any DC power supply capable of supplying 7.5V with at least 300mA should do the trick.

Considerations

The original RSP battery had a warning LED for low battery. You don’t, so be careful you don’t over-discharge the bottle battery or you might damage the NiMH cells. As soon as the LEDs start to go dim, switch them off. You would, of course, be wise to keep a regular battery light in your bag in case of emergencies. I keep a Cat Eye HL-EL510 for situations like these.

The original RSP battery had automatic charging shutoff when it was full. You don’t, so be careful not to overcharge the batteries. Probably 12-18 hours will be enough. Check the instructions that came with your batteries.

You can get around both of these considerations if you pilfer or copy the PCB in the top of the original RSP battery pack. Again, depends if you are willing to sacrifice your original battery pack, and if you can be bothered with the effort.

Guide listings in Vista MCE for ITV channels

October 7th, 2009 Jonathan No comments

When I get my Vista-based Media Center to scan for FreeView channels, it finds them all correctly. When I go to add listings, I choose my region and it fetches them. But ITV1 and ITV2 both lack listings – despite the fact that the listings in question appear to be available.

There’s a tweak you have to do, and then it all works wonderfully.

  1. First go to the Main Menu, choose Tasks and then Settings.

    Step 1

    Step 1

  2. Choose TV

    Step 2

    Step 2

  3. Choose Guide

    Step 3

    Step 3

  4. Choose Add Listings to Channel

    Step 4

    Step 4

  5. Choose the channel that is causing you problems. For me it was ITV1 and ITV2 (although oddly not ITV2+1).

    Step 5

    Step 5

  6. Scroll down the alphabetical list of available guides, and choose the right one for your channel. As you can see, there may be more than one available guide for some of the channels, so try both until you get one that works.

    Step 7

    Step 6

  7. Choose Save

    Step 8

    Step 7

  8. Rinse and repeat for each of the channels that is lacking guide data.
  9. Open the Guide and make sure the data is now there.

    Step 9

    Step 9

SSH tunnelling to your home network

September 24th, 2009 Jonathan No comments

SSH tunelling is no big secret, and there are loads of guides out there that explain how it is done in generic terms. This guide is slightly different, as it explains how to tunnel to hosts that are not publicly addressable.

For example, if you have a Linux server as your home network gateway then you can simply open ports on it, e.g. port 80 for a web server.

If you want to access a service on a computer on your network other than your server, you will have to set up port forwarding.

But there’s another way. Today while I was at work, I needed to change something on my home network printer’s web interface. The printer has a private IP address in the range 192.168.0.0/24 and there is no port forwarding set up (why would I want to share my printer’s control panel on the internet?).

Supposing my server is called jonathangazeley.com then I can enter a command like this from my work PC:

ssh -f jonathan@jonathangazeley.com -L 2000:192.168.0.105:80 -N

This command sets up port 2000 on localhost to point to port 80 on my printer at home.

Then I open my browser at work and navigate to http://localhost:2000

Hey presto, I can now see my printer’s config page remotely. As a nice by-product, the connection is also encrypted by the ssh protocol.

Configuring sendmail to use a Smart Host

September 24th, 2009 Jonathan No comments

Chances are if you have a Linux server in your home, you’ll want it to be able to send you emails, e.g. its daily logwatch or the output from cron jobs.

But most ISPs block SMTP so you can’t directly send emails from your server to wherever they need to go, which is what the default config of sendmail does.

So you need to tell sendmail to forward its mail through something called a Smart Host, which is just an SMTP server that your ISP runs.

First, find out from your ISP what their Smart Host or SMTP server is called. This is usually available somewhere on their website.

Now open up /etc/mail/sendmail.mc for editing. Locate the following block, remove the dnl markers and change the name of the server to match your ISP’s.

dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST', `mail.my-isp.com')

After editing, you have to run the /etc/mail/make program to write the sendmail config file. Then restart the sendmail daemon.

service sendmail restart

Your server is now capable of sending outoing mail through an external mail server. But there’s one final tweak. Open /etc/aliases and change the very last line so that you receive root’s mail.

# Person who should get root's mail
root:           me@jonathangazeley.com
Categories: Guides, Linux Tags: , , , ,