Transcoding Apple lossless m4a files

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
steven2583
Posts:8
Joined:Mon Mar 07, 2011 4:50 am
AV Hardware:QNAP TS-451+, OPPO 93 blue-ray player.
Transcoding Apple lossless m4a files

Post by steven2583 » Mon Mar 14, 2011 7:31 pm

I have all of my iPod music with most of the music using apple lossless from CD. I purchased a DNS-323 NAS to hold my files and I decided to try and get a media server to distribute the files to my stereo down stairs. In the config transcoding screen I never see anything listing for M4A files. When I was trying flac I didn't have it listed either. So far Twonky Media Server seems to be the best. I can't seem to find anything else. MediaTomb I keep on getting duplicates and it's really slow pulling up my files. I will be streaming to an OPPO 93 player and it doesn't support m4a files. I want to transcode the files on the fly. Manually transcode the files works fine with ffmpeg to wav works fine and I can play them. To test this out I'm using windows 7 Media play for testing so I don't have to run up and down the stairs. I tested transcoding using Flac to WAV in Twonky and it worked fine. For the life of me I cannot get ffmpeg to be called for m4a files. Twonky seems to think the device can support m4a files. I keep on getting invalid media type from Windows Media Player. What do I need to put in the clients.db, transcoding.db, server ini etc. I'm so frustrated at this point spending over 20 hours searching the internet. I'm still trying if I should shell out the money for Twonky.

Clients.db

NA:Windows 7
DD:<modelName>Windows Media Player Sharing</modelName>
D2:<modelNumber>5.0</modelNumber>
HH:Windows-Media-Player
XM:DLNA15
DB:FIX
MT:m4a,mp4.a,3gp.a,m4b audio/mp4
TR:mp4
TP:mp4
XM:UNLIMITED
DF:devicedescription-win7.xml

Transcoding.db

# additional audio res elements
LPCM,lpcm,audio/L16,LPCM
WAV,wav,audio/x-wav
FLAC,flac,audio/x-flac
M4A,m4a,audio/mp4


ffmpeg-m4a-wav.desc

#(c) 2008 by PacketVideo
exec: ffmpeg -y -i $infile $outfile
# capabilities
from=audio/mp4
to=audio/wav
synchronous
priority=high

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Transcoding Apple lossless m4a files

Post by phibertron » Mon Mar 14, 2011 8:40 pm

Man, there is alot of chaos going on here lately with transcodeing frustration
Sorry to hear you cant get it working
Not that I have the answer, but maybe some things to look at


I noticed that this line, shows two things, m4a and audio/mp4
Have your tired to remove the m4a from there

MT:m4a,mp4.a,3gp.a,m4b audio/mp4
to
MT:mp4.a,3gp.a,m4b audio/mp4

Also change these

TR:mp4
TP:mp4
to
TP:M4A
TP:M4A

I read that these are case sensative to what is in the transcoding.db

In the transcoding.db which also shows audio/mp4
Not sure of the mimtype for m4a being used by twonky
But I think audio/mp4a or possibly audio/mp4a-latm is the mime type for m4a

M4A,m4a,audio/mp4
to
M4A,m4a,audio/mp4a-latm


In the ffmpeg-m4a-wav.desc based on the above
we would change the from line

from=audio/mp4
to
from=audio/mp4a-latm

Like I said this is a guess, but worth a shot
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Transcoding Apple lossless m4a files

Post by phibertron » Mon Mar 14, 2011 8:46 pm

For what its worth
From this post

http://twonkyforum.com/viewtopic.php?f= ... ure#p33582

There is a link to this document

http://www.dbstalk.com/attachment.php?a ... 1208634481

The document does help clear a few things up,
About some of the relationships between things

But its my guess that we need to find the right mime type for m4a files to get this to work
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

steven2583
Posts:8
Joined:Mon Mar 07, 2011 4:50 am
AV Hardware:QNAP TS-451+, OPPO 93 blue-ray player.

Re: Transcoding Apple lossless m4a files

Post by steven2583 » Tue Mar 15, 2011 7:13 pm

