<?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>flac &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/flac/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Tue, 18 Mar 2025 09:36:14 +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>flac &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Convert Surround Sound WAV albums to individual opus files]]></title>
		<link>https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/</link>
					<comments>https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 18 Mar 2018 18:38:16 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[flac]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opus]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=29185</guid>

					<description><![CDATA[As ever, notes to myself.  This is a method to take a .wav and .cue and transform it into individual files. In this case, .opus.  Transform to .flac  FLAC is a good intermediary file format, especially for surround sound files.  avconv -i file.wav out.flac  Transform to .opus  An optional step if you want smaller files. Maximum quality for 6 channel audio.  opusenc --bitrate 4096 out.flac…]]></description>
										<content:encoded><![CDATA[<p>As ever, notes to myself.  This is a method to take a <code>.wav</code> and <code>.cue</code> and transform it into individual files. In this case, <code>.opus</code>.</p>

<h3 id="transform-to-flac"><a href="https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/#transform-to-flac">Transform to <code>.flac</code></a></h3>

<p>FLAC is a good intermediary file format, especially for surround sound files.</p>

<p><code>avconv -i file.wav out.flac</code></p>

<h3 id="transform-to-opus"><a href="https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/#transform-to-opus">Transform to <code>.opus</code></a></h3>

<p>An optional step if you want smaller files.
Maximum quality for 6 channel audio.</p>

<p><code>opusenc --bitrate 4096 out.flac out.opus</code></p>

<h3 id="create-an-mkv"><a href="https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/#create-an-mkv">Create an <code>.mkv</code></a></h3>

<p>Add to an MKV with all the chapter information.</p>

<p><code>mkvmerge -o test.mkv --chapters file.cue out.opus</code></p>

<h3 id="split-to-individual-files"><a href="https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/#split-to-individual-files">Split to individual files</a></h3>

<p>Individual MKVs</p>

<p><code>mkvmerge test.mkv --split chapters:all -o track.mkv</code></p>

<h3 id="extract-the-audio"><a href="https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/#extract-the-audio">Extract the Audio</a></h3>

<p>One at a time:</p>

<p><code>mkvextract tracks "track-001.mkv" 0:"individual.opus"</code></p>

<h2 id="all-in-one-bash-script"><a href="https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/#all-in-one-bash-script">All-In-One  bash script</a></h2>

<pre><code class="language-bash">#!/bin/bash
json=$(ffprobe -i "file.mkv" -print_format json -show_chapters -loglevel error)
count=$(echo $json | jq ".chapters | length" )

mkvmerge test.mkv -D -S --split chapters:all -o "%02d.mkv"

COUNTER=1
while [ $COUNTER -le $count ]; do

  printf -v zerotrack "%02d" $COUNTER

  json=$(ffprobe -i "$zerotrack.mkv" -print_format json -show_chapters -loglevel error)
  title=$(echo $json | jq ".chapters[0].tags.title" -r)
  filename="[$zerotrack] $title"

  mkvextract tracks "$zerotrack.mkv" 0:"$filename.opus"
  let COUNTER=COUNTER+1 
done
</code></pre>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=29185&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2018/03/convert-surround-sound-wav-albums-to-individual-opus-files/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
