Friday, June 22, 2012

Playing AAC audio from FLV video in Rockbox

I wanted to have the audio from a guided meditation Flash video on my portable device running Rockbox. After downloading the video to an FLV file, I first tried using FLVExtract. This created an AAC file which was playable in Winamp, but Rockbox didn't recognize it. I had to put the file into an MPEG4 container. For that I used FFmpeg from the command line:

ffmpeg -i audio_from_flvextract.aac -absf aac_adtstoasc -acodec copy final_audio_file.m4a

It's also possible to skip the FLVExtract step:

ffmpeg -i video_file.flv -vn -absf aac_adtstoasc -acodec copy audio_file.m4a

For some reason, this M4A file was slightly larger.

Tuesday, June 12, 2012

Fixing a flash drive by reprogramming the controller

I recently started having problems with the Kingston DataTraveller 102 16GB flash drive (DT102/16GB) which I use on my Asus WL-500W router. It would disconnect as /dev/discs/disca and reconnect as /dev/discs/discb, and so on, making /opt inaccessible. I don't know if it was due to newer versions of the firmware I use or the drive itself. I first started having problems with r3702, and they continued with r4051. I wondered if the USB contacts got dirty, so I quickly plugged it in and unplugged it a bunch of times to try to clean them. That made the drive totally inaccessible. I now think I should only do something like that when power is off, although I'm not sure if it's responsible for the problem. The drive still registered as a USB device, but it couldn't be read or written. Both Windows and Linux reported it as a generic device (not Kingston as before) and Linux couldn't read the capacity.

There's a web site which shows which shows what controllers are used by various drives, and provides tools for reprogramming the controller. According to the site, the DT102 uses the SSS6990 controller, and the proper tool is SSS6690 USB Flash Sorting Ver 4.010. Other versions are available elsewhere, for example at this Russian site. I chose to use 4.010. The program immediately discovered the flash drive:

When I clicked start, it did some programming and then a large amount of testing. Eventually it failed, claiming there are too many bad blocks. I then changed some options via the setup button. Changing from "Downgrade Flash" to "Normal Flash" made the procedure work quickly, without any extended testing. However, the drive was ridiculously slow. I then changed the access time to 50ns, because the flash part number ended with 48 and I think that probably means 48ns. This gave good speed, I think like before. I also changed the LED, so it is normally off and on while the drive is accessed, like before. Here's the configuration dialog with the settings I changed:

The drive works now. I could fill it with data, read the data and verify hashes without any errors. It's also working fine so far with my router and firmware r3497. I wouldn't trust it for something very important though.