Thursday, April 25, 2013

How to Slow Down your Mouse Pointer

Quite frankly, this post shouldn't even exist. Every operating system, except some recent Linux flavors, has always had a mouse speed option so that you can speed up or slow down your mouse. However, the recent KDE's (and from reading a bunch of forum posts, it looks like Gnome may also be affected) do not have this option.

Instead there is an option for "Mouse Acceleration" in the KDE Control Panel. As I understand it, once your mouse moves more than a certain number of pixels (which is also adjustable), the acceleration kicks in and speeds up the mouse. The idea is that normally, your mouse moves at a 1-to-1 ratio, which is usually too slow for large screens, but it is good for clicking on icons, selecting text, and other fine detail work. Once your mouse moves more than the threshold number of pixels, acceleration kicks in and now it moves at a faster 2-to-1  ratio (or whatever you set it to) and you can quickly move from one side of the screen to the other.

But since there is no velocity (or speed or resolution) control, if your mouse doesn't move at the right speed in the 1-to-1 mode, what you have to do is turn the threshold down to 1 pixel (so it's always on) and then adjust the acceleration. The problem is that if you have a high DPI mouse (mine is 5700dpi), KDE will let you set an acceleration down to a 0.1-to-1 ratio, but the setting has no effect whatsoever.

There are quite a few forums posts out there with "solutions" that don't work. One involves modifying xorg.conf, which doesn't even exist on most systems anymore thanks to auto-detection and it requires root permissions. But even so, I couldn't make it work. Another suggestion is to use xset, but again, I made no headway.

The solution is to use xinput. Open up a console and just run xinput with no options:


You'll see a list of all of the input devices on your system, along with their ID's. My mouse showed up with two different ID's, so if this happens to you, here's how to figure out which one to change. Execute the following for each ID:

xinput set-prop ID 'Evdev Axes Swap' 1

where ID is the numeric ID you want to try. Move the mouse after each time you run the command. When pushing the mouse up makes the pointer move left, you've found the right one. Reset the axes swap using:

xinput set-prop ID 'Evdev Axes Swap' 0

Now, you need to set the deceleration. Do this with:

xinput set-prop ID 'Device Accel Constant Deceleration' N.N

where N.N is the slowdown to apply. 1.0 is the minimum (fastest) and you can go as large as you like. For me, 1.5 was just about perfect. Try several values until you find one that you like.

Finally, you need to make sure this command runs every time you log in, so add it to the end of ~/.profile . Note that this will only run after you log in, so if you use a log in screen, the mouse pointer speed will be unaffected there.

Thursday, March 21, 2013

Quick Fix: Bad Codepage

I just tried to plug my digital camera into my computer and when I did, Dolphin gave me a cryptic error message:
mount: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error. In some cases useful info is found in syslog - try dmesg | tail or so
Considering that I've used this camera with the computer plenty of times before, I assumed that this error message meant that the flash card was corrupted. I did an fdisk, but it didn't find anything wrong. Doing a "dmesg | tail", as the message suggested, gave me:
FAT-fs (sdb1): codepage cp437 not found
Codepages are part of the kernel, so this was actually the hint I needed. The problem was that the kernel had been updated, but the system hadn't been rebooted. After a quick reboot, the problem went away.

The lesson is that even in Linux, sometimes a good, clean restart is all that's needed to fix a problem.

Monday, March 18, 2013

Making a Narrated LibreOffice Impress (PowerPoint) Video using Linux

In my work, PowerPoint presentations are used a lot and recently, the trend recently has been to re-distribute these presentations as videos with audio narration so that others may watch it later. Some of the videos are of particularly poor quality with the audio and video coming from a camcorder pointed at the screen during the live presentation. I'm going to show you how to make a quality video using only LibreOffice Impress, FFmpeg, and KSnapshot.

These videos are handy for work, for creating video reviews for Newegg, and for creating how-to videos for YouTube. Especially since LibreOffice presentations can contain images, animations, and videos, you can really create some amazingly useful videos with this technique.

From a hardware side, you will need a decent microphone, of course. And if you have a multi-monitor setup it will make things easier during the recording of the video, but it's in no way necessary. The broad steps are:
  • Create the presentation.
  • Record it.
  • Clean it up and publish it.
So lets get started.

1. Get the tools.

