<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>dts &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/dts/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Tue, 15 Jul 2025 08:01:16 +0000</lastBuildDate>
	<language>en-GB</language>
	<copyright>© Terence Eden. 🄯 CC BY-SA. See https://shkspr.mobi/blog/copyright-and-copyleft/</copyright>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>dts &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Splitting a Surround Sound Audio File in Ubuntu]]></title>
		<link>https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/</link>
					<comments>https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#respond</comments>
				<dc:creator><![CDATA[Terence Eden]]></dc:creator>
		<pubDate>Wed, 15 Jul 2015 21:22:25 +0000</pubDate>
		<category><![CDATA[audio]]></category><category><![CDATA[avconv]]></category><category><![CDATA[dts]]></category><category><![CDATA[linux]]></category><category><![CDATA[surround sound]]></category>		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=21171</guid>

					<description><![CDATA[See this update for a better way to do this.  Being mostly notes to myself and following on from my post on Quadrophonic files.  I have:       A DTS album stored as a .WAV     A .cue file with chapter markings   I want:       The single large file to be split into individual chapters with one file per chapter.     Each file to be multitrack (that is, to stay in surround sound)   It turns out,…]]></description>
										<content:encoded>&lt;p&gt;&lt;ins datetime="2019-02-04T20:49:45+00:00"&gt;&lt;a href="https://shkspr.mobi/blog/2019/02/howto-split-wav-and-cue-files-on-linux/"&gt;See this update for a better way to do this.&lt;/a&gt;&lt;/ins&gt;&lt;/p&gt;

&lt;p&gt;Being mostly notes to myself and following on from &lt;a href="https://shkspr.mobi/blog/2014/08/dealing-with-quadrophonic-dvd-a-files-in-linux/"&gt;my post on Quadrophonic files&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;A &lt;a href="https://web.archive.org/web/20150708071611/https://diatonis.com/surround_sound_music.html"&gt;DTS album stored as a .WAV&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;A .cue file with chapter markings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I want:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;The single large file to be split into individual chapters with one file per chapter.&lt;/li&gt;
    &lt;li&gt;Each file to be multitrack (that is, to stay in surround sound)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It turns out, that there is no simple way to do this.  There are tools to &lt;a href="https://bytebin.wordpress.com/2009/11/20/split-flac-by-cue-file-in-linux/"&gt;split &lt;em&gt;stereo&lt;/em&gt; wav files by their cue sheet&lt;/a&gt;, but nothing for 5.1 files.&lt;/p&gt;

&lt;p&gt;So, here's how I did it.  This process uses &lt;a href="https://www.bunkus.org/videotools/mkvtoolnix/downloads.html"&gt;mkvtools&lt;/a&gt; and &lt;a href="https://stackoverflow.com/questions/9477115/what-are-the-differences-and-similarities-between-ffmpeg-libav-and-avconv"&gt;avconv&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id="the-easy-but-fairly-manual-way"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#the-easy-but-fairly-manual-way"&gt;The Easy (But Fairly Manual) Way!&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;I can't find an automated way to do this from a cuesheet - so here's what you need to do.&lt;/p&gt;

&lt;p&gt;A typical cue looks like&lt;/p&gt;

&lt;pre&gt;  TRACK 01 AUDIO
    TITLE "Alice"
    PERFORMER "Bob"
    INDEX 01 00:00:00
  TRACK 02 AUDIO
    TITLE "Carol"
    PERFORMER "Bob"
    INDEX 01 04:38:14
  TRACK 03 AUDIO
    TITLE "Dolly"
    PERFORMER "Bob"
    INDEX 01 08:39:09
...
&lt;/pre&gt;

&lt;p&gt;Track 2 starts at 4 minutes, 38.14 seconds into the file.  It finishes at (8m 39.09s - 4m 38.14s) = 4m 0.95s.&lt;/p&gt;

&lt;pre&gt;avconv -f dts -i original.wav -ss 00:04:38.014 -t 00:04:0.95 -acodec copy track2.wav&lt;/pre&gt;

&lt;p&gt;That is, avconv forced to use DTS, starting at 4.38.014 and finishing after 4m .95s, copying the codec into a new file.&lt;/p&gt;

