IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
LGPL'ed Apple Lossless Encoder released
Jai Menon
post Aug 25 2008, 07:52
Post #1





Group: Members
Posts: 6
Joined: 20-August 08
Member No.: 57289



Since 20th August, the open source multimedia framework FFmpeg has support for the Apple Lossless format in the form of a native encoder for the very popular, cross platform libavcodec. The encoder provides compression comparable to iTunes and files are also known to work on the iPod.

You can check it out by grabbing a recent Subversion checkout from :
http://ffmpeg.mplayerhq.hu/download.html

News item based on : http://ffmpeg.mplayerhq.hu/index.html

EDIT : Comparison Chart between various ALAC encoders

This post has been edited by Jai Menon: Aug 25 2008, 11:10
Go to the top of the page
+Quote Post
Brent
post Sep 2 2008, 11:40
Post #2





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



Interesting. How stable is the encoder? I remember that dbPowerAmp had some problems during it development and some files were incompatible with iTunes and iPods. Does ffmpeg have this too, or is that a matter of more testing and bugfixing?

Perhaps this encoder can be altered to work in cooperation with LossyWav. Mobile players like the iPod are one of the most interesting uses for LossyWav imho.

This post has been edited by Brent: Sep 2 2008, 11:47
Go to the top of the page
+Quote Post
Jai Menon
post Sep 3 2008, 06:17
Post #3





Group: Members
Posts: 6
Joined: 20-August 08
Member No.: 57289



I haven't seen any problems in my tests, and the files play perfectly on the iPod according to reports. But please do report bugs if you find any. As for LossyWAV support, further RE'ing is required to find out how the iTunes/iPod decoder handles lower order bits. I'll definitely look into it.
Go to the top of the page
+Quote Post
Brent
post Sep 9 2008, 23:19
Post #4





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



As I couldn't find any binaries to play with, I downloaded the source code (ffmpeg-export-snapshot.tar.bz2) but I'm actually not sure how to compile this (on Windows). I've found a few howto's, but they're all dated and use strange custom arguments that seem to enable only specific funtionality, while I'd like to compile an as complete as possible build.

Can someone help me with this, or put his own compiled binary online (that can encode to ALAC)? Thanks.

btw, once I have a binary, I can use the following, right?
ffmpeg -i input.wav -acodec alac output.m4a

This post has been edited by Brent: Sep 9 2008, 23:19
Go to the top of the page
+Quote Post
Jai Menon
post Sep 11 2008, 15:38
Post #5





Group: Members
Posts: 6
Joined: 20-August 08
Member No.: 57289



Well, you'll need the latest msys and probably the updates for bash, coreutils and gnu make 3.81. Also, you'll need the mingw port (current stable should be fine). Once you configure these and have a working tool chain and msys environment, a simple './configure --enable-memalign-hack && make' should work. This is the bare minimum. If you need external library support like x264, libfaac etc, use the corresponding configure switches.

BTW, The commandline you mentioned for alac encoding is correct.

Thanks.
Go to the top of the page
+Quote Post
Brent
post Oct 12 2008, 21:35
Post #6





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



For anyone interested, I found compiles on a website that can encode alac:

http://tripp.arrozcru.org/

Couldn't get it to compile myself, and I guess I'm not the only one wink.gif

BTW, I'm getting length mismatches in foobar bitcompare. Jai, can you comment on this?

This post has been edited by Brent: Oct 12 2008, 21:44
Go to the top of the page
+Quote Post
Jai Menon
post Oct 20 2008, 07:31
Post #7





Group: Members
Posts: 6
Joined: 20-August 08
Member No.: 57289



Could you upload the sample to upload.mplayerhq.hu/Mplayer/incoming? I'll see what can be done. More info on reporting bugs here: http://ffmpeg.org/bugreports.html.
Thanks.
Go to the top of the page
+Quote Post
xmixahlx
post Oct 20 2008, 08:53
Post #8





Group: Members
Posts: 1394
Joined: 20-December 01
From: seattle
Member No.: 693



will there be a broken-out encoder a la aften for ALAC?


later


--------------------
RareWares/Debian :: http://www.rarewares.org/debian.html
Go to the top of the page
+Quote Post
Brent
post Oct 20 2008, 22:19
Post #9





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



I tried to upload but I'm getting cd errors and write errors: my client can't change the directory nor create files on your ftp server.

The length and framecount mismatch occurs with every file I've tried though. So, if you're not experiencing this behaviour, it has something to do with the build I used (from that website I mentioned)?

This post has been edited by Brent: Oct 20 2008, 22:20
Go to the top of the page
+Quote Post
Brent
post Nov 21 2008, 23:21
Post #10





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



For the record, just tried it with a new build of ffmpeg, 15815, and the problem is still there.
Go to the top of the page
+Quote Post
Brent
post Jan 24 2009, 16:34
Post #11





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