Most openSUSE distributions will likely already include the tools you'll need. But as a double-check, execute from the commandline:
sudo zypper in libreoffice-impress ffmpeg ksnapshot kmix
KSnapshot and KMix only apply if you're using KDE. If you're using another desktop environment, then just make sure you have an audio mixer (or volume control) and a tool that can take screenshots.

2. Create the slides.
I won't go into any great detail about creating the slides other than to say that you should try and consider all of your users' needs. Some people might be watching on a cellphone, so keep the fonts and images big and legible. Some people might be hard-of-hearing, so make sure that the slides are at least somewhat self-descriptive. And some people might be color blind or have low vision, so use a high contrast color scheme. By taking your users' needs into account, you'll make your video more accessible and by extension, more useful.

3. Create the narration.

In Impress, there is a Notes tab above your slide. Here you can enter in a script to read during each slide. If you have a multi-monitor setup, then you can have the presentation on one screen for recording and your notes on the other. If you don't, then you can print out the notes (under Print, change Print Slides to Print Notes). Having a script will reduce the number of "ums" and "uhs", keep you on track, increase the professionalism of the video, and ultimately reduce the length, since you're not trying to remember what to say next.

4. Recording the video.
It's time to record the actual video. First, make sure that your hardware is ready. From an audio standpoint, you'll need to test out your microphone. The easiest way to do this is to use an existing audio program on your computer. I use Audacity for this and Skype works too. You can also find Flash websites online that will let you test your mic.

If your mic is part of a headset, then the boom should be to the side of your mouth. Putting it in front will make your breathing audible.

In KMix, adjust the microphone volume under Capture Devices. It should be approximately halfway. A program like Audacity is great for audio testing because it lets you see the waveform and you can see if your audio is clipping (because it is too loud).

Once you have your audio setup, get the room ready. You want to minimize all noise. Most microphones are very sensitive to external noises such as a TV on in the next room, your air conditioning, the neighbor's dog, etc. Sometimes you just can't record when you want to and you have to wait until everything else is quiet.

Recording the video with FFmpeg is really simple:
ffmpeg -f alsa -ac 1 -i default -f x11grab -r 20 -i :0.0 -sameq Original.mpg
Once you're done recording, press q to stop.

The -f switch says to record audio from Alsa. -ac sets the audio to one channel (mono). -i says to use the default audio source.

The second -f switch says to record video from x11 (i.e., your desktop). -r sets the frame rate; you don't need full motion video for a presentation, so slightly lower is okay. If you want, you can set this to 30, but the file size will be larger. -i sets the x11 desktop to record. -sameq sets the quantizer. If you have a multi-monitor setup like me, then you'll need a more complicated ffmpeg commandline. My monitor setup looks like this:

If I want to record from the second monitor, then I want to record a 1280x1024 window that has its origin at (1920,56). The FFmpeg command to do this is:
ffmpeg -f alsa -ac 1 -i default -f x11grab -s 1280x1024 -r 20 -i :0.0+1920,56 -sameq Original.mpg
Once you start recording, start the slide show (F5) and go through the slides. Once you are done, press q in the FFmpeg terminal to end the recording. Don't worry if you recorded a few seconds of getting ready at the beginning; getting rid of the garbage at the ends of the of video is the next step.

5. Trimming the video.

When you went to record the video, you captured a few seconds of junk at the beginning and at the end (you know, where you were making the presentation fullscreen and getting ready to speak). Now, we're going to trim that off so that we're left with the pure video.

There are a lot of nice, high-quality video editing applications for Linux, but since all we want to do is trim a few seconds of video, we're going to do it with FFmpeg.

First, you'll need to figure out how many seconds of video you want to trim at the beginning and how long the entire video should be. For example, if the original video is exactly six minutes long and there is 10 seconds of junk at the beginning and 15 seconds at the end, then the final video should be 5:35 in length.

You'll do this with FFmpeg with the following command:
ffmpeg -i Original.mpg -acodec copy -vcodec copy -ss 00:00:10 -t 00:05:35 Trimmed.mpg
This command is actually pretty fast and it should be complete in under a minute.

6. Publishing the video.

If you're publishing a video review on Newegg, they require that the final video be under 100MB. You can ensure the file is small enough with FFmpeg:
ffmpeg -i Trimmed.mpg -fs 100M 100MBVersion.mpg
The -fs switch specifies the maximum size of the final video and it provides a coarse way of controlling the quality as well. If you final video was going to be smaller than 100MB anyway, then this switch has no effect.

