Ramblings on audiobooks

In one of my previous posts I have noted I’m an avid audiobook consumer. I started when I was at the hospital, because I didn’t have the energy to read — and most likely, because of the blood sugar being out of control after coming back from the ICU: it turns out that blood sugar changes can make your eyesight go crazy; at some point I had to buy a pair of €20 glasses simply because my doctor prescribed me a new treatment and my eyesight ricocheted out of control for a week or so.

Nowadays, I have trouble sleeping if I’m not listening to something, and I end up with the Audible app installed in all my phones and tablets, with at least a few books preloaded whenever I travel. Of course as I said, I keep the majority of my audiobooks in the iPod, and the reason is that while most of my library is on Audible, not all of it is. There are a few books that I have bought on iTunes before finding out about Audible, and then there are a few I received in CD form, including The Hitchhiker’s Guide To The Galaxy Complete Radio Series which is my among my favourite playlists.

Unfortunately, to be able to convert these from CD to a format that the iPod could digest, I ended up having to buy a software called Audiobook Builder for Mac, which allows you to rip CDs and build M4B files out of them. What’s M4B? It’s the usual mp4 format container, just with an extension that makes iTunes consider it an audiobook, and with chapter markings in the stream. At the time I first ripped my audiobooks, ffmpeg/libav had no support for chapter markings, so that was not an option. I’ve been told that said support is there now, but I have not tried getting it to work.

Indeed, what I need to find out is how to build an audiobook file out of a string of mp3 files, and I have no idea how to fix that now that I no longer have access to my personal iTunes account on a mac to re-download the Audiobook Builder and process them. In particular, the list of mp3s that I’m looking forward to merge together are the years 2013 and 2014 of BBC’s The News Quiz, to which I’m addicted and listen continuously. Being able to join them all together so I can listen to them with a multi-day-running playlist is one of the very few things that still let me sleep relatively calmly — I say relatively because I really don’t remember when was the last time I have slept soundly in about an year by now.

Essentially, what I’d like is for Audible to let me sideload some content (the few books I did not buy from them, and the News Quiz series that I stitch together from the podcast), and create a playlist — then for what I’m concerned I don’t have to use an iPod at all. Well, beside the fact that I’d have to find a way to shut up notifications while playing audiobooks. Having Dragons of Autumn Twilight interrupted by the Facebook pop notification is not something that I’m looking forward for most of the time. And in some cases I even have had some background update disrupting my playback so there is definitely space for improvement.

Did Apple lose its advantage?

Readers of my blog for a while probably know already that I’ve been an Apple user over time. What is not obvious is that I have scaled down my (personal) Apple usage over the past two years, mostly because my habits, and partly because of Android and Linux getting better and better. One component is, though, that some of the advantages to be found when using Apple started to disappear for me.

I think that for me the start of the problems is to be found in the release of iOS 7. Beside the taste of not liking the new flashy UI, what I found is that it did not perform as well as previous releases. I think this is the same effect others have had. In particular the biggest problem with it for me had to do with the way I started using my iPad while in Ireland. Since I now have access to a high-speed connection, I started watching more content in streaming. In particular, thanks to my multiple trips to the USA over the past year, I got access to more video content on the iTunes store, so I wanted to watch some of the new TV series through it.

Turned out that for a few versions, and I mean a few months, iOS was keeping the streamed content in the cache, not accounting for it anywhere, and never cleaning it up. The result was that after streaming half a series, I would get errors telling me the iPad storage was full, but there was no way from the device itself to clear the cache. EIther you had to do a factory reset to drop off all the content of the device, or you had to use a Windows application to remove the cache files manually. Not very nice.

Another very interesting problem with the streaming the content: it can be slow. Not always but it can. One night I wanted to watch The LEGO Movie since I did not see it at the cinema. It’s not available on the Irish Netflix so I decided to rent it off iTunes. It took the iPad four hours to download it. It made no sense. And no, the connection was not hogged by something else, and running a SpeedTest from the tablet itself showed it had all the network capacity it needed.

The iPad is not, though, the only Apple device I own; I also bought an iPod Touch back in LA when my Classic died. even though I was not really happy with downgrading from 80G down to 64G. But it’s mostly okay, as my main use for the iPod is to listen to audiobooks and podcasts when I sleep — which recently I have been doing through Creative D80 Bluetooth speakers, which are honestly not great but at least don’t force me to wear earphones all night long.