Played it around with your suggestions. Still couldn't get it to work. I read those other links before. I must be missing something. If someone can confirm the MIME type. Someone must have this working. I can't be the only person trying to play Apple Lossless on a device that can't support apple lossless. I just hate to transcode everything from my iTunes area to a FLAC or wav area and try to keep that in sync.

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Transcoding Apple lossless m4a files

Post by parnott » Tue Mar 15, 2011 8:48 pm

steven2583 wrote:Played it around with your suggestions. Still couldn't get it to work. I read those other links before. I must be missing something. If someone can confirm the MIME type. Someone must have this working. I can't be the only person trying to play Apple Lossless on a device that can't support apple lossless. I just hate to transcode everything from my iTunes area to a FLAC or wav area and try to keep that in sync.
Do these files have DRM which if you bought them the Apple store is most likely? Your only recouse if they have DRM is to find some software to strip the DRM, which is by the way illegal in most part of the world.

steven2583
Posts:8
Joined:Mon Mar 07, 2011 4:50 am
AV Hardware:QNAP TS-451+, OPPO 93 blue-ray player.

Re: Transcoding Apple lossless m4a files

Post by steven2583 » Wed Mar 16, 2011 6:31 am

There is no DRM on the files. I imported them into iTunes from CD. I perfer the higher quality then what you can download.

ozinm
Posts:4
Joined:Thu Mar 17, 2011 12:07 am
AV Hardware:sony sdp-s570

Re: Transcoding Apple lossless m4a files

Post by ozinm » Thu Mar 17, 2011 12:33 am

*EDITED ON 2011-03-18 @ 00:15 - Thanks phibertron for pointing out error in instructions*

Hi All,
I've got a fix for this for Twonky running on Windows.
However I've only just discovered Twonky and been playing around with it for 1 day so there might be better solutions than this:

1. Download ffmpeg for windows and install it (I googled the one available for Audacity for download)
2. edit the C:\Program Files\TwonkyMedia\cgi-bin\ffmpeg.location text file and give it the folder location of your installed ffmpeg.
eg: c:\ffmpeg
Oh, I don't know if it makes any difference but I was careful NOT to insert a RETURN at the end of the line.

3. edit the C:\Program Files\TwonkyMedia\cgi-bin\any-mp3.desc text file and replace the text with:

# transcode audio (mp4, wav, wma to mp3)
exec: ffmpeg -i $infile -ar 22050 -ab 32 $outfile
from=audio/all
to=audio/mpeg
asynchronous
priority=idle

This should tell Twonky to use ffmpeg to transcode audio to mp3 instead of the any2mp3 command which doesn't exist in Windows.
I've also set the audio rate to 22.05 Khz and Audio BitRate 32Khz with the -ar and -ab switches while I test things out.
This page gives you a good breakdown of what switches are available:
http://www.hiteshagrawal.com/ffmpeg/con ... ing-ffmpeg

Hope this helps someone out!

PS as I'm very much a newbie, if I've done something supremely stupid with this hack please let me know!

--------
My test kit: Sony BDP-S570, Wireless laptop Win XP sp2 with TwonkyManager 30day trial 6.0.32
Last edited by ozinm on Fri Mar 18, 2011 1:17 am, edited 1 time in total.

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Transcoding Apple lossless m4a files

Post by phibertron » Thu Mar 17, 2011 1:50 am

just curious to the "cgi-binany-mp3.desc" cgi-binary ?
or did you mean to say "ffmpeg-mp3.desc" ?

This path your on was one of my next tactics also
As I recently tried the opposite,
I renamed ffmpeg to any2mp3 :D

PS
any2mp3, for what its worth, is included in one of the 5.x versions, possible 5.1.1 for whs i think
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

ozinm
Posts:4
Joined:Thu Mar 17, 2011 12:07 am
AV Hardware:sony sdp-s570

Re: Transcoding Apple lossless m4a files

Post by ozinm » Fri Mar 18, 2011 1:09 am

phibertron wrote:
[quote]
just curious to the "cgi-binany-mp3.desc" cgi-binary ?
or did you mean to say "ffmpeg-mp3.desc" ?
[/quote]

