<?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>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</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[@edent]]></dc:creator>
		<pubDate>Wed, 15 Jul 2015 21:22:25 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<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><![CDATA[<p><ins datetime="2019-02-04T20:49:45+00:00"><a href="https://shkspr.mobi/blog/2019/02/howto-split-wav-and-cue-files-on-linux/">See this update for a better way to do this.</a></ins></p>

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

<p>I have:</p>

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

<p>I want:</p>

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

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

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

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

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

<p>A typical cue looks like</p>

<pre>  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
...
</pre>

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

<pre>avconv -f dts -i original.wav -ss 00:04:38.014 -t 00:04:0.95 -acodec copy track2.wav</pre>

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

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

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

<pre>cueconvert -i cue -o toc cue.cue cue.toc</pre>

<p>If you open the newly created .toc file, you should see something like:</p>

<pre>FILE "track1.wav" 0 04:38:14
FILE "track2.wav" 04:38:14 04:00:70
FILE "track3" 08:39:09 04:38:57
...
</pre>

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

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

<ol>
    <li>The files aren't tagged / named correctly.</li>
    <li>It's a pain to calculate the timings correctly.</li>
</ol>

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

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

<pre>avconv -i whatever.wav -acodec copy output.mkv</pre>

<p>In some cases, avconv will think your 5.1 recording is stereo. Fix it by forcing the codec it detects.</p>

<pre>avconv -f dts -i whatever.wav -acodec copy output.mkv</pre>

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

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

<pre>CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 01
CHAPTER02=00:05:06.03
CHAPTER02NAME=Chapter 02
CHAPTER03=00:10:12.000
...
</pre>

<p>Save that as <code>chapters.txt</code>.</p>

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

<p>A single command for this one:</p>

<pre>mkvmerge output.mkv --chapters chapters.txt -o withchapters.mkv</pre>

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

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

<pre>mkvmerge withchapters.mkv --split chapters:all -o track.mkv</pre>

<p>You'll now have track-001.mkv, track-002.mkv etc.</p>

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

<p>At this point, we have two moderately annoying problems.</p>

<ol>
    <li>The files aren't tagged / named correctly.</li>
    <li>The DTS audio can't be extracted properly!</li>
</ol>

<p>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.</p>

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

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

<p>Any suggestions for a better way to do this? Stick them in the comments box.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=21171&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></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>