I had no problem before switching the iPod from one computer to the next, as I moved from iMac to a Windows disk for my laptop. When I decided to just use iTunes on the one Windows desktop I keep around (mostly to play games), then a few things stopped working as intended. It might have been related to me dropping the iTunes Match subscription, but I’m not sure about that. But what happens is that only a single track for each of the albums was being copied on the iPod and nothing else.

I tried factory reset, cable and wireless sync, I tried deleting the iTunes data on my computer to force it to figure out the iPod is new, and the current situation I’m in is only partially working: the audiobooks have been synced, but without cover art and without the playlists — some of the audiobooks I have are part of a series, or are split in multiple files if I bought them before Audible started providing single-file downloads. This is of course not very good when the audio only lasts three hours, and then I start having nightmares.

It does not help that I can’t listen to my audiobooks with VLC for Android because it thinks that the chapter art is a video stream, and thus puts the stream to pause as soon as I turn off the screen. I should probably write a separate rant about the lack of proper audiobooks tools for Android. Audible has an app, but it does not allow you to sideload audiobooks (i.e. stuff I ripped from my original CDs, or that I bought on iTunes), nor it allows you to build a playlist of books, say for all the books in a series.

As I write this, I asked iTunes again to sync all the music to my iPod Touch as 128kbps AAC files (as otherwise it does not fit into the device); iTunes is now copying 624 files; I’m sure my collection contains more than 600 albums — and I would venture to say more than half I have in physical media. Mostly because no store allows me to buy metal in FLAC or ALAC. And before somebody suggests Jamendo or other similar services: yes, great, I actually bought lots of Jazz on Magnatune before it became a subscription service and I loved it, but that is not a replacement for mainstream content. Also, Magnatune has terrible security practices, don’t use it.

Sorry Apple, but given these small-but-not-so-small issues with your software recently, I’m not going to buy any more devices from you. If any of the two devices I have fails, I’ll just get someone to build a decent audiobook software for me one way or the other…

Artificial Regions Redux

It’s now over two months ago that I landed in the US with the idea of doing my job, do it well, and then consider moving here if the job was right. And two months ago I wrote about some stupid limitations of services based on where you were when you registered.

Now, even though I’m not here stable yet, I’m getting there: I have a bank account and a check card, and I have some billing address that I can use. So finally for instance I got access to Amazon’s App Store, which is not enabled even if you’re paying for Amazon Prime, as long as you don’t set your primary form of payment to a credit card (and address) in the US.

This should be easy, shouldn’t it? Not really; as it turns out, once I switched that around, Amazon stopped letting me buy Italian Kindle books…. which sounds silly given that they let me buy them before, and I haven’t removed my Italian credit cards, just not set them as default! Furthermore I’m not stopped from accessing them if I had them before.

The absurdities don’t stop here though; since I now have a check card in the US, I moved my iTunes Store account over… this actually enabled a few more functionalities, such as the “iTunes in the Cloud” and the fact that I can now re-download my purchased music as well as Books and Apps (which is the only two items that can be re-downloaded in Italy), but on the other hand, it threw off the previous purchases, showing all my purchased Apps as not available. While I was neither expecting nor hoping that my previous music purchases were available, I was pissed by the fact that it asked me to purchase again the software, especially things like TeamViewer, which is quite expensive. Luckily Apple’s tech support solved the issue relatively quickly.

So there you move to Android Market Google Play, that actually enabled me access to the US software simply by popping in the AT&T SIM card… well, while they did enable access to the US software, they still thought better to keep me off the Google Play Music store, as I was still registered in Italy. And while at it, when I actually purchased an App there… it ended up being charged in euros instead of dollars — this might sound strange, but it means that you pay more for it simply because the bank is going to ask you extra money for the currency exchange. Technically, the MII should tell them which currency the card is using by default, but instead of relying on that, they rely on your billing address… which they also don’t validate against the bank (as Newegg does instead).

Oh well… at least things seem to be more or less sane by now: most of the Italian books I had in my Amazon wishlist are available through the publishers’ group webshop which also provide most of them without DRM. Looks like Amazon is making it much nicer for everybody to buy eBooks now. Not all of them of course, but it’s still a step in the right direction.. and at the same time I’m very happy with buying them on the Kindle if I’m on the go, as I’m sure they are not going to kick me in my balls like Kobo did with The Salmon of Doubt (which I’m currently reading, after buying it again).

I killed enough trees…

Pathetic as it is, this Saturday evening was spent, by me at least, cleaning up old and new paper. And that’s the kind of trees I’m talking about.