&lt;h2 id="calculating-offsets"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#calculating-offsets"&gt;Calculating Offsets&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;It's hard to manually calculate all the timings.  One quick(ish) way to get them is by using &lt;code&gt;&lt;a href="http://manpages.ubuntu.com/manpages/quantal/man1/cueconvert.1.html"&gt;cueconvert&lt;/a&gt;&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;cueconvert -i cue -o toc cue.cue cue.toc&lt;/pre&gt;

&lt;p&gt;If you open the newly created .toc file, you should see something like:&lt;/p&gt;

&lt;pre&gt;FILE "track1.wav" 0 04:38:14
FILE "track2.wav" 04:38:14 04:00:70
FILE "track3" 08:39:09 04:38:57
...
&lt;/pre&gt;

&lt;p&gt;You can then use those timings as your -ss and -t values - remember to add the extra leading "00:".&lt;/p&gt;

&lt;h2 id="limitations"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#limitations"&gt;Limitations&lt;/a&gt;&lt;/h2&gt;

&lt;ol&gt;
    &lt;li&gt;The files aren't tagged / named correctly.&lt;/li&gt;
    &lt;li&gt;It's a pain to calculate the timings correctly.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id="the-hard-but-somewhat-automated-way"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#the-hard-but-somewhat-automated-way"&gt;The Hard (But Somewhat Automated) Way!&lt;/a&gt;&lt;/h2&gt;

&lt;h2 id="convert-the-wav-to-mkv"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#convert-the-wav-to-mkv"&gt;Convert the .WAV to .MKV&lt;/a&gt;&lt;/h2&gt;

&lt;pre&gt;avconv -i whatever.wav -acodec copy output.mkv&lt;/pre&gt;

&lt;p&gt;In some cases, avconv will think your 5.1 recording is stereo. Fix it by forcing the codec it detects.&lt;/p&gt;

&lt;pre&gt;avconv -f dts -i whatever.wav -acodec copy output.mkv&lt;/pre&gt;

&lt;h2 id="create-a-chapters-file"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#create-a-chapters-file"&gt;Create a Chapters File&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;MKVmerge require a &lt;a href="http://savvyadmin.com/adding-chapters-to-videos-using-mkv-containers/"&gt;specific format of chapter file&lt;/a&gt; which is different from a normal .cue file.  Creating this will be a manual process.&lt;/p&gt;

&lt;pre&gt;CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 01
CHAPTER02=00:05:06.03
CHAPTER02NAME=Chapter 02
CHAPTER03=00:10:12.000
...
&lt;/pre&gt;

&lt;p&gt;Save that as &lt;code&gt;chapters.txt&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id="add-the-chapters-to-the-mkv"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#add-the-chapters-to-the-mkv"&gt;Add The Chapters to the .MKV&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;A single command for this one:&lt;/p&gt;

&lt;pre&gt;mkvmerge output.mkv --chapters chapters.txt -o withchapters.mkv&lt;/pre&gt;

&lt;h2 id="split-the-mkv"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#split-the-mkv"&gt;Split The MKV&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;There are &lt;a href="http://superuser.com/questions/795373/split-mkv-based-on-chapters"&gt;a couple of ways to do this&lt;/a&gt;, I use:&lt;/p&gt;

&lt;pre&gt;mkvmerge withchapters.mkv --split chapters:all -o track.mkv&lt;/pre&gt;

&lt;p&gt;You'll now have track-001.mkv, track-002.mkv etc.&lt;/p&gt;

&lt;h2 id="limitations"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#limitations"&gt;Limitations&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;At this point, we have two moderately annoying problems.&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt;The files aren't tagged / named correctly.&lt;/li&gt;
    &lt;li&gt;The DTS audio can't be extracted properly!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That last one is rather a showstopper!  For some reason, the .MKV files play back their audio properly.  When trying to extract or convert it, all sorts of stream errors occur.&lt;/p&gt;

&lt;h2 id="todo"&gt;&lt;a href="https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/#todo"&gt;TODO&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Either write a patch for avconv to get it to split by .cue - or write a small Python script to do everything automagically!&lt;/p&gt;

&lt;p&gt;Any suggestions for a better way to do this? Stick them in the comments box.&lt;/p&gt;
&lt;img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=21171&amp;amp;HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager"&gt;</content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2015/07/splitting-a-surround-sound-audio-file-in-ubuntu/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
