I just tested out Medieval CUE Splitter version 1.0. It was broken, and it creates output files where the first few frames may be unplayable.
An MP3 file consists of series of frames and each frame always stores 1152 audio samples. If one wants to losslessly cut an MP3 file, they can do it at a frame boundary. However, the data for a frame may actually be in previous frames. (In the side information, right after the 4 byte frame header, there is a 9 bit value which tells how far back. This is used to implement the bit reservoir. For more information see this PDF on the MP3 format.) So if a cut happens right before a frame whose data is in a previous frame, that frame's data will be unavailable. At best, some data will be skipped. At worst, a poorly designed decoder will crash. In order to avoid this, an MP3 cutting utility must restructure the file after the cut.
Edit 1: I found that MP3Cutter 4 is broken in the same way. I'm also left wondering if it creates a VBR header when saving a VBR MP3.
Edit 2: mp3DirectCut 2.07 also simply cuts the file like that. At least it puts a VBR header on the output file if it's VBR.
Using mp3packer with the -b 320 -r switches one can transform an MP3 file into a 320 kbit file where all the frames are self-contained. I'm not certain if this works on all files, but it should work on all non-corrupt MP3 files. MP3 frames should always fit in 320 kbit frames. After this one can cut with any stupid MP3 cutting utility and get a valid MP3 file. However, when the files are decoded, 529x4 bytes go missing at the start of all files other than the first, apparently because most decoders have a 529 sample delay.
Edit 3: Another utility I've tried is pcutmp3. The name is short for properly cut MP3, and what it does is more proper, but even with self-contained frames the encoder delay can be around 2000, and some players such as the iPod ignore encoder delays that big. My goal is to have a smaller and more compatible encoder delay.
Edit 4: mp3splt 2.1 also cuts MP3 files in the same broken way.
Edit 5: If frames are made independent using mp3packer, and a LAME header with encoder delay set to 623 followed by the last frame of the previous file is prepended to all files other than the first, then the cut is lossless with mpg123 and Winamp.
I also see that the stupid cutting programs strip off the LAME part of the header, leading to 576 (LAME encoder delay) extra samples of silence at the start of the first file. That should be easy to fix by putting a LAME header there.
Note that the splitting process I propose should be entirely reversible. You might not end up with the MP3 file you started with, but you'd end up with the same MP3 data within it and it would lead to the same output. Lossless transformations should be reversible like that.
Saturday, April 12, 2008
Friday, April 04, 2008
Another reason why the Windows console is worthless
If I view a batch file in a windowed text editor, I see é (lower case e with acute accent), but if I view view it from the command prompt I see Ú (upper case u with acute accent). If I run the batch file, the character is also interpreted as Ú, which means the command fails because it is given the wrong filename.
It seems this is happening because the console uses code page 850 while graphical applications use ISO-8859-1, and they're quite different. NTFS filenames are Unicode UTF-16 and they are translated to code page 850 for the console and ISO-8859-1 for the GUI. Sometimes, such as when pasting from the GUI to a console window, the translation works. In other situations, such as copying from the console window and pasting into the GUI, it fails. What a horrible kludge!
Fortunately, Cygwin doesn't have this problem.
It seems this is happening because the console uses code page 850 while graphical applications use ISO-8859-1, and they're quite different. NTFS filenames are Unicode UTF-16 and they are translated to code page 850 for the console and ISO-8859-1 for the GUI. Sometimes, such as when pasting from the GUI to a console window, the translation works. In other situations, such as copying from the console window and pasting into the GUI, it fails. What a horrible kludge!
Fortunately, Cygwin doesn't have this problem.
UnxUtils are broken; Cygwin is great
Years ago when I wanted some Unix utilities in Windows I got them from UnxUtils. Since then I've deleted them one by one because of various bugs. For example, I just found that find(1) doesn't find the files in one directory from one starting point but finds them from one directory deeper. The find from Cygwin works fine, though one has to get used to using Unix-style paths in Windows with it.
UnxUtils actually has a newer version on the project downloads page which isn't mentioned on the home page. I could try that but Cygwin is more widely used, tested and kept up to date. There's also MSYS from MingW, but Cygwin is easier to install and update and it can also compile MingW binaries which don't depend on Cygwin.
If you want Unix tools in Windows I highly recommend Cygwin.
UnxUtils actually has a newer version on the project downloads page which isn't mentioned on the home page. I could try that but Cygwin is more widely used, tested and kept up to date. There's also MSYS from MingW, but Cygwin is easier to install and update and it can also compile MingW binaries which don't depend on Cygwin.
If you want Unix tools in Windows I highly recommend Cygwin.
Wednesday, March 19, 2008
Vista JPEG rotation may not be lossless
I just rotated a JPEG and the new file was almost twice as large as the original. I thought that the rotation was probably not lossless and was instead a re-encode, and I was right. According to a forum thread I found, rotation is lossless when possible, but if lossless rotation isn't possible you get lossy rotation without warning. Like many of the people in that thread, I find this to be unacceptable. I recommend Jpegcrop for lossless JPEG manipulation.
Windows XP warns if rotation isn't lossless, and I think this is another example of how XP is sometimes better. In the forum thread someone from Microsoft said that they removed the warning for usability reasons. I think the right thing to do would be to have a "don't show this again" checkbox and a preference checkbox somewhere to enable the warning.
Windows XP warns if rotation isn't lossless, and I think this is another example of how XP is sometimes better. In the forum thread someone from Microsoft said that they removed the warning for usability reasons. I think the right thing to do would be to have a "don't show this again" checkbox and a preference checkbox somewhere to enable the warning.
Monday, March 17, 2008
Accounts on various sites
Not long ago I deleted a few accounts I wasn't using:
- Friendster, because I wasn't using it and it didn't seem like anyone else I know was using it either. I hadn't even done much work on that account.
- Multiply, for pretty much the same reasons. I had actually done some work there uploading content and I had more contacts, but I wasn't using it and I was actually sharing better and more up to date content elsewhere. I always liked Multiply for some reason but that didn't seem like good reason to keep an account I don't use.
- Photobucket, because I wasn't using it, and I thought the interface was ugly (for example lacking album thumbnails). I find it kind of funny that aesthetically it's a bit like dumping photos in a bucket. I did have a lot of photos uploaded there, but I prefer to share a few of my best photos instead of all the photos I take, and I want to share them on a site I actually like.
- 43 Things because I didn't find it useful for tracking and for tracking and accomplishing goals, I wasn't using it, and it came with accounts on other sites which I didn't want.
- I'm also trying to delete my Web1000 free web hosting account because I don't need it and it doesn't work, but support doesn't respond. If I remember correctly, I liked Web1000's free hosting, but because of how I haven't gotten responses now I wouldn't recommend it.
- Panoramio is my favourite site for sharing photos of scenery. I enjoy the process of mapping photos and I like how the photos are presented on a map. I certainly don't miss folders/albums. I use Panoramio for sharing my best photos which I feel fit their Google Earth acceptance criteria.
- Reddit, because it is the best way to find new and interesting things online. When I started using it I noticed that generally when friends sent me a link I had already seen it on Reddit. Reddit is also unfortunately a great way to waste time. I've recently customized my account so I only subscribe to certain reddits which are of special interest to me.
- Blogger, obviously. This is a post on my blog made using Blogger.
- Facebook, where I recently created an account. I'm not sure how useful I find that site. At least more people I know are on there (compared to Friendster and Multiply). However, there doesn't seem to be much to do on there, or maybe there isn't much to do other than doing stuff with silly viral applications.
- I'm not sure why I use last.fm but I keep using it. I haven't really gotten much out of it, but I also think I haven't really explored it, and it seems like it should theoretically have potential in terms of finding new music and meeting new people.
- Digg, which I really liked in the past but which has now been superseded by Reddit. I'm still active there from time to time but I don't know why.
Are spambots adding me as a friend on Digg?
Nowadays whenever I'm active on Digg I usually get notified that I have a new fan. Generally the fan has recently added many friends and they have very many friends. Three recent examples are Damian86, Madrid Design and muzicman. The sheer number of friends and the speed with which I get added after I do something on Digg make me think that bots are at work, perhaps using real-time data from Digg Labs.
I want to be cautious about accusing users of being bots but the same sort of thing keeps happening and I'm becoming more and more convinced that I am dealing with bots. Earlier I contacted abuse at digg dot com and I just disabled e-mail notifications for these events. I hope something will be done about this issue.
I want to be cautious about accusing users of being bots but the same sort of thing keeps happening and I'm becoming more and more convinced that I am dealing with bots. Earlier I contacted abuse at digg dot com and I just disabled e-mail notifications for these events. I hope something will be done about this issue.
Sunday, March 09, 2008
Defect in Sony DVD+RW Ver. 1.2/1X-4X
I was wondering why I kept getting read errors when verifying writes to a particular DVD+RW. Now I know why. There is a sort of black dashed arc, concentric with the DVD. It is below the surface and it is not a scratch. Here is a photo:

