Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#718 closed defect (fixed)

Apple Lossless only muxes in mov

Reported by: bradsoto Owned by:
Priority: normal Component: ffmpeg
Version: 0.7.8 Keywords: alac mpegts crash
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


I'm trying to mux ALAC into a mpegts container, unfortunately only mov works.

This works fine:
ffmpeg -i -acodec alac

This reports an error (after pressing [q]):
ffmpeg -i -acodec alac -f mpegts test.mpg

ffmpeg version 0.7.8, Copyright (c) 2000-2011 the FFmpeg developers

built on Nov 27 2011 00:15:00 with clang 2.1 (tags/Apple/clang-163.7.1)
configuration: --prefix=/opt/local --disable-ffplay --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libopenjpeg --enable-libx264 --enable-yasm --enable-libaacplus --enable-libvpx --enable-libspeex --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/Developer/usr/bin/clang --arch=x86_64 --enable-yasm --enable-nonfree --enable-libfaac
libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0

[ogg @ 0x7f89d404ac00] Estimating duration from bitrate, this may be inaccurate
Input #0, ogg, from '':

Duration: N/A, start: 0.000000, bitrate: 192 kb/s

Stream #0.0: Audio: vorbis, 44100 Hz, stereo, s16, 192 kb/s

[mpegts @ 0x7f89d4043600] muxrate VBR, pcr every 1 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'test.mpg':


encoder : Lavf52.111.0
Stream #0.0: Audio: alac, 44100 Hz, stereo, s16, 64 kb/s

Stream mapping:

Stream #0.0 -> #0.0

Press [q] to stop, ? for help
ffmpeg(46607) malloc: * error for object 0xc2b60f195cb95406: pointer being freed was not allocated
* set a breakpoint in malloc_error_break to debug
Abort trap: 6

Change History (7)

comment:1 by bradsoto, 11 years ago

Also, playing back the file with mplayer has errors:

mplayer test.mpeg
MPlayer UNKNOWN-4.2.1 (C) 2000-2011 MPlayer Team
163 audio & 363 video codecs
Can't init Apple Remote.

Playing test.mpeg.
TS file format detected.
NO VIDEO! NO AUDIO! (try increasing -tsprobe) NO SUBS (yet)! 
No stream found.

Exiting... (End of file)
Last edited 11 years ago by bradsoto (previous) (diff)

comment:2 by Carl Eugen Hoyos, 11 years ago

Priority: importantnormal

What are you trying to achieve?

alac is a proprietary (in the sense of "published by a company, not by a standard committee or similar") audio codec that can only be read by a limited number of software (either QuickTime- or FFmpeg-based). FFmpeg supports muxing alac in mov and caf. (avi could possibly be supported, but how would you read the resulting file?)
Transport Streams are not general-purpose containers (like avi), but allow only a very limited set of codecs, see

comment:3 by bradsoto, 11 years ago

I'm trying to encoding alac in mpegts for use with HTTP Live Streaming. A program called m3u8-segmenter accepts an mpegts file and segments it into 3 seconds chunks for streaming. There is documentation on Apple's website on the 'magic cookies' necessary for alac to work properly in mp4 files. I was hoping that they could be used with mpegts in the same way. ALAC was released under an Apache Licence 2.0 at the end of October.

Do the magic cookies and other information learned from reading the source give ffmpeg enough information to encode to a mpegts? If Quicktime doesn't play nice with the results, I guess we can make apps for iOS and Android that are compatible.

comment:5 by Carl Eugen Hoyos, 11 years ago

Keywords: crash added
Resolution: fixed
Status: newclosed

The crash you were seeing will be fixed in the next release (you can test with git checkout release/0.7).

Concerning muxing alac in transport streams, I don't think this should be supported before either another application supports it or alac shows up in

But otoh, it works fine for me with ffmpeg (to decode, you just have to specify -acodec alac because no format identifier is specified) and MPlayer, so maybe it will also work in your application.

comment:6 by bradsoto, 11 years ago

Thanks for your response. How easy is it to add a format identifier? I compiled from git and m3u8-segmenter (segmenter.c, others...) are based on ffmpeg libraries and they don't accept it without a format identifier. Is it possible to patch to ffmpeg play this type of file without having to specify -acodec alac?

comment:7 by Carl Eugen Hoyos, 11 years ago

Simply choose an identifier and add it to libavformat/mpegts.c.

Note: See TracTickets for help on using tickets.