Customized Digikam Flickr uploader

I wrote a bash script that helps me to upload photos from Digikam to Flickr. The title and description of each uploaded photo are automatically set and are pulled from the Digikam image comments. I found the build-in Digikam Flickr uploader (provided by the KipiPlugins project) to be to limited in functionality. On Flickr each photo has a title and a description. The Kipi Flickr uploader sets the filename of each image as the title. Since all my photo files are stored with a unique date-serial name (e.g. 051202-3468.jpg), the title in Flickr doesn’t look nice after an upload.
My script sets the title to the first line of the comments that are kept with the photo in Digikam.
The description is set to the entire contents of the comments field. The first line in the comments field has to be separated by a line-feed (return). If no comments are available no description is given and the title is set to the filename. After each upload a log file is updated with the filenames and corresponding Flickr-id’s of the uploaded pictures. The script is just a wrapper. The actual uploading is done by the ‘flickr_upload’ script as provided by the Perl package Flickr::Upload.

Click here to download the script

Flash video player in Blackboard

This guide is outdated.

A revised version is available at:


http://icto.weblog.leidenuniv.nl/2009/04/21/embed-a-flash-video-player-in-blackboard

—————————————

Howto: embed a flash video file (FLV) in Blackboard.
Create a YouTube like video player in your Blackboard course in 10 steps.
This howto was written for JW_FLV_Media_Player 3-14.
Download this Howto as a pdf file.

1. Download the JW_FLV_Media_Player from http://www.jeroenwijering.com/?item=JW_FLV_Media_Player .

2. Unzip the downloaded zip file somewhere on your computer. Remember where you put the files.

3. In your Blackboard course create a Folder somewhere in a Content area. In this example I created the folder ‘JW Mediaplayer’ in the content area Documents&Sheets. Of course you can use any name you like.