Indeed, since I now have a self-employed activity I need to have a paper trail of all the invoices sent and received, of all the contracts, of all the shipment bills and so on. While I prefer being paperless for handling, and thus I scan everything I get (invoices, contracts, shipment bills, …) I have to keep the paper trail for my accountant, at least for now. This also means printing the stuff that otherwise I wouldn’t be printing (!) like Apple’s invoices. I was hoping to avoid that, but it turns out that my accountant wants the paper.

Interestingly enough, printing from within Firefox here on Linux is a bit of a problem: it sets itself to use Letter, even though my /etc/papersize is set properly to a4 and LC_PAPER is set to it_IT (which is, obviously, A4). It really baffles me because it starts already to be a nuisance that you have to have libpaper, when the locale settings already would have the support for discerning between different paper sizes, but the fact that Firefox also defaults to Letter (which is basically only used in US for what I know of) without having an option to change (yeah I did so already with about:config, no change) is definitely stupid.

Luckily, most of the references I’ve been using lately are available in PDF, and thanks to the Sony Reader I don’t have to print them out. What I decided to cut lately, as well, is on CDs: most stuff I can get easily on Apple’s iTunes Store(yes I know it’s not available on Linux, but the music is not DRM’d, it’s in a good format, and it’s not overly expensive); too bad that they don’t have a (more expensive even) ALAC store, or I would be buying also my Metal music (AAC does no good to metal).

Games aren’t as easy: I don’t have space on the PS3 already, and I bought just a couple from the Play Station Network store, nor I have space on the PSP, and additionally, downloaded games with an Italian account are twice the price that I can get from Amazon. Sony, if you’re reading, this is the time to fix this issue! Especially with the PSP Go! coming, I don’t think it’s going to sell well among game enthusiasts, and I’m quite sure that those who will get it will probably hate the extra-high prices.

Anyway, since I’m avoiding buying CDs and rather going with the iTunes Store, and I cannot accept direct donations any longer, you can now also consider their gift cards, they are certainly accepted…

My stake about iTunes, iPod, Apple TV and the like

I’ve been asked a few times why do I ever use an Apple TV to watch stuff on my TV, and why I’m using an iPod and buying songs from the iTunes store. Maybe I should try to write down my opinion on the matter, which is actually quite pragmatic, I think.

I like stuff that works. Even though AppleTV requires me some fiddling, once it got the videos in, it works. And I can be assured that if I get in my bed, I can watch something, or listen to something, without further issues. Of course it has to get the stuff right first.

The iPod lasts almost a week without charging, and I listen to it almost every night, it plays my music in formats that I can deal with, on Linux, just fine: the very common AAC and the ALAC format (Apple Lossless Audio Codec). FFmpeg plays ALAC; xine and mpd use FFmpeg. And with a container that I don’t dislike. Sure it really could use some more software implemented to deal with it on Linux, like an easy way to get the album art out of it (mpd does not seem to get that), and some better tagging too; I guess I could just buy the PDFs of the standard and try to implement some library to deal with it, or extend libavformat to do that).

I have most of my music collection ripped off the original CDs I have here. I used to have it in FLAC (even though I find its container a bit flakey), then I moved to wavpack which had a series of advantages but still used a custom container format. A few months ago I moved everything to ALAC instead, having a single copy of everything and having it in a container format that is a standard (even though a bit of a hard one).

As for what concerns the iTunes (Music) Store, I’m really happy that Apple is improving it and removing the DRM, even if it means that some songs will cost more than they do now. So you cannot use it from Linux because it only works with iTunes, but the music in the “Plus” format, without DRM, work just as fine under Linux, which is basically the only thing I care about. I’d sincerely be glad to buy TV Series on there if they were without DRM and in the usual compatible format; unfortunately this does not seem to be the case, yet. I bite the bullet with audiobooks, mostly because they are at an affordable price even though they are locked in. This is mostly a pragmatic choice.

Sure I’d love if it had a web-based interface that wouldn’t require me to use iTunes to buy the songs, but it works just as fine to me as it is now, since the one alternative that everybody told me when I was looking for one was Amazon’s MP3 Store. But that does not work where I live (Italy), while the iTunes Store does. What I totally don’t agree with is the people who scream to privacy breach because of the watermarking of the music files bought from the iTunes store. Sure there is my name and my ID in the file that I downloaded, but why should I care? The file is supposed only to be used on my systems, isn’t it? I can run it on any device I own, as long as it can understand the format, and I can re-encode it on a different format for devices that don’t use that. It’s not supposed to be published I’m sure, but the only place where having those data is a problem is usually for music piracy. Which by the way is not much hindered since it’s not too difficult to just get the data out. DRM bad. Watermarking no.