The defective area is in the middle. Near it you can also see two pieces of dust. Note how dust leads to double images because you see both the dust and its reflection on the recording surface. The defective area doesn't have double images because the dark bits are at the recording surface itself. The black circle at the bottom is a shadow from the camera lens. At the bottom right you can see the centre of the DVD. Note how the curvature is parallel to the curvature of the defective area. The entire image also shows a reflection of the lamp that provided illumination.
Edit: I guess the Sony lifetime limited warranty is pretty much worthless in a case like this. The only contact number isn't toll free and the warranty instructions say I should mail in the disc. Buying a replacement is probably cheaper and easier.
The defective area is in the middle. Near it you can also see two pieces of dust. Note how dust leads to double images because you see both the dust and its reflection on the recording surface. The defective area doesn't have double images because the dark bits are at the recording surface itself. The black circle at the bottom is a shadow from the camera lens. At the bottom right you can see the centre of the DVD. Note how the curvature is parallel to the curvature of the defective area. The entire image also shows a reflection of the lamp that provided illumination.
Edit: I guess the Sony lifetime limited warranty is pretty much worthless in a case like this. The only contact number isn't toll free and the warranty instructions say I should mail in the disc. Buying a replacement is probably cheaper and easier.
Thursday, February 28, 2008
Repairing Archos V2 Jukebox Recorder headphone jack
In the past I wrote an article about bad design and unreliability of Archos devices. I thought I should document one of my successful repairs for the benefit of others faced with the same problem. This problem exists on the Archos V2 Jukebox Recorder (with blue plastic bumpers in the corners and an internal lithium-ion battery) and almost certainly also on the Archos FM Recorder. It manifests itself as occasional disconnection (silence) of left and/or right headphone outputs. The problem is due to a small circuit board breaking off the pins of the headphone jack.
You first need to open up the device. The Multimedia Jukebox has the same case and there is a good guide on how to disassemble it. Basically, there are two screws on the top (small side above the screen), two on the bottom, and metal clips sticking out from the metal part of the case holding the plastic part. You can also slide out the hard drive and battery, but some bending of the top end of the metal part of the case is probably necessary for that. The result should be:
Now you can see the little circuit board that's soldered to the headphone jack pins. Breaks in the solder are probably not wide open; the sides of the crack are probably touching. I found I could easily move the small board away, leading to this picture:

Now, one could just solder the small board back and close up the device. I chose to go further, desoldering the metal part of the case from the circuit board so that I could access the other side of the main circuit board. Some of these solder connections were already broken, often ripping off some of the copper. I then removed he headphone jack, inspected it to make sure it was okay, and glued it back with epoxy so that it wouldn't move and stress the connections. I'm not sure if glue is the best idea in case the jack breaks. I put a short length of electronic component lead (thin solderable wire) in the holes alongside the headphone jack pins to reinforce the solder, and I soldered the small board to the headphone jack. Here is a photo of the underside of the board with the headphone jack removed:

While that side is exposed, it would probably be a good idea to inspect the charger jack and battery contacts, and clean the battery contacts. The charger jack is mounted on its side. If you look at the full version of the photo you can see how the side that's supposed to be touching the circuit board is actually to the right. This makes the jack far more vulnerable to stresses from plugging stuff in. I later had to repair the connection from the bottom/outer pin (which goes to the right) to the small jumper wire that connects it to the circuit board. The battery contacts can get dirty, making it seem as if the battery is worn out. I cleaned them using an abrasive pen eraser. Some people have reported bent contacts, so it is a good idea to make sure that they have not been bent. Later, you can clean the battery and the contacts at the other end. If the battery is old you could replace it, but if it seems to perform poorly it's quite possible that the contacts were dirty and it will perform acceptably after they are cleaned.
Finally, while reattaching the circuit board to the metal part of the case I fixed the solder connections. Where the copper on the circuit board was broken I had to clean off surrounding copper and solder to that. I found that desoldering braid was best for making a reinforced connection. The trickiest part of the reassembly was the top-back part of the case. One has to bend it to put in the hard drive and battery, and bending it back afterwards can be a problem. It might make most sense to put those in before soldering the circuit board to the case.
You first need to open up the device. The Multimedia Jukebox has the same case and there is a good guide on how to disassemble it. Basically, there are two screws on the top (small side above the screen), two on the bottom, and metal clips sticking out from the metal part of the case holding the plastic part. You can also slide out the hard drive and battery, but some bending of the top end of the metal part of the case is probably necessary for that. The result should be:
Now you can see the little circuit board that's soldered to the headphone jack pins. Breaks in the solder are probably not wide open; the sides of the crack are probably touching. I found I could easily move the small board away, leading to this picture:
Now, one could just solder the small board back and close up the device. I chose to go further, desoldering the metal part of the case from the circuit board so that I could access the other side of the main circuit board. Some of these solder connections were already broken, often ripping off some of the copper. I then removed he headphone jack, inspected it to make sure it was okay, and glued it back with epoxy so that it wouldn't move and stress the connections. I'm not sure if glue is the best idea in case the jack breaks. I put a short length of electronic component lead (thin solderable wire) in the holes alongside the headphone jack pins to reinforce the solder, and I soldered the small board to the headphone jack. Here is a photo of the underside of the board with the headphone jack removed:

While that side is exposed, it would probably be a good idea to inspect the charger jack and battery contacts, and clean the battery contacts. The charger jack is mounted on its side. If you look at the full version of the photo you can see how the side that's supposed to be touching the circuit board is actually to the right. This makes the jack far more vulnerable to stresses from plugging stuff in. I later had to repair the connection from the bottom/outer pin (which goes to the right) to the small jumper wire that connects it to the circuit board. The battery contacts can get dirty, making it seem as if the battery is worn out. I cleaned them using an abrasive pen eraser. Some people have reported bent contacts, so it is a good idea to make sure that they have not been bent. Later, you can clean the battery and the contacts at the other end. If the battery is old you could replace it, but if it seems to perform poorly it's quite possible that the contacts were dirty and it will perform acceptably after they are cleaned.
Finally, while reattaching the circuit board to the metal part of the case I fixed the solder connections. Where the copper on the circuit board was broken I had to clean off surrounding copper and solder to that. I found that desoldering braid was best for making a reinforced connection. The trickiest part of the reassembly was the top-back part of the case. One has to bend it to put in the hard drive and battery, and bending it back afterwards can be a problem. It might make most sense to put those in before soldering the circuit board to the case.
Subscribe to:
Posts (Atom)