4. Upload the file ‘mediaplayer.swf’ to the folder ‘JW Mediaplayer’: create a new Item, give it a name and choose attach local file. Click ‘Browse’ to select the file to attach. In this case ‘mediaplayer.swf’ (you can find it where you unzipped the JW_FLV_Media_Player file (step 1.). Make sure you select Special Action: create a link to this file. The file ‘mediaplayer.swf’ is the actual media player application.

Click to enlarge picture htflvbb_pic1.jpg.

5. Upload the video file you want to embed to the folder ‘JW Mediaplayer’: create a new Item, give it a name and choose attach local file. In this example I uploaded the video file ‘video.flv’. Again, make sure you select Special Action: create a link to this file.

6. Upload the picture you want to show in the player before the movie clip starts to play to the folder ‘JW Mediaplayer’: create a new Item, give it a name and choose attach local file. In this example I uploaded the picture ‘video.jpg’. Again, make sure you select Special Action: create a link to this file.

7. Open a new tab/windows in your browser. Open the setup wizard at http://www.jeroenwijering.com/?page=wizard to create the html code required to embed the movie player.

8. In the setup wizard fill in the appropriate values under ‘Tweak the available flashvars’. For ‘source’, ‘file’ and ‘image’ these are the hyperlinks to the items you uploaded in step 4-6. You can find the hyperlink by clicking the right mouse button on any of these items in the folder ‘JW Mediaplayer’ in your Blackboard course and choose ‘Copy Link Location’ (Firefox) or ‘Copy Shortcut’ (Internet Explorer). Now go to the setup wizard an enter the value by clicking into the related form field and type ctrl-v (paste) or right click and select paste. Height and width refer you the dimensions of the video file.

Click to enlarge picture htflvbb_pic3.jpg.

9. After entering all the values click ‘Update preview&code’.

Click to enlarge picture htflvbb_pic4.jpg.

10. Copy the rendered code from the setup wizard and paste it in a new Item you create in the folder ‘JW Mediaplayer’. Make sure you set the Content Information type to ‘HTML’ In this example I set the item name to ‘Test movie clip (embedded)’.

Click to enlarge picture htflvbb_pic2.jpg

Done. Play your movie!

Optional:

Store the media player application ‘mediaplayer.swf’ in a location outside Blackboard. It is not necessary to store the player inside Blackboard. You can put it anywhere on-line. This is especially useful if you have several embedded player in your Blackboard course(s). You can link to just one mediaplayer.swf outside Blackboard instead of having to upload a mediaplayer.swf file for each embedded player you use. Just make sure to change the ‘source’ value in the setup-wizard and update the code. Also verify that your students actually have access to the location where you stored the player. This is also true for the video file and the the picture. If you like you can also store it outside Blackboard.

Experiment with the different player settings in the setup wizard.

Hands on with the Tesseract OCR engine

Tesseract is an open source optical character recognition (OCR) engine that was developed at HP Labs between 1985 and 1995 and now at Google. According Google it is one of the most accurate open source OCR engines available.

Last week a colleague asked me if I could help him bring back to his word processor an old syllabus with more then 200 pages written in Dutch. The original digital texts of this syllabus were lost. What was left was a printed version and a pdf raster image file that was saved at the printing office. The existence of the pdf file was major time saver. Now I only had to convert the pdf file to images and feed them to an ocr engine. I started with GOCR. Version 0.40 was already installed on my workstation. But I wasn’t happy with the results. To much errors. So I decided to test Tesseract V2.01. The output was clearly more accurate than GOCR. Very acceptable. Click ‘continue reading’ for a detailled comparison and my ocr workflow

Continue reading

Timeline representation of a videofile

One of the challenges when building a digital video collection is how to make an effective retrieval system. Obviously for the best results you will have to take an effort to apply metadata to each video and to store it in a database or xml file. On the frontend side of the database a visual timeline representation of a video can help users to quickly evaluate their search results. See the example below. This timeline was created with the SlickSlice script. With this script you can index any videofile that can be played with the excellent MPlayer.

.
slicksliced_mvi_0913.avi.jpg

About the little movie in this timeline: it shows how an ipod can be used as a plasma screen for a scale model. Video taken at Maze de Boer’s atelier at de Rijksakademie.

Simple E-mail Merge

We all know the ‘mail merge’ function that comes with allmost every wordprocessor. You compose one letter you want to send to a group of individuals and their names and addresses are inserted in each letter automatically from a list. I needed such a mail merge for an e-mail I wanted to send. I found that none of the e-mail clients I use supported an ‘e-mail merge’. After some googling I found Tobin Maginnis’ Simple Mail List Shell Script.

This was exactly what I needed. Well, allmost. I needed a slightly more sophisticated approach to name and e-mail management. Also I wanted to be able to insert the subject from the command line instead from the source of the program. So I wrote Simple E-mail Merge (sem). It should run on any posix system. I use msmtp to send the mail via the smtp server of my internet provider.

You invoke sem like this:

sem maillist message "My subject line"


The file ‘maillist’ might look something like:


Bill,hisemailaddress@sample.comm
Steve,sample@address.comm
Larry & Sergey,anothersample@address.comm


The ‘message’ file contains the letter you want to send.

Here’s the code. Please make sure to read my software notice before using this.

#!/bin/bash
#
# Simple E-mail Merge (sem)
#
# September 2007
# v.0.4
# by Jeroen Leijen
# http://jeroen.leijen.net
#
# based on Tobin Maginnis' Simple Mail List Shell Script
# http://pix.cs.olemiss.edu/mailscript.html
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# The full text of this software license is at: http://www.gnu.org/licenses/gpl.txt
# or to receive a written copy of the GNU General Public License, write to
# the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA
#
if [ ${#@} != 3 ]; then
echo "Usage: $0 MailList Letter Subject(in quotes) "
else
if [[ -e "$1" && -e "$2" ]]; then
echo "Sending $2 with subject $3 to mail list: $1 ..."
while read line ; do
name=`echo $line| cut -d ',' -f 1`
email=`echo $line| cut -d ',' -f 2`
echo "Mailing: $name"
echo "with e-mailaddress: $email"
#You can change 'Dear' in the next line to whatever you need
echo "Dear ${name}," > tempmail$$
cat $2 >> tempmail$$
mail -s "`echo $3`" `echo $email` < tempmail$$
#if you like a bcc copy use this line
#mail -s "`echo $3`" -b your_bcc_address@mail.comm `echo $email` < tempmail$$
done < $1
rm tempmail$$
echo "Finished mail list: $1"
else
echo "Cannot find mail list file: $1 and/or letter file: $2"
fi
fi

Produce Windows compatible video with OSS (update)

Back in April 2006 I published a short article on how to produce a Microsoft Windows Media Player (MSWMP) compatible video file with open source tools. A few weeks ago I noticed that a file I just converted with my method produced an error during playback in MSWMP.

After some trial and error I found these Mencoder settings to be working:
mencoder name_input_file -oac mp3lame -lameopts preset=64 -ovc lavc -lavcopts vcodec=msmpeg4v2:keyint=5:vbitrate=850:mbd=2:mv0 -ofps 24 -o output_filename.avi

This produces an avi file containing a video compressed with the msmpeg4v2 video codec and the lame mp3 audio codec. It should play with any MSWMP version.

However, if you want to stream this file with a Windows Media streaming server it won’t play. For Windows Media streaming the video has to be put in an asf container instead of an avi container. These Mencoder settings should have done the trick:

mencoder name_input_file -oac mp3lame -lameopts preset=64 -ovc lavc -lavcopts vcodec=msmpeg4v2:keyint=5:vbitrate=850:mbd=2:mv0 -ofps 24 -of lavf -lavfopts format=asf:i_certify_that_my_video_stream_does_not_use_b_frames -o output_filename.asf


But that didn’t work. Maybe Mencoder asf muxing is buggy. I don’t know. Fortunately there are other methods. You can find the VLC solution in my original article. With FFmpeg you can use these settings:


ffmpeg -i name_input_file -vcodec msmpeg4v2 -acodec mp3 -f asf output_filename.asf

More on FFmpeg Windows compatibility can be found here: http://ffmpeg.mplayerhq.hu/compat.html.

I you want to see an example please click below. This video from BBC News (originally in RealVideo, how Ironically) is transcoded with: ffmpeg -i ~/bbc_microsoft.avi -vcodec msmpeg4v2 -acodec mp3 -f asf bbc.asf

Linux, Citrix MetaFrame and VUW2

Last week the office PC’s at our faculty have been updated with new software. The biggest change is the use of Citrix MetaFrame for all ‘non-standard’ applications. Citrix is now also used for the remote desktop service that allows employees to access their desktop from anywhere in the world.
Luckily there is Citrix MetaFrame client for Linux. Installation was easy. But when I wanted to launch an application I got this error: “You have not chosen to trust “Equifax Secure Global eBusiness CA-1″, the issuer of the server’s security certificate.”.
Here is how to fix this problem:
Download the Equifax_Secure_Global_eBusiness_CA-1.cer certificate from Geotrust
Copy the certificate to the keystore directory. On my SuSE system I did: cp equifax.cer /usr/lib/ICAClient/keystore/cacerts

But that was not all. The second problem was that my local drives were not mapped.
To map a local drive, modify the file ‘wfclient.ini’ (it is somewhere in ~/.ICAClient/) by adding the following lines:

[WFClient]

DrivePathA=/path/to/the/a_directory_on_the_client_machine
DriveEnabledA=Yes
DriveReadAccessA=0
DriveWriteAccessA=0

This obviously makes the directory ‘/path/to/the/a_directory_on_the_client_machine’ available as the floppy (A:) drive in your Citrix session.

Produce Windows compatible video with OSS

In this posting I will discuss how to create a Windows Media Player-compatible streaming video file on a Linux machine using only open source tools. My example shows how to prepare a clip recorded with a DV camcorder for streaming on a Jet-Stream XL2 server targeting an audience with a default WinXP/SP2 installation of the Windows Media Player.

Continue reading

Recording streamed media

Sometimes you want to be able to download a file that is offered on a website as a stream. For instance if you want to watch or listen to the file when you’re not online. Or, if you are afraid that the stream will be removed from the site. Using MPlayer you can download any streamed file that is supported by this program.
Example:

mplayer -cache 2000 -dumpstream ‘mms://wm.stream1.fsw.leidenuniv.nl/law/jeroen_ski_test.asf’ -dumpfile my_recording.wmv

The stream, in this example mms://wm.stream1.fsw.leidenuniv.nl/law/jeroen_ski_test.asf, is dumped to the local filesystem as my-recording.wmv. This process does not affect the media encoding. This means that if the original streamed file is a Windows Media file, so is the dumped version. You can also record media files that are served from a regular webserver.
E.g.

mplayer -cache 2000 -dumpstream http://fredrik.hubbe.net/plugger/test.mpg -dumpfile my_recording.wmv

Nb. the single quotes around the stream location ensure that an URL that contains whitespaces will be parsed properly.

Sometimes it’s hard to find the URL of the stream you want to record. Luckely the lovely MPlayerplugin allows you to save the URL of the file you are watching in your browser. A more dramatic way to discover the URL the mediaplayer is playing is to sniff your network traffic for stream URL’s. For example by using StreamSniff.

Note: respect copyright restrictions that may apply to the stream you want to record.