On the other hand, I really cannot get on the Xiph train with Ogg, Theora and Vorbis. Sure they are open formats and all that but the fact they aren’t really working on higher end devices makes them just vendor lock-ins just as bad as DRM is, in my opinion. Since even the patent-freeness of those formats is not entirely clear yet (beside the fact that nobody challenged it for now), I don’t see the point in having my music stored in a format that my devices can’t play just for the sake of it. But, I guess, I live somewhere in the world where this is still sane enough to be dealt with.

All in all, I’d be very glad if Apple extended even more the coverage of Japanese music, since paying customs for it is pretty bad and I cannot find most of the artists I’m interested in here in Italy otherwise.

And before I’m misunderstood, I’m not trying to just do advertising for Apple, I’m just saying that pragmatically I don’t count them off just because they sell proprietary software, beside the fact as you can probably tell by other posts in my blog, I tend to use or learn from their open source pieces too. I just grow tired of people saying that one should stay away from the ITunes Store because of DRM (which is going away) or watermarking (which is a good thing in my opinion).

FFmpeg, AppleTV and conversions

Last year, a few months before ending up in the hospital, I bought a LCD TV and an AppleTV device, to watch my animes before sleeping, in my bedroom, relaxing down. After the hospital I ended up not watching much anime anyway, but before that I noticed one nasty thing: my LCD TV “eats” away around 16-20 pixel around the borders with the result that the subtitles for the japanese anime were unreadable. Which was very nasty in my opinion.

After AppleTV Take 2 software was released I also didn’t have much time to play with it to modify it again to install extra codecs, nor I had time to watch much anime, even though I bought a PlayStation 3 to relax. Now, I also considered the idea of selling away the AppleTV, getting a bigger harddrive for the PlayStation 3 and live with that. But since I have already spent enough time in the hospital, having mobile access to my anime is still a feature I’d like to keep, and since I can easily make AppleTV and iPod use the same video files, while PS3 and PSP (which I don’t own, my sister does though) would require different copies, I finally decided to keep it.

I have already tried converting video files but FFmpeg failed, while VisualDub let me do some of the conversions; unfortunately I never had the time to finish the conversion before I ended up in the hospital again. Geez, you really have some trouble when you can count eras based on when you ended up in the hospital. Anyway, since now I got a new box, I decided to try doing the conversion once again with FFmpeg, with all the improvements that arrived up to now.

Before trying that, though, I wanted to be able to do one thing: try to remove data duplication between my workstation (Yamato) and the laptop (Intrepid). My easy way out of this is to make sure that they use the same partition for music and video, which is what they share. Linux and OSX can share mainly two filesystems: FAT32 (nasty) and HFS+. The problem is that HFS+, Apple’s filesystem, can have multiple variants: it may or may not be case-sensitive, and it might be journaled. Linux cannot write to journaled HFS+, and I dislike case insensitivity, so I set up a HFS+ case-sensitive non-journaled partition beside the Time Machine partition on the external hard drive, and connect the drive to Yamato.

Moving the music and video files off Yamato’s drives also helped me to reduce the amount of data I have on the internal drives, which in turn should reduce at least a little the stress on them until I can get a new setup. And Linux HFS+ support is not that bad after all, once you disable journaling. The problem is that I wanted to make sure I could use the same disk both connected to Yamato with network attached, and directly connected to Intrepid. A tried way to do this was to export the partitions via iSCSI, but that would have given exclusive access to the partition to the laptop, and thus caused me once again not to be able to share the data.

The other solution was to export the filesystem via NFS when connected to Yamato, which is what I tried, unfortunately, as I’ve written before, Linux does not support NFS export of HFS+ partitions; or at least it doesn’t right now. I love Free Software just for this reason: if a feature does not exist, I make it up; now I just have to hope that it gets applied upstream in a decent timeframe.

Now that the filesystem problem is mostly behind me (mostly because I still see some failures; I don’t know exactly what they relates to yet), I wanted to make sure I could get a way to convert my content with FFmpeg directly; Yamato is an 8-core system so it should be faster than the laptop to do the work. So I got the latest FFmpeg version out of FFmpeg, and tried.