whoops I missed a slash.
It should read:
C:\Program Files\TwonkyMedia\cgi-bin\any-mp3.desc

Although I presume from what I've read so far, you could make a new file called ffmpeg-mp3.desc rather than fiddling with the any-mp3.desc file.

sorry for the confusion!

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Transcoding Apple lossless m4a files

Post by phibertron » Fri Mar 18, 2011 1:17 am

No worries

Were all here to try and figure the things out
that we arent' getting from documentation
or from trying to do something that is not supported by twonky support directly

What you have suggested is great, as it gives another way to do something
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

steven2583
Posts:8
Joined:Mon Mar 07, 2011 4:50 am
AV Hardware:QNAP TS-451+, OPPO 93 blue-ray player.

Re: Transcoding Apple lossless m4a files

Post by steven2583 » Fri Mar 18, 2011 6:52 am

When I try your desc file. It will transcode flac but it totally ignores m4a files. it's as if it doesn't see them for transcoding.

ozinm
Posts:4
Joined:Thu Mar 17, 2011 12:07 am
AV Hardware:sony sdp-s570

Re: Transcoding Apple lossless m4a files

Post by ozinm » Fri Mar 18, 2011 9:53 am

[quote="steven2583"]When I try your desc file. It will transcode flac but it totally ignores m4a files. it's as if it doesn't see them for transcoding.[/quote]

Hi steven2583,
That would suggest to me that either your version of ffmpeg can't translate the files or there's something in your clients.db file that is telling Twonky that your player can handle m4a's and doesn't need to transcode them.

I would try editing your client.db (make a backup first!) cutting it down to the generic client only to start with.
If it then works, add other settings back in one by one to see which one breaks the transcoding.

Which version of ffmpeg are you using?
I grabbed mine from here: http://manual.audacityteam.org/index.ph ... tallffmpeg
and when i installed it I changed the install location to C:\ffmpeg

steven2583
Posts:8
Joined:Mon Mar 07, 2011 4:50 am
AV Hardware:QNAP TS-451+, OPPO 93 blue-ray player.

Re: Transcoding Apple lossless m4a files

Post by steven2583 » Fri Mar 18, 2011 5:16 pm

I'm not sure what version of ffmpeg I'm using but it's one compiled for the DNS-323 NAS. I manually tried running ffmpeg and it converts an m4a file to a wav and then I can stream the wav file it created and it plays. Using ffmpeg to convert flac. I have a telnet session open and I see that twonkyserver kicks off ffmpeg and message show up to to screen in the telnet session. For m4a files ffmpeg twonky doesn't even kick off ffmpeg. I will take your advice and delete everything in the clients.db file except the generic and play with the TR and MT and see if I can get it to call ffmpeg.

I'm running windows 7 so I was expecting twonky to use the Windows Media Player for Windows 7. Hopefully the generic will work. My end game is to get it streamed to an oppo 93 blue ray player, but Windows media play available and it's easier to test then to run up and down the stairs.

ozinm
Posts:4
Joined:Thu Mar 17, 2011 12:07 am
AV Hardware:sony sdp-s570

Re: Transcoding Apple lossless m4a files

Post by ozinm » Fri Mar 18, 2011 11:28 pm

Hi Steven2583,
Just got back home.

If it helps, here's what I cut my clients.db down to, to start testing:


>>
NA:-/-
DB:AUTO

>>
NA:Generic Media Receiver
HH:DLNADOC/1.50
XM:DLNA15
TR:JPEGORG,JPEG160x160,JPEG640x480,JPEG1024x768,JPEG1920x1080,MPEG,MP3
MT:M4A notsupported
DB:AUTO

>>
// The last >> is needed - never remove it or the last client will be missing!

steven2583
Posts:8
Joined:Mon Mar 07, 2011 4:50 am
AV Hardware:QNAP TS-451+, OPPO 93 blue-ray player.

Re: Transcoding Apple lossless m4a files

Post by steven2583 » Mon Mar 21, 2011 4:39 am

I cut my clients.db to what you have. Still won't execute ffmpeg to transcode. Were you successful?

Locked