Got the 16537 build from this website:
http://ffmpeg.arrozcru.com/builds/

Still length and framecount mismatches...
Go to the top of the page
+Quote Post
TechVsLife
post Feb 4 2009, 19:18
Post #12





Group: Members
Posts: 195
Joined: 29-May 07
Member No.: 43837



QUOTE (Brent @ Jan 24 2009, 10:34) *
Got the 16537 build from this website:
http://ffmpeg.arrozcru.com/builds/

Still length and framecount mismatches...

I assume you're not getting mismatches with other encoder tools (iTunes to alac, or dbpoweramp to alac)?

This post has been edited by TechVsLife: Feb 4 2009, 19:19
Go to the top of the page
+Quote Post
Brent
post Feb 7 2009, 20:59
Post #13





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



Just checked with iTunes: it creates ALAC files without mismatches. The problem lies with ffmpeg.
Go to the top of the page
+Quote Post
TechVsLife
post Feb 7 2009, 22:38
Post #14





Group: Members
Posts: 195
Joined: 29-May 07
Member No.: 43837



QUOTE (Brent @ Feb 7 2009, 14:59) *
Just checked with iTunes: it creates ALAC files without mismatches. The problem lies with ffmpeg.

Thanks for confirming that. Anyone know whether the problem in the ffmpeg code has been found (& is it on the list to be fixed soon)?

This post has been edited by TechVsLife: Feb 7 2009, 22:38
Go to the top of the page
+Quote Post
Brent
post Feb 8 2009, 13:00
Post #15





Group: Members
Posts: 143
Joined: 27-August 07
Member No.: 46544



I sent a message once to the mailinglist, but I don't think it ever appeared on it. I also havnt seen any chatter about this problem, so I guess its under the radar for the devs. Also, Jai hasnt been to hydrogen for quite some time, so I don't really know how to get the attention of one of the devs.
Go to the top of the page
+Quote Post
Justin Ruggles
post Mar 18 2009, 05:12
Post #16





Group: Developer
Posts: 165
Joined: 3-June 06
From: Raleigh, NC
Member No.: 31393



QUOTE (Brent @ Feb 8 2009, 08:00) *
I sent a message once to the mailinglist, but I don't think it ever appeared on it. I also havnt seen any chatter about this problem, so I guess its under the radar for the devs. Also, Jai hasnt been to hydrogen for quite some time, so I don't really know how to get the attention of one of the devs.

Jai asked that you file a bug report, which I have not seen. That can be done at http://roundup.ffmpeg.org.

At any rate, it appears that the problem is in the final frame. The fb2k ALAC decoder pads the last frame with zeros, even though the number of samples in the last frame is encoded in the frame header. The dBpoweramp decoder (and the iTunes decoder IIRC) do not pad the last frame. I have not examined why ALAC files generated with other encoders do not give mismatches in fb2k, but I have a suspicion that they write the total number of samples in the mp4 container somewhere and fb2k uses that to truncate the last frame instead of using the frame header. Since ALAC has no specification, and the iTunes decoder handles the FFmpeg-generated files properly, I would consider this an issue with fb2k, not FFmpeg. That said, it would still be nice to figure out the exact issue and try to match the iTunes encoder output if possible.

edit: I did test dBpoweramp, but I don't have iTunes anymore... could you convert the ALAC file to WAV in iTunes and compare that to the original WAV using fb2k bitcompare?

This post has been edited by Justin Ruggles: Mar 18 2009, 05:20
Go to the top of the page
+Quote Post
Gregory S. Chudo...
post Mar 19 2009, 12:26
Post #17





Group: Developer
Posts: 698
Joined: 2-October 08
From: Ottawa
Member No.: 59035



QUOTE (Justin Ruggles @ Mar 18 2009, 07:12) *
I have not examined why ALAC files generated with other encoders do not give mismatches in fb2k, but I have a suspicion that they write the total number of samples in the mp4 container somewhere and fb2k uses that to truncate the last frame instead of using the frame header.


There are two places in mp4 container, where the length is stored.

First place is in moov.mvhd chunk (movie header).
iTunes encoder writes the approximate number of samples there.
ffmpeg encoder writes the approximate length in milliseconds.
This is not very reliable field and is ignored by fb2k.

Second place is moov.trak.mdia.minf.stbl.stts (sample table).
This is where iTunes encoder stores the correct length. This is what fb2k uses.
This table contains array of struct { int sample_count; int sample_duration }
Total length is a sum of sample_count*sample_duration.
Normally for iTunes-encoded file this table contains two entries.
First entry with sample_duration=4096 and sample_count=total_samples/4096
Second entry with sample_duration=total_samples%4096 and sample_count=1
For ffmpeg, this table sadly contains only one entry, so the total sample length is rounded up to a multiple of 4096.