So the first issue is getting the right container format, while ISO Media, QuickTime, iPod video files, and so on are all based on more or less the same idea, to the point that xine can easily use a single demuxer for all of them, as well as libavformat, there are some tricky issues with having those files working on QuickTime, iTunes and AppleTV. Luckily, FFmpeg has an ipod preset that does the job, mostly, which is very good. The problem is the “mostly”: these formats are based upon elements called atoms, atoms can have versions; the common version 0 that is supported by Apple’s software has 32-bit values for timescales, offsets and stuff like that; alternatively there exist a version 1 that uses 64-bit values instead; xine supports both, but Apple’s software does not. The intersting bit here is that FFmpeg produces version 1 atoms whenever the time scale does not fit as it is in the 32-bit values, without warning even when asking for the iPod container format. The trick here is to force a timescale conversion; most of the content I got is encoded with approximately 29.97 fps, but using a timescale in AVI files that does not fit into version 0 atoms; changing the timescale to basically the same through -r 29.97 fixes the problem for me.

Now, time to get correct video and audio codecs. If you have ever tried to do this you know you have to use H.264 for video and AAC for audio; I used 800kbit/s for video and 128kbit/s for audio; just make sure you pass the parameters before the output filename, otherwise they won’t be picked up. To make sure to enable the proper features for the x264 encoder, I used the presets that are in FFmpeg’s repository; I chosen to skip the -max version since that was giving me less than one frame per second, which was very very bad, I used -hq instead, which gave me good enough results. The problem is the default version enables 8×8 DCT and B-Pyramids, which QuickTime does not properly support. Files encoded with these two features enabled were synced properly to the AppleTV but crashed it down once played. Not so nice. To fix this, just replace the + symbol with a - in front of the two features dct8x8 and bpyramids. Problem solved, and the files play.

For some reason, FFmpeg’s MS-Mpeg4 decoder dies when enabling more than 8 threads, and with so many threads, only about four cores get used on Yamato; I’m not sure why the limit is imposed by the video decoder, since I would expect at least a thread to be able to handle audio, but anyway, since that’s the deal, I decided to convert two files at a time, and to do that, well we have GNU make don’t we?

I wrote this Makefile:


