Video editing in Ubuntu Intrepid

I spent several hours experimenting with open source video editing software. My verdict? Kino (1.3) is good enough for my basic needs. More specifically, I was able to add a clean title, have simple (but good) transitions, a soundtrack as well as original sound, and lots of separate clips joined together. I was disappointed that I wasn’t able to use kdenlive (0.6) successfully, as it had quite a nice interface, but my clips were being truncated with the image disappearing first and then finally both audio and video by the end of the clip. Couldn’t figure it out. Cinelerra http://en.wikipedia.org/wiki/Cinelerra was a bit much for me but there is a new version out (4.0) and it will suit more advanced users.

So what is needed to use Kino?

  1. Install kino (use synaptic)
  2. Install soundconverter (for creating wav files for soundtracks). NB not the same as another splendid program called soundrecorder πŸ˜‰ . You will also need the ability to output wavs so follow the instructions here.
  3. Install mjpegtools so you can export as mjpegs

Details on adding sound are here. You need to make wavs and use mix as the FX for the whole time range.

For adding titles etc look here. One approach is to create a block using FX which is coloured (FX create) and then add the title (FX overwrite). The Video filter you need to select is Titler. NB to use the Render button when in FX to implement your effect. This is a different process from rendering the entire timeline or exporting it.

Final tip – my Panasonic H280 worked fine with Ubuntu via USB. But remember to open the interface and select PC rather than pictbridge etc so that the connection can actually occur. If you don’t tell it how to connect over USB you will never see the drive get mounted!

I’m expecting to have to update this page in a year or two as better solutions emerge.

Solving Ubuntu printer “broken pipe” problem (DocuPrint C525A)