Publishing to YouTube is really straightforward and I won't go over it in detail here. Once you have the video up, you can then get an code from the video page for embedding it in your own webpage.

The only detail that you really need to pay attention to is the thumbnail. The thumbnail is what is shown in the embedded YouTube windows before the user clicks play and it is also what is shown in the search results on YouTube grabs some random frames of your video and offers them up as possible thumbnails, however the frames will be from the middle of your video and in most cases, one of the first slides will be the one you want for the thumbnail. Grab a screenshot using KSnapshot (press the "print screen" button on your keyboard to fire it up). The "select rectangular region" option of KSnapshot is a useful way to snip out a section of a slide. Once you have the thumbnail you want, you can upload it to YouTube for use with your video.

Direct Distribution

If you're going to share the video file with others, you might want to cut down the resolution first. This will give you a much smaller file size. If the original video was 1600x1200, you can cut it to a quarter (800x600) using:
ffmpeg -i Trimmed.mpg -s 800x600 QuarterSized.mpg
I have found that the resulting video's file size is usually less than a quarter of the original - about 20% is typical.

Then, you need to publish it. The file sharing service is up to you. I like Dropbox for work, but for this example, I've posted my results to Mega (see the next section).

7. The final results

So here's an example video I made. The quarter sized version is available for download here:
Download Video (1.1MB) 
And here's the embedded YouTube version:

Friday, March 15, 2013

openSUSE 12.3 - Desktop Fixes

This is the first in a series of posts that I plan to do on various fixes that I usually apply to a vanilla openSUSE install.

Today, I'm going to focus on improvements to the default desktop experience. I'm using the KDE desktop on a fresh install. A lot of what I do is personal preference, so you probably won't want to do everything I do, but I try to explain why I'm making each change.

The initial desktop looks like this (click on any picture to view it fullsize):

openSUSE 12.3 - Default KDE Desktop

Some of the things I don't like are:

  • It's too dark with the black background. It looks okay on my desktop, but on my fairly dim laptop screen, it's just too dark.
  • I don't like having a bunch of icons on my desktop. Launchers belong in the task panel or the system menu.
  • Why is the "openSUSE" and "KInfoCenter" icons doing on the desktop? Most people won't be using them regularly, so why have them?
  • The Desktop "tag" in the top-right corner just bugs me.
  • The task panel is too cluttered with a bunch of icons.

1. Remove the floating frame.

openSUSE 12.3 - Removing the floating frame

To get rid of the floating frame, move your mouse over by the right edge and a toolbar will appear. Click the 'x' at the bottom, which I've highlighted in the picture. If the toolbar doesn't appear, then your widgets are locked. Anywhere in the task panel at the bottom, right-click and choose "Unlock widgets".

2. Change the desktop and background.