SRCS = $(notdir $(wildcard $(ORIG)/*.avi $(ORIG)/*.mp4))
all: $(patsubst %.mp4,%.m4v,$(patsubst %.avi,%.m4v,$(SRCS)))

%.m4v: $(filter %.avi,$(SRCS)) $(filter %.mp4,$(SRCS))
    ffmpeg -threads 8 -i lt; -vpre libx264-appletv-hq.ffpreset -b 800k -ab 128k -acodec libfaac -padcolor 000000 -padtop 16 -padbottom 16 -padleft 16 -padright 16 -r 29.97 -f ipod "$@"

As you can see, I’m padding 16 pixels around the video for the subtitles to appear on my TV, thanks to FFmpeg, doing the padding is very quick and does not degrade quality.

I just run make -f ~/makefle.convert -j2 ORIG=/directory and there it goes, the conversion is running, and it’ll be done in… a few hours.

Pills and schedules

Before my last visit to the hospital I had a schedule that, for most people, would have seen totally bogus and uncommon, but it’s probably not so uncommon in the geek community (to the point that XKCD talked about it).

Even though some of my relatives thought that it meant I slept for the biggest part of the day (which I didn’t, I woke up at 14 almost every other day, but I was going to sleep at 7am..), it wasn’t a bad schedule for me; I’m most productive when it’s not hot and humid outside, and during the day here it’s both.

Of course in the hospital I wasn’t able to keep such a schedule as you’re forced the hospital’s, but that’s the least. And I wanted to keep a more local schedule at home too, just for the sake of not having to switch schedule again when surgery-time arrived.

But there’s a difference between trying to keep a local schedule and being forced one. Right now, I have to take four pills in a day: one of Deursil 300 during breakfast, one of Lansox 30 at mid morning, and again Deursil, this time 450, once during lunch and once during dinner. This means that I cannot skip breakfast, and I cannot have a breakfast too near the lunch.

The past couple of days, when I write, I woke up at 11, and it was a true mess as I’d have to eat late, and skip a mid-afternoon snack. Very bad for my health.

So instead, I’ve now to force myself on a very local schedule, waking up at 8am and going to sleep as early as possible. Which is a problem as eve though I do listen to podcasts before going to sleep, two of my favourite ones won’t be available until September (Real time with Bill Maher – which I hope will be available again for Europeans too once the new season begins – and Friday Night Comedy), plus it doesn’t help because I’d tend to just listen to podcasts for hours rather than sleep.

One thing that lets me sleep at any hour is the sound of rain on my rooftop. Unfortunately finding recordings of that isn’t simple, I have seen something on the iTunes store (no-DRM, which makes it not evil), but the price is a bit high (€10) for the task. Now I just tried requesting Magnatune’s Relaxing compilation and I’ll see if I find some author that might help me sleeping, in there.

I wish I could go back to my own schedule :(

I bought a software license

I finally decided to convert my video library to Mpeg4 containers, H.264 video and AAC audio, rather than mixing and matching what I had before that. This is due to the fact that I hardly use Enterprise to watch video anymore. Not only because my office is tremendously hot during the summer, but more because I have a 32” TV set in my bedroom. Nicer to use.

Attached to that TV set there is an Apple TV (running unmodified software 2.0.2 at the moment) and a PS3. If you add to that all the other hardware that can play video I own, the only common denominator is H.264/AAC in MP4 container. (I also said before that I like the MP4 format more than AVI or Ogg). It might be because I do have a few Apple products (iPod and AppleTV), but also Linux handle this format pretty well, so I don’t feel bad about the choice. Beside, new content I get from youtube (like videos from Beppe Grillo’s blog) are also in this format — you can get them with youtube-dl -b.

Unfortunately, as I discussed before with Joshua, and as I tried last year before the hospital already, converting video to this format with Linux is a bit of a mess. While mencoder has very good results for the audio/video stream conversions, producing a good MP4 container is a big issue. I tried fixing a few corner cases in FFmpeg before, but it’s a real mess to produce a file that QuickTime (thus iTunes, and thus the Apple TV) can accept.

After spending a couple more days on the issue I decided my time is worth more than what I’ve been doing, and finally gave up to buy a tool that I have been told does the job, VisualHub for OSX. It was less than €20, and that is usually what I’m paid by the hour for my boring jobs.

I got the software, tried it out, the result was nice. Video and audio quality on par with mencoder’s but a properly working MP4 container that QuickTime, iTunes, AppleTV, iPod and even more importantly xine can play nicely. But the log showed a reference to “libavutil”, which is FFmpeg. Did I just pay for Free Software?

I looked at the Bundle, it includes a COPYING.txt file which is, as you might have already suspected, the text of GPL version 2. Okay, so there is free software in here indeed. And I can see a lot of well-known command line utilities: lsdvd, mkisofs, and so on. One nice thing to see is, though, an FFmpeg SVN diff. A little hidden, but it’s there. Good.

The doubt then was if they were hiding the stuff or if it was shown and I did just miss it. Plus it has to have the sources of everything, not just a diff of FFmpeg’s. And indeed in the last page of the documentation provided there is a link to this that contains all the sources of the Free software used. Which is actually quite a lot. They didn’t limit themselves to take the software as it is though, I see at least some patches to taglib that I’d very much like to take a look to later — I’m not sharing confidential registered-users-only information by the way, the documentation is present in the downloadable package that acts as a demo too.

I thought about this a bit. They took a lot of Free Software, adapted it, written a frontend and sold licenses for it. Do I have a problem with this? My conclusion is that I don’t. While I would have preferred is they made it more clear on the webpage that they are selling a Free Software-based package, and that they would have made the frontend Free Software too, I think they are not doing anything evil with this. They are playing well by the rules, and they are providing a working software.

They are not trying to exploit Free Software without giving anything back (the sources are there) and they did something more than just package Free Software together, they tested and prepared presets to use for encoding for various targets, included Apple TV which is my main target. They are, to an extent, selling a service (their testing and presets choices), and their license is also quite acceptable to me (it’s like a family license, usable on all the household’s computers as well as a work computer in an eventual office).

At the end of the day, I’m happy of spending this money as I suppose it’s also going to further develop the Free Software part of the software too, although I would have been happier to chip in a bit more if it was fully Free Software.

And most importantly, it worked out of the tarball solving me a problem I was having for more than an year now. Which means, for me, a lot less time spent trying to get the whole thing working. Of course if one day I could just do everything with simply FFmpeg I’ll be very happy, and I’ll dedicate myself a bit more on MP4 container support, both in writing and parsing, in the future, but at least now I can just feed it the stuff I need converted and dedicate my time and energy toward more useful goals (for me, as in paid jobs, and for the users with Gentoo).

Migrating from iPhoto to DigiKam

For my photos I’ve been using, up to now, iPhoto. The reason for this is that the big part of my photo collection is actually composed of my sister’s photos, which I downloaded directly with the MacBookPro when she asked me.

On the other hand, I use way more often my Linux box, and while iPhoto is a nice tool, DigiKam is not bad either, so I’d gladly move everything on Enterprise, as the mobility option for the photos is lost already once I moved everything on the external harddrive (as I now have more than 10GB of photos).

Unfortunately this migration is not going to be painless I’m afraid, especially because there are a few features I might be losing, unless I can spend some time writing stuff on my own.

The first problem would be having a way to save the photos from risks of losing data; the quick way would be to put them in raid. At the moment the photos are backed up by TimeMachine too, so I don’t risk losing them. I don’t think putting them in my /home directory will be a good idea: it’s just 14GB and the photos will soon be over that quota. I wonder if LVM can mirror partitions easily.

Then there’s the cleanness of storing the photos on the iPod, I don’t think Amarok can load them, can it? I have to check that out. And having them on the AppleTV too.

On the Wiki there are instructions on how to set up a DPAP (Digital Photo Access Protocol, I suppose it’s a relative of DAAP) server to share the photos with iPhoto, and AppleTV. I have to check that out, maybe writing an ebuild.

Of course the easiest way to handle this would be to have DigiKam actually providing DPAP support ;)

Another point I’d like to address is Flickr uploading. To upload to Flickr at the moment I’m using the FlickrUploadr, as the only plugin to allow that in iPhoto is proprietary commercial software. kFlickr is better than FlickrUploadr, but still isn’t well integrated (can’t just select an Album and say “upload to Flickr”).

Probably some of these concerns will be addressed with the KDE 4 version of DigiKam, I expect that to happen, but now I’m wondering if I should migrate already or wait for those to be done…

On the other hand, I wonder if there is anybody working on reverse engineering the protocol with which iTunes talks to AppleTV, it would be nice to be able to just command it through Amarok or DigiKam.

/me adds stuff to his TODO, which is probably way too big for this to ever happen.

But I certainly hope someone will write this stuff for me :) After all we all do our parts in the greater Free Software plan!

Anger, and xine-lib’s mov support (plus a lot more xine stuff!)

*If there is something that makes me very angry is the Summer; I shut down Enterprise during the night because it’s noisy and my mother whines about the noise; I usually could work with Intrepid (the laptop) from my room, but there I don’t have a desk, and the mattress is latice and it doesn’t seem to be a good heat sink, so it overheats, and I can’t even type on the keyboard; this was one of the reasons I bought a 32” LCD TV, which I can connect to the laptop, leaving the laptop on a chair or on the drawer, where it doesn’t overheat, but then I can’t type on it. I should have bought a bluetooth keyboard too, but they are so damn expensive! Plus, standing on the bed trying to sleep doesn’t work well for me when I have my brain going on its own path, and I get angry, angry, so angry that I could smash the laptop over the chair entirely for being unhelpful in this situation. So here I am, in my home office, at Enterprise’s keyboard, trying to relax myself, with bad results.*

Today, I wanted to get started on my plan to improve xine’s support for m4a files; looking at xine playing a generic file, I understood that the metadata wasn’t being loaded at all; on the other hand, there seemed to be a function that was supposed to load it; luckily, it never worked.

Why do I say luckily? Well, most of the code in the qt/mov demuxer does not give problem, but does not even try to parse correctly all of the possible variants. The first example is that most likely the 64-bit offset specifiers will drive xine crazy and get it to crash; luckily there don’t seem to be many 64-bit mov files out there, so it shouldn’t be an issue (please don’t confuse this issue with 64-bit timebases, like the ones generated by FFmpeg, that causes QuickTime to skip over the file; those works fine since 1.1.7 as I fixed their loading). Also, the function that supposedly parsed the metadata increased the pointer on the file by increments of the byte, which is quite wrong, and nasty too.

So then, why do I say it never worked? Well, the code tried to look for a meta atom (an atom is an element of a qt/mov file) inside the main moov atom; but the metadata is actually stored inside /moov/udta/meta atom (consider the path like an XPath applied to qt/mov atoms; yeah the atoms are usually nested).

Now in xine-lib-1.2 the code is fixed to actually load the metadata correctly, and I’ve also improved the code to use switches instead of multiple if cases, this should improve the runtime speed to parse the qt/mov files, and at the same time makes the code more readable. While the first change is totally useless to Amarok users (Amarok uses a TagLib plugin to get the metadata out of m4a files, so it gets it right already), the latter might be appreciated.

My next step would be to try making use of the coverart metadata, to display the cover while playing the audio track and no video is present; it might be a bit of an issue as it should be possible to switch between the cover and the visualisation plugins, but that’s a long story.

I’ve also been thinking about the «Digital Booklet» that iTunes offers with some albums, which I suppose contains the album art; I’m not sure which format it uses, but I’d suppose it’s still a qt/mov file with image data in it (yes, the format also allows still images to be loaded there); it could be quite nice to support that in xine, too, and Amarok could use such a feature to display the booklet data, as in Amarok 2 there should be at least some video playing capabilities. Unfortunately I couldn’t find an album that I’d spend money on without too much regret that had such a digital booklet to get to test.

This work let me consider about the way xine loads the metadata; right now just a subset of the possible information is recovered from the files; it might be nicer to actually provide all the metadata loaded as possible, trying to map it into standard values, or providing string-mapped values for extended metadata as found in qt/mov/mp4 files. Unfortunately there are two things to consider against such an idea: the first is that the API has to be changed to be able to get the extended metadata, the second is that the metadata loading might be time and memory consuming, and a few xine frontends, like Amarok, might not care about it at all, and as such it would require to add an option (at runtime) to load or not the metadata when opening streams (it cannot be global, as Amarok uses xine’s metadata load to get information about the streams that are being played through http and other protocols where TagLib is useless).

Another thing that might be useful to implement, although Amarok wouldn’t likely make use of it, would be last.fm playback, directly in xine. Unfortunately I never looked up the protocol used, so I can’t assess how much work it’s needed to send the messages and receive the additional metadata; the datastream is actually HTTP-based, at least that’s how Amarok’s proxy mangle it, so it shouldn’t be impossible to implement; there is probably the need of adding an option with username and password to use to connect to last.fm.

Again, optimisations that xine-lib might take is an option to enable/disable the visualisation plugins; this is helpful because most users will likely not use them at all, so why build them? They take up space and time without reason; and it’s also the place where a TEXTREL is found, at the moment, so it might be a good idea to make them optional for security reasons too.

I hoped to make use of exmap to actually track down some of the memory usage in xine, but the current version doesn’t work for me on a current kernel on AMD64, so I gave up for now. If somebody has a clue how to make it work, I’d be happy to know.

To give an update about the current works in progress, then, I’ll try to summary most of what I talked about for 1.2 series:

  • the audio conversion branch is happy that aRTs output has been removed from 1.2 series of xine; unfortunately it requires still porting for ESounD (can do it on Enterprise), JACK, FusionAudio (these two are Linux’s so they are somewhat doable if I have a lot of time) and SunAudio (Solaris or NetBSD, I don’t have either available to test with); if I can’t find anybody to help me out with this, it might require quite a lot of time before the port is done;
  • the XDG compliancy work is half done, half because Matt Messier reported some problems when building for a prefix that is not in the default XDG_DATA_DIRS path; in theory we should be changing the code to look first in the prefix for which we built, and then check into the rest of XDG paths; I still have to find time to do this, and that’s why xine-ui isn’t ported yet;
  • the new libdvdnav copy requires some testing with non-encrypted ISO9660 DVDs, that should work fine with the current internal copy of libdvdnav, albeit with a very nasty hack that we’re lucky is working; I have to find such a DVD myself first hand to be able to test if the new libdvdnav can be fixed without the same hack, before merging it into mainline;
  • the new DocBook guide got me a bit stuck; I’ve converted the documentation to DocBook 4.4 XML, and then converted the fig images to SVG (which is quite more modern, and probably easier to deal with), and I got the rules in place to build them; unfortunately there doesn’t seem to be a nice and little SVG rendering program for OS X, so I can’t make the dependency over xmlto and rsvg (or any other rendering program) mandatory (for installing from Hg), which means I have to return to the previous nasty hacks;
  • what else? Well there are a lot of things to work on in xine, unfortunately we need waaay more man power; Thibaut started working on the new plugin loading code, but he’s gone MIA again.

Anyway, if you want to help in any way with these tasks, it’s certainly appreciated; development is the best thing, but if you cannot, maybe you can find someone who can actually grok xine-lib, and convince her/him to help, we do need people. On the other hand, if you know of a decent album of Metal, J-Pop or Jazz music, available on iTunes Plus (note the Plus, it has to be DRM-free) that contains a digital booklet, please let me know – or even better send a gift card to me with the name of it ;) – so that I can try to work on that particular issue.

Now I should really try to sleep, if I can without wanting again to smash something. I don’t think I live well enough if just thinking of what to do about my life gets me to this point, do I?