--------------------
CUETools 2.1.4
Go to the top of the page
+Quote Post
Justin Ruggles
post Mar 19 2009, 17:34
Post #18





Group: Developer
Posts: 165
Joined: 3-June 06
From: Raleigh, NC
Member No.: 31393



QUOTE (Gregory S. Chudov @ Mar 19 2009, 07:26) *
QUOTE (Justin Ruggles @ Mar 18 2009, 07:12) *
I have not examined why ALAC files generated with other encoders do not give mismatches in fb2k, but I have a suspicion that they write the total number of samples in the mp4 container somewhere and fb2k uses that to truncate the last frame instead of using the frame header.


There are two places in mp4 container, where the length is stored.

First place is in moov.mvhd chunk (movie header).
iTunes encoder writes the approximate number of samples there.
ffmpeg encoder writes the approximate length in milliseconds.
This is not very reliable field and is ignored by fb2k.

Second place is moov.trak.mdia.minf.stbl.stts (sample table).
This is where iTunes encoder stores the correct length. This is what fb2k uses.
This table contains array of struct { int sample_count; int sample_duration }
Total length is a sum of sample_count*sample_duration.
Normally for iTunes-encoded file this table contains two entries.
First entry with sample_duration=4096 and sample_count=total_samples/4096
Second entry with sample_duration=total_samples%4096 and sample_count=1
For ffmpeg, this table sadly contains only one entry, so the total sample length is rounded up to a multiple of 4096.

Thanks Gregory. I will run this by the FFmpeg mov/mp4 maintainer. Still I wonder why foobar reverts to rounding up when it could use the encoded sample count in the frame header of the last ALAC frame. But the mp4 needs to be correct either way, and hopefully this will be fixed in the next FFmpeg release (likely to be in 3 to 6 months).
Go to the top of the page
+Quote Post
Justin Ruggles
post Apr 16 2009, 04:15
Post #19





Group: Developer
Posts: 165
Joined: 3-June 06
From: Raleigh, NC
Member No.: 31393



The FFmpeg MP4 issue that was causing fb2k to pad the last frame has been fixed in FFmpeg SVN r18504.
Go to the top of the page
+Quote Post
nycjv321
post Aug 26 2009, 05:53
Post #20





Group: Members
Posts: 69
Joined: 15-July 09
Member No.: 71500



QUOTE (Justin Ruggles @ Apr 15 2009, 23:15) *
The FFmpeg MP4 issue that was causing fb2k to pad the last frame has been fixed in FFmpeg SVN r18504.


I am using a windows build, revision number 18639 im still getting the frame padding issue....
Go to the top of the page
+Quote Post
nycjv321
post Aug 26 2009, 16:14
Post #21





Group: Members
Posts: 69
Joined: 15-July 09
Member No.: 71500



I must add that the file does seem to be lossless though, I did a md5 hash sum comparison with one song (flac source) and they matched... may test more but md5sums matching usually aren't a coincidence... if only ffmpeg (like flac), or foobar added a md5 hash as a tag though biggrin.gif
Go to the top of the page
+Quote Post
Gregory S. Chudo...
post Aug 30 2009, 23:06
Post #22





Group: Developer
Posts: 698
Joined: 2-October 08
From: Ottawa
Member No.: 59035



Ported to .NET.

Attached File  CUETools.ALAC.02.rar ( 38.51K ) Number of downloads: 267


I'm not an iPod person, so cannot test if produced files play on the device.

Source code is here.

Please test it.

UPD: fixed an error, the output file had wrong extension (flac instead of m4a).
UPD2: replaced 64-bit version with any-CPU version

This post has been edited by Gregory S. Chudov: Aug 31 2009, 16:18


--------------------
CUETools 2.1.4
Go to the top of the page
+Quote Post
lvqcl
post Aug 31 2009, 15:11
Post #23





Group: Developer
Posts: 3363
Joined: 2-December 07
Member No.: 49183



CUETools.Codecs.ALAC.dll is 64-bit, and it doesn't work on my 32-bit system (WinXP SP3).
Go to the top of the page
+Quote Post
Gregory S. Chudo...
post Aug 31 2009, 16:14
Post #24





Group: Developer
Posts: 698
Joined: 2-October 08
From: Ottawa
Member No.: 59035



Thank you, fixed and uploaded new version in the same post above.

Any other test results yet?

This post has been edited by Gregory S. Chudov: Aug 31 2009, 16:19


--------------------
CUETools 2.1.4
Go to the top of the page
+Quote Post
nycjv321
post Aug 31 2009, 20:41
Post #25





Group: Members
Posts: 69
Joined: 15-July 09
Member No.: 71500



I'll check it out later
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 31st August 2014 - 03:44