Creating the FLAC soundtrack for the "Sintel" release
This is a reprint of part of an article I wrote in Free Software Magazine a little over a year ago, when I was working on the "0.1" prototype for Lib-Ray, which was a high-definition version of the Blender Open Movie "Sintel".
The part I am reprinting is work that will actually be used for the "Sintel" program on the "Blender Open Movies Collection" Lib-Ray that I am producing for this Kickstart (of course, I'll be repeating the same steps for the other Blender movies and following a similar process for "Sita Sings the Blues").
The article refers to the "Ogg" stream format, which was the video container format I was using at the time. Of course, this will now be in a "Matroska" ("MKV") container. I've omitted the parts of the article that deal specifically with putting the sound in a container -- and an upcoming update will explain how it's done with Matroska.
Of course, it's also relevant that this is an example of my previous tutorial writing. The book I'm producing for this Kickstart will have tutorials for all of these steps -- updated to the Lib-Ray 1.0 standard, of course.
Assembling Ogg Soundtracks for an Ogg Video with Audacity, VLC, and Command Line Tools
Originally published in Free Software Magazine: http://fsmsh.com/3537
Mon, 2011-04-18 00:10 -- Terry Hancock
Ogg Vorbis and Ogg FLAC (the Ogg stream version of the Free Lossless Audio Codec) are popular free-licensed and patent-free codecs for handling sound. These are the formats I'll be using in a complex Ogg Theora video file that I am creating as part of my "Lib-Ray" experiment in creating an alternative format for distributing high definition video. In order to do this, I'll need to solve several technical challenges using the FLAC command line tools, Audacity, and VLC, which I'll demonstrate here.
I recently started working on an alternative way to package HD video for distribution -- a need I suggested in my recent piece on the Blu-Ray Blues. I decided to use the Blender Foundation's Open Movie, "Sintel" as a prototype for this, because all of the necessary files are available.
The audio for this project is in two formats: FLAC (Free Lossless Audio Codex) and Vorbis (which uses lossy compression and is much smaller). I use the higher-fidelity FLAC tracks to provide the main 5.1 surround and stereo tracks, as well as the "music and effects only" track (which could be used as the basis for a new dub version).
However, the FLAC files for the 5.1 surround soundtrack are separate, and I need to have a single multi-channel FLAC file in order to combine it properly with my Theora video for playback.
For awhile, I was stumped, but I recently discovered that Audacity, as of version 1.3.3 (I am using 1.3.12), can export data to multi-channel formats
Tricky. FLAC doesn't have a huge collection of command line tools and neither flac nor metaflac can do anything like this. For awhile, I was stumped, but I recently discovered that Audacity, as of version 1.3.3 (I am using 1.3.12), can export data to multi-channel formats. Well, that certainly made things easier.
Here's how to do it.
Get the Soundtrack FLAC files
First I get the source files from the Blender Foundation's Durian project. These are available for download from a Xiph.org download server. The file I want is sintel-master-51-flac.zip, which is a zip file containing the five separate channels of the soundtrack in separate single-channel FLAC files.
While I'm at it, I'll also get the original "Stereo" soundtrack as well. This is a single FLAC file with the two stereo channels multiplexed. There's also a music and effects only track (appropriate for dubbing).
Figure 1: First I get the individual 5.1 surround tracks
Naturally, I expand the zip file to access the contents:
$ cd Soundtrack
Soundtrack$ unzip ../sintel-master-51-flac.zip Archive: ../sintel-master-51-flac.zip
Soundtrack$ ls __MACOSX sintel-master-51-flac
Soundtrack$ cd sintel-master-51-flac
Load into Audacity
Now I launch audacity, and load each of the surround sound channels into a separate track. To do this, I select File→Import, and then select the file "sintel-master-51-l.flac", and that file is loaded into a track in Audacity. I then repeat this for the others, until I have all of them loaded (Figure 2).
Just to keep from having to scroll, I use View→Fit Vertically to compress all of the tracks into the visible window (Figure 3).
You'll notice that the track names are taken from the file names, and they're hard to read because the information that distinguished them is outside the window. I fix this by selecting the pull-down tab on each track, selecting "Name..." and altering it to something shorter to identify each channel (Figure 4). These labels are for me, they don't mean anything to Audacity.
At this point, I've loaded and labeled all my channels, so I now need to export them as a multi-channel FLAC.
Set Audacity to support multi-channel export
First, I have to make sure that Audacity is in the right mode to export multi-channel files. For this, I need to select Edit→Preferences and examine the "Export" tab. Here, I will need to make sure that the radio button for "Use Custom Mix" is set (Figure 5).
Export the file
Now I select File→Export to export the file. I will need to set a filename, optionally enter some metadata to include in the file, and finally I will be given a network diagram window that allows me to set which track will be stored in which numbered channel in the file (Figure 5). You'll note I used the abbreviation "MUX" which stands for "multiplexed" to indicate that all six audio tracks will be encoded in this file.
The convention for multichannel sound in FLAC files is documented in the FLAC format specification, and in the case of 5.1 surround sound it is: Left, Right, Center, LFE, Left Surround, Right Surround
The convention for multichannel sound in FLAC files is documented in the FLAC format specification, and in the case of 5.1 surround sound it is: Left, Right, Center, LFE, Left Surround, Right Surround. Of course, this is the order I loaded the files in, so the default mapping is correct as shown in Figure 5. But of course, I check this against the names I've given for each track to make sure that the order is indeed correct.
Then I click "Save", and I wait for the export to finish. After a few moments, the file will be saved to disk.
And that's it!
Out of curiousity, I tried re-loading the "MUX" file back into a new Audacity session. The behavior is pretty much what you would expect -- the file is divided up into separate tracks, which are represented in Audacity as mono tracks. The track names are derived from the file name, with a number appended to indicate the numerical channel they represent. Thus the "Left" channel is number one (i.e. it is labeled "sintel-master-51-mux 1"), and the "LFE" channel is number four ("sintel-master-51-mux 4").
Loading this file with VLC (VideonLAN Client), I can play it back as expected.
pledged of $19,000 goal
seconds to go
May 4, 2012 - Jun 3, 2012 (30 days)
Pledge $1 or more
Notification of download availability for the software and specification documents.Estimated delivery: Jul 2013
Pledge $10 or more
BACKER CREDIT: In addition to receiving notification of the download, anyone contributing $10 or more will be credited in the distribution notes for the software.Estimated delivery: Jul 2013
Pledge $25 or more
COPY OF THE SOFTWARE: CD-R disk with all of the developed software in a Live-CD Linux so you can play Lib-Ray on most computers with CD-ROM and SD card support. The "Complete Guide to Lib-Ray" book will be provided in PDF format on the disk.Estimated delivery: Jul 2013
Pledge $30 or more
BLENDER FOUNDATION OPEN MOVIE COLLECTION. Lib-Ray edition of the first three open movies created by the Blender Foundation: "Elephants Dream", "Big Buck Bunny", and "Sintel". You get all three films in high-quality 1920x1080 HD video with stereo and 5.1 surround sound, plus as many subtitle tracks as I can locate. This release will be in a compact, lightweight sleeve.Estimated delivery: Jul 2013
Pledge $35 or more
SITA SINGS THE BLUES. Lib-Ray edition of Nina Paley's award-winning feature-length animated film "Sita Sings the Blues" in beautiful 1920x1080 HD video with stereo sound. Some of the proceeds from this Creator Endorsed release will be shared directly with Nina Paley after we make our minimum. This edition will be in a light-weight, compact, eco-friendly sleeve.Estimated delivery: Jul 2013
Pledge $40 or more
BLENDER FOUNDATION OPEN MOVIE COLLECTION (Lib-Ray): Deluxe-packaged Lib-Ray format release of the first three of the Blender Foundation's Open Movies: "Elephants Dream", "Big Buck Bunny", and "Sintel", with extras and subtitles in all of the available languages I can find. The Lib-Ray software and documentation will be provided as an extra on this special edition card. (This is the same package as the mock-up I showed in the video).Estimated delivery: Jul 2013
Pledge $50 or more
SITA SINGS THE BLUES (Lib-Ray): Deluxe packaged Creator-Endorsed Lib-Ray format release of "Sita Sings the Blues" by Nina Paley. Note that this will be the first time this title has been released in a high-definition format. The Lib-Ray software and documentation will be provided as an extra on this special edition card. (This is the same package as the mock-up I showed in the video). After we make our minimum, a portion of the profit from sales of this card will be given to Nina Paley herself.Estimated delivery: Jul 2013
Pledge $50 or more
PRINTED MANUAL: A printed copy of the "Complete Guide to Lib-Ray", a book documenting the specification, tutorials on how to create a Lib-Ray disk "from scratch" as well as by using the developed Lib-Ray mastering wizard software. Plus you will receive the software on disk as well.Estimated delivery: Jul 2013
Pledge $60 or more
BOTH RELEASES (SITA SINGS THE BLUES and the BLENDER OPEN MOVIE COLLECTION) on Lib-Ray: Both "Sita Sings the Blues" and the Blender Foundtion open movies "Elephants Dream", "Big Buck Bunny", and "Sintel". The Lib-Ray software and documentation will be included on these cards.Estimated delivery: Jul 2013
Pledge $80 or more
PRINTED MANUAL and SITA SINGS THE BLUES: "The Complete Guide to Lib-Ray" printed book along with the Lib-Ray format copy of "Sita Sings the Blues" in the compact package.Estimated delivery: Jul 2013
Pledge $85 or more
BOTH RELEASES - DELUXE PACKAGE OPTION ("Sita Sings the Blues" and "Blender Open Movies Collection"). If you would like to get both of the Lib-Ray releases in the deluxe (metal package with 3D-printed plastic card clip and printed insert with liner notes), you can select this option. These will be similar to the mock-ups in the video.Estimated delivery: Jul 2013
Pledge $100 or more
TRY OUT LIB-RAY 4K: Experimental "Lib-Ray 4K" release of the Blender Foundation's "Sintel" Open Movie. This will be in an experimental 4096x2048 pixel format as currently used in digital projection systems. There are only a few home theater systems available at this resolution, and you will need to run the software on a fairly high-end computer to make this work (the hardware player I am offering is not guaranteed to be able to play this disk).Estimated delivery: Jul 2013
Pledge $120 or more
PRINTED MANUAL and BOTH RELEASES: The "Complete Guide to Lib-Ray" printed book along with Lib-Ray format copies of "Sita Sings the Blues" and the Blender Foundation Open Movie Collection.Estimated delivery: Jul 2013
Pledge $200 or more
GOLD SPONSOR: You will receive the printed "Complete Guide to Lib-Ray" book, both Lib-Ray releases ("Sita Sings the Blues" and the Blender Open Movie Collection), and you will be credited as a "Gold Sponsor" in the documentation, book, and distribution credits.Estimated delivery: Jul 2013
Pledge $600 or more
0 backers Limited (100 of 100 left)
PLATINUM SPONSOR: Be listed as a "Platinum Sponsor". Also get your choice of compact or deluxe editions of both "Blender Open Movie Collection" and "Sita Sings the Blues" and the printed manual "Complete Guide to Lib-Ray", with a signed message of thanks from me (all the "PLATINUM" level sponsors will get this -- because I'm really going to be that grateful!).Estimated delivery: Jul 2013
Pledge $750 or more
0 backers Limited (10 of 10 left)
FILMMAKER (MASTERING OF YOUR OWN FILM): Special reward for producers -- I will work with you to produce a Lib-Ray edition of your own film. You will need to provide lossless (or best available) original video, original audio, still images for menus (unless you want me to use frames from your video) and any other extras you want to have on the release. It does NOT have to be a free-licensed release, but I will need to get a statement identifying you as the copyright holder and indemnifying me against claims (I'll provide boilerplate for that). The video content also should not violate any laws or require any special regulatory notices (e.g. no porn films, please).Estimated delivery: Jul 2013
Pledge $1,000 or more
1 backer Limited (19 of 20 left)
PLATINUM SPONSOR / HTPC SYSTEM (PLAYER/COMPUTER): I will build you a Home Theater PC with playback support for Lib-Ray, DVD, and (some?) Blu-Ray disks. The system will be GNU/Linux based and will use one of the existing player distributions for DVD and Blu-Ray playback. Lib-Ray playback will be through the software I develop and will be integrated into the distribution as best I can make it. This player will come in a low-profile HTPC case. The system will be powerful enough to do the decoding in software, so you'll also be able to find other uses for it, such as playing games. You will also receive the "Sita Sings the Blues" and Blender Foundation Open Movie Collection releases and the printed "Complete Guide to Lib-Ray" book, and you will be credited as a "Platinum Sponsor".Estimated delivery: Jul 2013
Pledge $3,000 or more
0 backers Limited (20 of 20 left)
PLATINUM SPONSOR / HTPC SYSTEM PLUS MONITOR AND SOUND SYSTEM: I will build you a complete Home Theater (or private screening) system with the player HTPC, a set of 5.1 surround sound speakers, and a 32" flat-panel LCD 1080P HD TV monitor. You will also receive credit as "Platinum Sponsor" and you will get copies of both "Sita Sings the Blues" and the Blender Foundation Open Movie Collection as well as the printed "Complete Guide to Lib-Ray" book. (Warning: if there are customs regulations or tariffs affecting the import of this product to your country, you will need to be responsible for them. Monitor and speakers may be drop-shipped separately from the supplier to reduce shipping costs).Estimated delivery: Jul 2013
Pledge $5,000 or more
1 backer Limited (2 of 3 left)
CORPORATE SPONSOR: Organizational logo sponsor. Your company's logo will be included prominently in all of the project materials and on the Lib-Ray.org website as a project sponsor. You will also receive up to 10 copies each of the two Lib-Ray releases ("Sita Sings the Blues" and the Blender Foundation Open Movies Collection).Estimated delivery: Jul 2013