Streaming Apple Lossless to Unsupporting Clients

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
gnuite
Posts:3
Joined:Fri Aug 03, 2007 2:20 am
Streaming Apple Lossless to Unsupporting Clients

Post by gnuite » Fri Aug 03, 2007 2:44 am

Just bought twonkyvision, and I'm happy with it so far, especially the transcoding.

I took the cgi-flac model and created a similar construct for transcoding Apple Lossless to WAV. The plugin itself seems to work, but now I have a problem with clients that support M4A but not Apple Lossless. (Apple Lossless uses the M4A container, but a proprietary codec.)

The problem is that Apple Lossless files are reported with the "audio/m4a" mime type, and since the client supports m4a, it doesn't ask for a wav version, and thus twonkyvision doesn't try to transcode the m4a to wav. The client then discovers that it can't support the file, and subsequently gives up.

I need a way to force twonkyvision to transcode the file to wav regardless of whether or not the client thinks it can support it. Is there any way to "force" transcoding? Or is there another solution to this problem? Or can I force Apple Lossless files to map to a different mime type?

gnuite
Posts:3
Joined:Fri Aug 03, 2007 2:20 am

Post by gnuite » Fri Aug 03, 2007 10:05 pm

I have more info. It turns out one of my initial assumptions was wrong. Even when the client doesn't support m4a at all, twonky still refuses to offer the client a wav version of the Apple Lossless file via transcoding. Some clients don't list the .m4a files at all - others just list it as an "Unsupported Format."

If I change the filename of the Apple Lossless file from .m4a to .flac, and if I change the flac-wav.desc file to use my cgi-m4a binary (instead of the cgi-flac binary), then twonky will successfully stream wav data to clients, transcoding using my cgi-m4a binary. Of course, twonky thinks it's a flac file, so the tags don't get parsed correctly.

I thought that perhaps my mime type was wrong in my m4a-wav.desc file, but I tried 4 different generally-accepted m4a mime types (audio/x-m4a, audio/m4a, audio/x-mp4, audio/mp4), all without success. I turned on debug and checked the logs, and it sure looks like twonky is interpreting the .m4a files with the mime type "audio/x-m4a".

Does twonky disable transcoding for m4a files? I tried the flac fakeout trick with WMA by renaming the .m4a file to a .wma file and the mime type "audio/x-ms-wma", and twonky parsed it as a WMA file, but it refuses to transcode WMA files. MP3 worked, though, using the "audio/mpeg" mime type, but now I'm back to square one, where the client thinks it can play the MP3 file, which it can't (even if it did ask for a transcode, the transcode would fail for all real mp3 files, anyway).

Are flac and mp3 special cases, to support the flac-to-wav and mp3-to-pcm plugins? Why can't twonky transcode from any of the other file types? Or am I just doing something wrong?

Locked