I want the desktop to display the contents of the Desktop folder and I want a lighter background. Right-click on the desktop and choose the bottom option (most likely "Default Desktop Settings"). Under View, change Layout to "Folder View" and click apply. Under Location (it's a new option on the left), make sure that "Show the Desktop folder" is selected.

For the background, go back to View and select a pleasant background. I chose "Air". Click OK.

openSUSE 12.3 - Desktop with Folder View and a lighter background

3. Remove the desktop icons.

Just select and delete all of the desktop icons.

4. Remove unnecessary task panel icons.

Take a look at all of the icons in the task panel:

openSUSE 12.3 - Icons to remove

The first arrow points to the Activities Manager. While this is a cool KDE feature, I never ever use it, so it has to go. Right-click and choose "Remove this Activities".

The second arrow points to the launchers for Dolphin (file manager) and Firefox. These launchers act similarly to "pinning" in Windows 7, where the running program replaces the icon. I've never liked this behavior. I'm going to remove these launchers and then replace them later with quick launch icons, which are just buttons to launch the program. It also happens to be that quick launch icons are larger, which I also like. Right-click on each launcher and select "Remove This Launcher".

Next up are the icons in the system tray. The first one, which looks like scissors, is Klipper. Klipper is a cool program that offers some advanced copy/paste functionality, but like Activities, I never use it, so its going away. Right-click on it, choose "Quit" and then choose "Do not start".

I don't use Bluetooth with my laptop, so I'm going to remove this icon too. You can restore it later from the KDE control panel. Right-click and choose "Configure Bluetooth". Then un-check "Enable KDE Bluetooth Integration". Click "OK".

Finally, let's get rid of Nepomuk. It provides a search index, but again, I never use it, so it's going away. The icon for it isn't visible by default, so click on the up-arrow in the system tray and right-click on "Desktop Search File Indexing" and choose "Configure File Indexing". Un-check "Enable Nepomuk Semantic Desktop" and click "OK". Then go back to the icon, right-click, and choose "Quit" (and then confirm by clicking "Quit" in the new window).

Finally, I want to get rid of that Desktop "tag" in the top-right corner of the screen. Click and drag it to the top-left corner of the screen and it will become much smaller and it's far less likely to be accidentally clicked on if it's over there. I would love to remove it, but I haven't found a way yet.

Your desktop now looks like this:

openSUSE 12.3 - Desktop without unnecessary icons

5. Add in quick launch icons.

Open the system menu and drag down icons for the programs you're going to use the most. I selected Dolphin (file manager), Firefox, and the LibreOffice launcher. In order to get them to drop into the task panel, I had to position the mouse on the left between the green gecko system menu icon and the desktop chooser icon. I think this may be a bug, since you should be able to drop the icons anywhere. Also, I chose the LibreOffice launcher (called just "LibreOffice" in the system menu) instead of the any of the specific LibreOffice program (Writer, Draw, Calc, etc) since the launcher can launch them all.

I also like to add one widget to my desktop - the System Load Viewer. Nothing is more annoying than an unresponsive system and the load viewer allows you to see CPU and memory usage at a glance. If you click to start a program and nothing appears to be happening, the load viewer might show you that the CPU is at 100% indicating that it is indeed loading. Click the golden icon at the right end of the task panel and then click "Add Widgets" in the panel that appears. Search for "System Load Viewer" and double-click it when you see it. Once it's added to your task panel, you'll see it and there will be a green checkmark in the widget panel. Click the golden icon twice to close the widget and configuration panels.

openSUSE 12.3 - Desktop with quick launch icons and the system load viewer

One other tweak: I don't like the icon for LibreOffice. It's too plain, so I'm going to replace it with the one for LibreOffice Writer. Right-click on the icon and choose "Icon Settings". In the window that appears, click on the icon, then search for "Libre" and choose the Writer icon.

openSUSE 12.3 - Desktop with the LibreOffice Writer icon

6.  Rearrange the icons to your liking.

Finally, it's time to place everything where you want it. Click the golden icon at the right end of the task panel to open the configuration panel. With that new panel open, you can drag and drop the icons in the task panel.

I like to have the icons in the following order:

  • System menu (green gecko button)
  • Quick launchers
    • Dolphin
    • LibreOffice
    • Firefox
  • Desktop chooser
  • Task manager
  • System Load Viewer
  • System Tray
  • Clock
 Once you have everything where you want it, right-click on the golden icon and choose "Lock Widgets". This will prevent further (and accidental) changes. If you ever need to make a change, right-click anywhere in the task panel and choose "Unlock Widgets".

7. System menu tweak

One thing that openSUSE has gotten wrong for the last few versions is that the System Menu is just a hair too short and it, by default, requires scrolling on the Favorites tab. One option is to remove an icon from Favorites, but I just like to increase the height a bit. Up in the top-right corner of the menu is place to grab and adjust the size.

There you go, a clean and functional KDE desktop:

openSUSE 12.3 - Desktop with all of the changes

Thursday, March 14, 2013

openSUSE 12.3 is here!

openSUSE 12.3 was released on March 14th and it is awesome. So far, I've installed it on six of my machines and with the exception of one reboot that failed, I have had no problems.

You can grab the ISOs here:

I suggest you grab the torrent and download that way. As of right now, there are nearly a thousand seeds for the 64-bit version and a bit over 500 for the 32-bit version, ensuring that your download will be very fast.

The release announcement goes over all of the changes, but some of the ones that I'm excited about are:
  • Version 3.7 of the Kernel
  • PulseAudio 3 (with better Bluetooth audio support)
  • UEFI support (I haven't tested this yet)
  • KDE 4.10, which is getting to be a very nice desktop environment
  • MariaDB (instead of Oracle's MySQL)
They have also released the following introduction to KDE video, which explains a lot of the features and tricks to using KDE effectively. I've been using KDE for around 12 years and even I learned a couple of things that I didn't know already.

Monday, February 18, 2013

Update: Logitech F710 Gamepad

In my previous posts, I reviewed the Logitech F710 gamepad and I commented on the lousy support I received from Logitech. While I recommended the gamepad before, I can no longer do so. Originally, when I tested the gamepad, I did so with the gamepad only a couple of feet from the computer. However, I'm using this gamepad to play games on my HTPC which means that the signal has to travel about 8 feet from the front of the computer to my couch. I've had tons of intermittent signal drops. When this happens, the controller is unresponsive and then the mode light blinks when the gamepad gets signal again. 8 feet and line-of-sight should be no problem, but it is.

I've tried all of the normal things, like checking the batteries and trying it on other computers, but the fact is that the wireless range on this controller is pathetic.

Considering that I found two-and-a-half year old forum posts on Logitech's website describing the same problem, this seems to be a design flaw that Logitech doesn't seem interested in fixing. Normally, I'd contact support, but as you saw in my previous post, you can't expect much help there either.

The point is that if you want a good gaming controller, I would suggest you steer clear of Logitech's offerings and see what Microsoft or Razer have available.

Saturday, February 16, 2013

The Logitech F710 Gamepad

UPDATE (2/18): See my new post on the wireless range.

This is part one of a two part post. This part focuses on the gamepad itself, while part 2 is a look at the absolutely terrible customer service I received from Logitech.

Once upon a time, I bought a Logitech Cordless Rumblepad 2.
It was great. I liked the button layout, the feel in my hands, the weight, everything. It used DirectInput at the driver level and it worked well in both Windows and Linux.
And then Microsoft started pushing a new input method, XInput, which was incompatible with DirectInput and they started selling the XBox 360 Controller for Windows. Many newer games only support XInput. Logitech could have extended support for XInput games to the Rumblepad 2 through a driver update, but they decided to release a new series of gamepads instead. The flagship of this new series is the F710.
Look familiar? It should. It's the Rumblepad 2 all over again. The only real difference is that there is now a physical switch on the back that changes it from DirectInput to XInput mode. So, I bought one and it, as the Rumblepad before, worked perfectly in Linux.

Windows was another story.

I'm running Windows 7 Ultimate 64-bit with Service Pack 1 installed. That is the absolute "best" version of Windows you can have right now for gaming. Everything should be compatible with it. And I use this computer for gaming and gaming only, so the firewall is shut off and there is no anti-virus software. In other words, I've done everything I can to make sure that this computer is as compatible with everything as it can be.

So I plug in my F710, install the drivers off of the included CD and I find that when the switch on the controller is set to XInput, Windows can't find the driver to make it work. So, I check the manual and it says that when set to XInput, the drivers will be installed automatically.

Just to verify, I tried playing Batman: Arkham Asylum, which according to Logitech's own compatibility page, should work in XInput mode. Nope, nothing. I finally managed to make it work by force installing the XBox 360 controller driver. To do so, tell Windows you want to install a driver from off your hard drive, then ask it for a list of all drivers, select all drivers, select Microsoft as the manufacturer and then "XBox 360 Controller" is one of the last entries in the hardware list.

In the middle of the process of figuring this out, I emailed Logitech's customer service to see if they could help. That exchange is the focus of my next post.

In the end, I'm glad I got this controller and it is awesome. But it shouldn't have been so much work to make it work.

UPDATE (2/18): See my new post on the wireless range

Logitech Support

In my last post, I detailed the trouble it was to get my new Logitech F710 gamepad to work as advertised. When I first encountered trouble, I fired off an email (via Logitech's web form) to their support department. In the interim between my email and their first reply, I managed to fix the problem, but I decided to go ahead and continue to play the role of confused customer to see how quickly Logitech would resolve the problem.

Recall, the issue is that in order to get the Logitech F710 to work, you must force the installation of the XBox 360 controller driver. Logitech does not supply the correct driver with their device and they do not provide instructions on how to use the Microsoft one.

My first email:

From: Lord Byron II
Sent: 1/10/2013 7:04PM
Message: Whenever I switch the gamepad from DirectInput to XInput, it loses connection with the PC and I must use the F710 re-connection program to re-establish the connection. Further, the Logitech game profiler software can't find the Gamepad when it is in XInput mode and Windows shows the driver to not be installed when it is in XInput mode.

The condensed nature of my message is due to the restrictions of sending a message through their web form. Had they supplied a real email address, I would have sent a longer, more detailed message, but this does get the point across. I received an almost instantaneously reply from their automated system with a couple of unhelpful links and a promise of a reply within 48 hours. I ended up getting a reply from a human 6.5 days later:

From: Logitech Support
Received: 1/17/2013 11:45AM
Message: Thank you for contacting the Logitech Customer Care Team. My name is Jay-R, and I am glad to assist you. Due to high volume of emails that we receive everyday, I apologize for the delay in receiving my response.

Your support reference number is: 130111-003764. Your reference number is a way for us to track your support request.

Please indicate or mention your support reference number for quick and future reference of this particular case.

From your e-mail, I understand that whenever you switch your Logitech Wireless Gamepad F710 to Xinput, it loses connection to your computer and your Logitech Profiler cannot find it.
I do apologize for the inconvenience that you've had with the product. I will certainly do my best to resolve your concern.

About your inquiry, I would like to inform you that the Xinput refers only to Xbox 360. If you are going to use it on your computer, you should always use the Dinput. You can also use the Xinput on your computer if your computer has an Xbox driver.

If you have any additional questions, please feel free to visit our website at, or reply to this e-mail.

If you need assistance with logging into your account, please click on this link: http://logitech-en-

Thank you for choosing Logitech.

He incorrectly states that the XInput switch is for use with the XBox 360. However, the gamepad is not an XBox 360 gamepad. He also states that I can use XInput if I have "an Xbox driver". But he gives no instructions and no download link. I replied back with links to Logitech's website stating that the controller does work with Windows in XInput mode and that I need a link to the driver. After only nine hours, I get a reply:

From: Logitech Support
Received: 1/21/2013 3:30AM
Message: Thank you for contacting Logitech Customer Care again and I do apologize for the confusion.

XInput is the preinstalled, modern gamepad standard on Windows 7 and Vista. It can also be installed on Windows XP (SP1 or greater).
Use XInput to play games in Windows whenever possible. This input mode is intended to make the gamepad work natively with modern games.
If you're playing a new game with the F310 gamepad, we suggest you set the Input Mode switch to "X". If you want to customize the input functionality, try using DirectInput mode instead.

Thank you for choosing Logitech!

Now, he correctly states that I should be using the XInput mode, but still doesn't give me a driver link or instructions. He also talks about Windows Vista and XP, despite my having told him twice before that I am using Windows 7. I reply with my system specs again and ask him for the required driver. This time, I get a reply back in a little over 4 days:

From: Logitech Support
Received: 1/27/2013 10:42AM
Message: Thank you for contacting Logitech Customer Care again and we appreciate your reply.

You may need to contact your computer manufacturer and they should provide you the native driver prior to make the gamepad work.

Thank you for choosing Logitech!
They want me to contact my computer manufacturer for support with their gamepad! Imagine what would happen if you called Dell/HP/Lenovo and asked for a driver for a gamepad they don't sell or support. They would send you right back to Logitech. In my case, I had built my computer myself and I sent that information back to Logitech.

At this point, I should add that Logitech closes the support ticket if they don't receive a reply from you within a week.

The next email I received from Logitech came 8 days after my last reply:

From: Logitech Support
Received: 2/5/2013 4:59PM
Message: How's everything going?

I just wanted to update you regarding this incident, because you will be receiving an automated email stating that this will be closed.
If I may ask, is there anything else I can help you with? If your issue has not been resolved, please do not hesitate to update me.
Please respond first before completing the survey so that I can offer further assistance to resolve this matter.
I'm looking forward to your update. Have a wonderful day!

If you have any additional questions, please feel free to visit our website at or reply to this e-mail.
For reference purposes this is your support reference number: 130111-003764.
Thank you for choosing Logitech.

First, this email does not address anything I had written in my previous email and it still does not address the problem I was having. Second, because it took them over a week to respond, a few hours after receiving this email, I received a second automated one stating that the support ticket was now closed.

In the period of a month, Logitech completely failed to address the problem I was having, offered no usable advice, and eventually closed the ticket because of their own inability to respond in a timely matter. This is no way to run support and I will definitely take this experience into account the next time I'm looking at purchasing a Logitech product.

Saturday, February 2, 2013

Recording a (data) Blu-ray from the command line

In this post, I'll show you how to build an iso image, burn it to a Blu-ray disc, and verify that the burn was successful. These steps are for creating a data Blu-ray. Authoring a movie is a whole different subject, however if you already have the movie files created, then you can use these steps for the burn.

Nothing here is specific to Blu-ray, so these steps will work equally well with a CD or DVD, but I encountered a bug in K3B that prevents a successful burn using Blu-ray discs.

But first, let me warn you about the bug that I encountered in K3B, the GUI burner that comes with OpenSUSE. In 12.2 (and at least back to 11.3), K3B will not complete a burn.  The (closed) bug report is here: Basically, with around 100MB of data left to burn, K3B will report an "input/output error" and stop. Some suggestions for working around this problem include using BD-RE (rewritable) discs instead of BD-R discs, which I didn't try. Also suggested was using the original branch of the cdrtools and using the "create image" options, neither of which worked for me. I did get the burn to work via the command line, which is why there is this post.

Back to the burning. To create a burnable image:

1. I did use the original branch of the cdrtools. I don't know if this is necessary or not, but I was convinced from what I read about this branch versus the one that ships with OpenSUSE that it was better just to use this one. First, you'll need to download the source from I used version 3.01a11. Untar it, and then do a:

make && sudo make install

You'll need to have make and gcc installed, of course. The binaries are installed in /opt/schily/bin.

2. Create the image. Say you have the files you want to burn in /home/user/disc/. Then, from /home/user, you would:

/opt/schily/bin/mkisofs -J -r -iso-level 3 -allow-multidot -allow-leading-dots -joliet-long -o IMAGE.iso disc/
 The "-J" and "-r" flags just specify how the file names are stored (specifically using Joliet and Rock Ridge) so that your file names are not mangled. "-iso-level 3" enables support for files over 4GB in size. "-allow-multidot" and "-allow-leading-dots" allow files with multiple dots and leading dots in the filename, such as ".myfile.txt". "-joliet-long" provides Joliet support for longer filenames.

You will need, of course, enough free space on your drive to store an entire copy of the files you wish to burn. It is possible to pipe the output of mkisofs into the burner in the next step, but I prefer to do it in two stages, because you'll need the image in order to perform a MD5sum in order to verify that the burn was successful.

I also found that each time you create the image, the md5sum is different. I'm not sure why this is, but my guess is that the metadata (most likely something time related) changes. So definitely keep the image until you have either written down or verified the MD5sum.

3. Burn the image. Stick a blank disc in the drive and then:

/opt/schily/bin/cdrecord dev=/dev/sr0 -v -pad -data IMAGE.iso

4. Verify the data burned. First of all, this won't work:

md5sum IMAGE.iso
dd if=/dev/sr0 | md5sum
The problem is that when you use dd to read the disc, it will invariably read some blank bytes past the end of your data resulting in a completely different MD5sum.
The easiest way to verify the data is like this:

dd if=/dev/sr0 | cmp IMAGE.iso

If this ends with:

cmp: EOF on IMAGE.iso

then it was successful. The EOF means that the end of the image file was reached without finding a difference between the two. Everything else on the disc is just padding.

The only problem here is that you will presumably delete the image at this point and if later, you want to verify that the disc is still intact (say, you want to verify that a backup disc is still in good shape six months from now), you need a way to calculate the MD5sum from the disc. You could do so with:

md5sum IMAGE.iso
dd if=/dev/sr0 bs=1 count=IMAGE_SIZE | md5sum

where image_size is just the number of bytes of the image ("ls -al IMAGE.iso" will work). However, this will take a very long time (several hours) to complete since it's reading the bytes off of the disc one at a time. You can speed this up significantly by reading the bytes off in powers of 2. As long as the size of your image file is divisible by two, you're set; I believe that all images will always be divisible by 2048 bytes. In my case, my image had a size of 16,378,150,912 bytes, which when divided by 2^14=16384 is 999,643. That left me with a verify command like this:

md5sum IMAGE.iso
dd if=/dev/sr0 bs=16384 count=999643 | md5sum

It takes a little bit of math, but it will finish in 10-20 minutes and not hours later.

Once you have the MD5sum, I suggest writing it on the disc label for later use. In my case, I only write the last four digits (out of laziness), but the chances of a disc with an error generating the same last four digits in an MD5sum is 1 in 16^4=65,536. That's good enough for me.