Are you having a problem with your printer under the latest versions of Ubuntu (perhaps it worked under an older version)? Are you able to print short documents, but not longer, or more graphics-intensive, documents? (e.g. the unfortunate people at http://ubuntuforums.org/showthread.php?t=625493). Do they sit there as Processing for ages and then switch to Held? If you have the same problem I had the solution I tried may work for you too. Firstly, check your cups error log:

sudo gedit /var/log/cups/error_log

If you see anything like the following, the solution may be simple:

[Job 201] Unable to write print data: Broken pipe
PID 13359 (/usr/lib/cups/backend/socket) stopped with status 1!

System > Administration > Printing and right click on your printer, selecting Properties. Settings > Device URI
If you see something like socket://your_printer_ip_address:9100 just change socket to lpd and remove the :9100 off the end. Then click on apply.

Apparently lpd is a more modern protocol which works with most printers whereas socket is more raw (and potentially faster but riskier in a network situation). Somewhere along the line, the default Ubuntu/Gnome setup for networked printers shifted from lpd to socket. Some primitive printers will have benefited whereas a larger number of more modern printers will have suffered.

Please correct me if I am wrong (which is highly possible) but the underlying problem could be that socket may make the printer wait a long time for a large file to be processed ready for printing. Some printers, such as the Fuji Xerox DocuPrint C525A, may drop the socket if things take too long to start coming through.

Changing timeout settings might work but lpd is better than socket so it is the preferred solution in any case.

If this works for you, please leave a comment to let others know (ideally with a description of the printer and Ubuntu version). Printer may be relevant if it doesn’t support the direct stream protocol properly. NB I may take a while to let your comment through because of the volume of spam. Sorry about that.

Finally, thanks to sphilli8 for the steer in the right direction at http://ubuntuforums.org/showthread.php?p=6245626.

winmail.dat – how to open in Thunderbird/Ubuntu

Once in a while you may receive an email with an attachment called “winmail.dat”. How do you open it?

Short answer: The LookOut addon for Thunderbird:

https://addons.mozilla.org/en-US/thunderbird/addon/4433

Long answer:

Microsoft wanted to offer β€œrich” text features in their emails. The approach they took was to send a plain text version of the message and a version coded into a form of Rich Text Format. If the mailer at the other end could handle the Rich Text Format version they would see that, otherwise they would see the plain text. To do this, they used their own method, called the MicroSoft Transport Neutral Encapsulation Format, or MS-TNEF. Essentially a file called WINMAIL.DAT, which is just a standard MIME encoding of a Rich Text Format version of the message, is included with outgoing mail. http://blog.myfenris.net/?p=181.

So to answer some questions:

Q. Why is this happening?
A. Microsoft likes to break standards in its pursuit of a monopoly. This has been a very profitable strategy.

Q. Can I stop the person sending the email doing it again?
A. They need to avoid Rich Text for their emails or their Microsoft email program will automatically violate email strandards. From Wikipedia: “Within the Outlook email client TNEF encoding cannot be explicitly enabled or disabled. Selecting RTF as the format for sending an e-mail implicitly enables TNEF encoding, using it in preference to the more common and widely compatible MIME standard.” (http://en.wikipedia.org/wiki/TNEF).

Q. How do I open the attachment?
A. If you are using Thunderbird the easy answer is the LookOut extension. Otherwise, see below (with big thanks to: http://blog.myfenris.net/?p=181):

Install tnef:
sudo apt-get install tnef ytnef libytnef0 libytnef0-dev
Save proprietary, standards-non-compliant attatchment to your desktop
tnef --file=Desktop/winmail.dat
Open home folder to see extracted attachment – which could be a jpg or anything that is an attachment really.

Win98, WinXP, and Intrepid Partitions

I needed one of the computers in my home network to have a small partition for experimenting (e.g. installing Jaunty alphas etc), a large working partition using stable Intrepid, a small swap partition, a small Windows 98 partition for running legacy children’s games (there are multiple that Windows XP cannot run even in legacy mode), and a slightly larger Windows XP partition for newer children’s games.

I didn’t do everything in the correct order but here is the way it should have been done πŸ˜‰ . Install Windows 98 into the empty space on the HDD. It is the most primitive OS so it doesn’t play nicely with anything else if you install it after something else. NB I did things the wrong way but I managed to fix my Ubuntu installation with a live CD, the command line, and the following commands to restore the grub bootloader (NB it may be hd0,4 or whatever if that is where your main os is)):
sudo grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

NB the space between root (and setup) and the parentheses. See comment in response to: http://linuxpoison.blogspot.com/2008/09/how-to-restore-grub-with-ubuntu-live-cd.html.

NB if you can’t find the correct hd details try (from the grub prompt):
find /grub/stage1
or
find /boot/grub/stage1

If you have to reinstall win98 (perhaps you have shifted the hard drive into another computer) it is easiest to wipe the partition it is in first. And to prevent confusion, temporarily reformat the windows XP partition to NTFS to stop win98 recognising it and getting dangerously confused. Set back to FAT32 or whatever afterwards if you wish.

Anyway, after installing 98, use Gparted http://gparted.sourceforge.net/ (brilliant) to shrink the FAT32 partition to the desired size, and create another one for Windows XP. Install XP there. XP is advanced enough to allow you to select a specific partition to install into.

Rebooting into XP presented me with:

"Windows could not start because the following file is missing or corrupt:
system32hal.dll.
Please re-install a copy of the above file."

The solution in my case was found in http://pcsupport.about.com/od/findbyerrormessage/a/missinghaldll.htm in item 4 – repair boot.ini http://pcsupport.about.com/od/fixtheproblem/ht/repairbootini.htm and involved booting into the Windows XP CD, and selecting R for repair. It detects something like F:Windows and you get to a command prompt.

bootcfg /rebuild
y (to the question about adding to boot list)
“Windows XP” or similar to next question about Load Identifier (basically give a label useful to you)
/Fastdetect
as answer to final request: “Enter OS Load options”.

Exit to leave recovery console and restart computer.

And I thought proprietary systems were meant to be easy, intuitive and polished πŸ˜‰ . Continue installing XP.

Then create an extended partition into which you will want various ext3 logical partitions – a large one for the main Intrepid OS, a small one for the experimental OS, and a small swap file partition for swap file duties.

NB once the main OS has been installed, edit grub
sudo gedit /boot/grub/menu.lst
to recognise the two windows partitions (using the separate windows boot.ini process), and the experimental linux partition. I set the partition flags for the two FAT32 partitions to boot. I’m not sure what effect this had.

Further details re: boot.ini:

Open Windows XP, open Control Panel > System Properties > Advanced > Startup and Recovery > Setup and click the button to edit boot.ini (see http://vlaurie.com/computers2/Articles/dualboot.htm). NB once it is open save a copy somewhere before saving changes. You have to click on OK as you leave to save the changes. Test first with simple name changes to options e.g. “Windows XP plus extra word” to see that your changes are taking effect. More detailed configuration information is in http://vlaurie.com/computers2/Articles/bootini.htm.

I needed my Audigy2 disk plus a video card drive for the ATI Radeon 9600 (from the web) to get Windows 98 working with decent sound and video (needed for the legacy games). NB if your drivers break Windows 98, enter it in safe mode and uninstall them. Then you can start again. Have your Windows 98 disk on hand. Later on I had a similar situation with a different video card – a Nvidia Geforec FX5200 – the driver is here.

Of course, I can mount all the other partitions from within Linux if I need to transfer files etc.

Here is a reference to some good material on partitions etc http://users.bigpond.net.au/hermanzone/.

Finally, I wanted a way to run old DOS games like the brilliant cosmo. I could run them using pif files but there was no sound (cosmo expected the PC speaker to be available). I used dosbox instead. Install via synaptic of course. You can check out which games work best at: http://www.dosbox.com/comp_list.php?letter=a. One final problem – no arrow keys! The solution is at https://bugs.launchpad.net/ubuntu/+source/dosbox/+bug/283273 and involves starting dosbox (type dosbox in the terminal), and inside dosbox running:
config -writeconf dosbox.conf
Then open the newly-created ~/dosbox.conf and change
usescancodes=true
to
usescancodes=false

Finally, because children will be amongst the users of the computer, install ubuntu-tweak http://ubuntu-tweak.com/ then Applications > System Tools > Ubuntu Tweak > Desktop > Gnome > and tick the option to lockdown all panels. Brilliant.

Extra instructions for additional Linux partitions:

The linux partitions need entries like the following (possibly with an extra UUID item) within menu.lst:

title Debian GNU/Linux, kernel 2.6.27-9-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.27-9-generic root=UUID=5b6e4... ro quiet splash
initrd /boot/initrd.img-2.6.27-9-generic
boot

But where do you get the values for the UUID?

sudo blkid

/dev/sda1: UUID=”5b6e4…” TYPE=”ext3″
/dev/sda5: TYPE=”swap” UUID=”3880…”

and possibly a whole lot more entries besides if you have multiple boot partitions. As for the /boot/vmlinuz and /boot/initd.img kernel values, have a look inside the mounted partitions to get the version details correct.

NB It is a good idea to give each partition a useful label e.g. win98, winXP etc – perhaps within the Partition Manager via System > Administration > Partition Manager if installed (although you can’t alter the partition you are using I think) or using GParted via a CD.

Grab the splash details from the previous installation because the last Linux in controls the boot menu.

Deleting photos from Canon Powershot G2 using GTKam

In Ubuntu, at least in Intrepid, it is easy to open a USB camera like the Canon Powershot G2. You just plug it in and it mounts on the desktop, attractive icon and all. But I couldn’t delete photos from the DCIM card on the camera. [update – although a friend could delete files from his Powershot G10 which has a much smaller sized memory card). It said “Error while deleting” – There was an error deleting xxxxxxxx.jpg. And under Show more details was the terse message “Not supported” πŸ˜‰ .

Solution – install gphoto2 and gtkam via synaptic.

GTKam is excellent (http://gphoto.sourceforge.net/doc/manual/ref-gtkam.html.

NB to make sure the camera isn’t mounted already (unmount it yourself if by right-clicking on the icon if it appears on your desktop) when connecting to the camera. And make sure the camera hasn’t timed out in the middle (which might confuse you).

One false lead was installing the Canon software e.g. Zoombrowser, under WINE. It worked to a point but … no USB support to enable me to connect to the camera! See http://ubuntuforums.org/showthread.php?t=697238

Anyway, I prefer GTKam.

Using gphoto2 from the terminal can help check some things out. See http://www.gphoto.org/doc/manual/using-gphoto2.html.

From the terminal you should be able to run:

gphoto2 --auto-detect

and get something like:

Model Port
———————————————————-
Canon PowerShot G2 usb:

and as long as the camera isn’t already mounted, (and it hasn’t timed out!) the following should also work:

gphoto2 –list-files

e.g.

Detected a ‘Canon:PowerShot G2’.
There is no file in folder ‘/’.
There is no file in folder ‘/DCIM’.
There are 2 files in folder ‘/DCIM/101CANON’.
#1 IMG_0193.JPG rd 667 KB image/jpeg
#2 IMG_0195.JPG rd 1288 KB image/jpeg
There are 15 files in folder ‘/DCIM/102CANON’.
#3 IMG_0218.JPG rd 1571 KB image/jpeg
etc etc

Using cfdisk to prepare a USB HDD to store backups

I bought 2 1TB hard drives to use as backup storage. These couldn’t be mounted immediately because they had not been formatted. So what to do next to prepare them for use?

NB the convention for labelling devices has apparently changed and may differ between kernel versions – so what is true for me now (Intrepid kernel 2.6.27-7) may not apply to you. So double check everything you do. You really do not want to wipe the wrong disk πŸ˜‰ . I repeat, you really, really, really do not want to wipe the wrong disk. I am not an expert so double check everything.

If using an external hard drive it will be called something like /dev/sdb
Your main HDD will be something like /dev/sda

In older times IDE devices would have been HD … but now it is apparently consolidated on SD …

One test that may be useful is
sudo fdisk -l
My output was:

————————————————————————-

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005bd91

Device Boot Start End Blocks Id System
/dev/sda1 * 1 120845 970687431 83 Linux
/dev/sda2 120846 121601 6072570 5 Extended
/dev/sda5 120846 121601 6072538+ 82 Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000


Disk /dev/sdb doesn’t contain a valid partition table

————————————————————————-

dmesg
is also useful for final confirmation

OK now to do the deed (remember earlier warnings about checking):

sudo cfdisk /dev/sdb

cfdisk when no existing partitions

Then
n
to create New partition
Then
p
to create new primary partition
Enter
to accept the size
Bootable is OK – no harm leaving it selected or selecting it.
Type should be Linux (83)
W
for Write
then
yes (not y) to proceed (NB warnings about checking earlier).
It should say it wrote partition table to disk.
Q
for Quit.

If we rerun
sudo fdisk -l
we might get something like:

————————————————————————-

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0005bd91

Device Boot Start End Blocks Id System
/dev/sda1 * 1 120845 970687431 83 Linux
/dev/sda2 120846 121601 6072570 5 Extended
/dev/sda5 120846 121601 6072538+ 82 Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 121601 976760001 83 Linux

————————————————————————-

Note that sdb no longer lacks a valid partition table.

Then we need to format the disk (in my case I chose ext3 but ext4 works too):

sudo mkfs.ext3 /dev/sdb1

The system will then write the inode tables. The disk should then be unplugged and replugged to get it to mount.

The new HDD was owned by root so I needed to add some folders and give my user permission to add/edit data etc.
sudo chown username -R /media/disk/
Then open drive and add folders etc

7zip in Ubuntu using WINE

The problem – I needed to combine 6 split 7z files: file.7z.001, file.7z.002, , file.7z.003, file.7z.004, file.7z.005, and file.7z.006. I was unable to do this using p7zip although perhaps someone could explain how. Anyway, I have two solutions:

Solution 1: The command line
As per: http://ubuntuforums.org/showthread.php?t=859596.

e.g.

cat file.7z.001 file.7z.002 file.7z.003 file.7z.004 file.7z.005 file.7z.006>> file.7z

Open the resulting file and extract its contents. NB if any of the parts are missing you will not get a file you can open.

Solution 2: WINE and the Windows version of 7-zip

Install the windows version of 7zip and run it under WINE. Then shift the 6 files into the ~/.wine/drive_c folder, and open 7zip. Navigate to c drive (actually ~/.wine/drive_c folder ;-)) and double click on the first file (file.7z.001). Then extract its contents.

Eclipse in Ubuntu with PyDev and Pydev Extension

Installing eclipse and pydev is done from synaptic and is straight-forward. Installing pydev extensions happens from Help > Software Updates > Find and Install > Search for new features to install. Have a remote site of http://pydev.sourceforge.net/updates/

NB we only want pydev, not the optional pydev mylyn integration (if you get nagged for things about mylyn you forgot to uncheck that part πŸ˜‰ ).

When installing plugins, start eclipse from the terminal as root
sudo eclipse
otherwise you lack the rights to add certain folders etc. See http://ubuntuforums.org/showthread.php?t=568894.

Then set interpreter for python: Window > Preferences > PyDev > Interpreter – Python > New
to /usr/bin/python2.5 etc.

Ubuntu, Samba, and Sharing Folders and Printers

Sharing a Printer

The easiest way of sharing the printer was to hook it up to the router with its own ethernet cable. Then it was a case of System > Administration > Printing and clicking on New. The networked printer was identified correctly as the first item with the IP address and Port No. The driver had already been added http://p-s.co.nz/wordpress/?p=13 and it was a matter of selecting it. This worked on every computer on the LAN.

From within virtualised Windows XP it was trickier. Start > Control Panel > Printers and Faxes then Add a Printer, Next, then, counterintuitively, do NOT select network printer but select Local printer (leave plug and play unticked). Then it was a matter of creating a new port of the Standard TCP/IP type. The IP address of the printer was added (printing printer settings directly from the printer menu included the current IP address). Once created, this is the port to use. The rest is straight forward.

Sharing a Folder

From Server End ****************************
Need to edit /etc/samba/smb.conf
sudo gedit /etc/samba/smb.conf
Key features (NB rather too much trial and error for my liking – it worked for me but would prefer to have any recommendations arise out of a clear understanding πŸ˜‰ ) :

[global]

security = share

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = realworkgroupnamehere

———————————-

Find, and ensure it is commented out:
; map to guest = bad user

———————————-

# Allow users who’ve been granted usershare privileges to create
# public shares, not just authenticated ones
; usershare allow guests = yes
; username map = /etc/samba/smbusers
security = share
; guest ok = no
guest account = root

At the end:

[sharename]
path = /path/path/sharename
public = yes
locking = no
writable = yes
browsable = yes
guest ok = yes
guest only = yes

Can check that everything came through with
testparm
then Enter to see dump:

sudo /etc/init.d/samba reload # reload samba so changes in smb.conf take hold.

From Client End *****************************
Make folder ready to mount on top off: sudo mkdir /media/sharedfoldername
Then configure mounting in such a way that it is automatic on startup:
sudo gedit /etc/fstab # edit contents of fstab (what you want mounted and how)
Then add something like:

//server_IP/sharedfoldername /media/sharedname cifs auto,owner,rw,username=guest,workgroup=workgroupname,uid=user_id_local_machine,gid=user_id_local_machine 0 0

Find user id from System > Administration > Users and Groups then look at Properties > Advanced tab in User ID:
sudo mount -a # mounts everything in /etc/fstab

You should be able to add and edit documents etc.

Useful Commands
sudo mount -a # mounts everything in /etc/fstab
sudo gedit /etc/fstab # edit contents of fstab (what you want mounted and how)
sudo umount /path/more/sharedfolder # unmount (ready to remount if testing changes to fstab)

NB there is another approach to this presented in http://blogs.pcworld.co.nz/pcworld/tux-love/2008/09/hidden_linux_diy_file_server.html but I was unable to get it to work for reasons which elude me. Perhaps it will work for you πŸ™‚ .