<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Documents - terminal</title>
    <subtitle>from Norwegian Centre for Technology, Art and Music</subtitle>
    <link rel="self" type="application/atom+xml" href="https://docs.notam.no/tags/terminal/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://docs.notam.no"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-09-23T00:00:00+00:00</updated>
    <id>https://docs.notam.no/tags/terminal/atom.xml</id>
    <entry xml:lang="en">
        <title>Introspect Audio Files</title>
        <published>2026-09-23T00:00:00+00:00</published>
        <updated>2026-09-23T00:00:00+00:00</updated>
        
        <author>
          <name>
            Niklas Adam (na@notam.no)
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://docs.notam.no/guides/introspect-audio-files/"/>
        <id>https://docs.notam.no/guides/introspect-audio-files/</id>
        
        <content type="html" xml:base="https://docs.notam.no/guides/introspect-audio-files/">&lt;h1 id=&quot;debug-audio-file-issues&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#debug-audio-file-issues&quot; aria-label=&quot;Anchor link for: debug-audio-file-issues&quot;&gt;&lt;i class=&quot;icon&quot;&gt;&lt;/i&gt;&lt;/a&gt;
Debug audio file issues&lt;/h1&gt;
&lt;p&gt;The go-to is ffmpeg (via ffprobe or a decode-to-null pass), since it&#39;ll parse almost any format and complain loudly about anything malformed.&lt;/p&gt;
&lt;p&gt;To check the header and container structure, ffprobe reads the metadata and reports parse errors:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #B392F0);&quot;&gt;ffprobe&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; error&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;show_format&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;show_streams&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; file.wav&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If the header is broken, you&#39;ll see errors like &quot;Invalid data found when processing input&quot; or missing or garbage stream info.&lt;/p&gt;
&lt;p&gt;To check the actual audio data, decode the whole file and throw the output away. This catches corruption in the middle of the file that a header check would miss:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #B392F0);&quot;&gt;ffmpeg&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; error&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; file.flac&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; null&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; -&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No output means it decoded cleanly. Anything printed (e.g. &quot;Header missing&quot;, &quot;invalid frame&quot;, &quot;overread&quot;) points to damage, often with a timestamp.&lt;/p&gt;
&lt;p&gt;There are also some format-specific tools that are more thorough for their format:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;FLAC&lt;/strong&gt;: &lt;code&gt;flac -t file.flac&lt;/code&gt; verifies the embedded MD5 checksum, so it&#39;s close to definitive.&lt;br /&gt;
&lt;strong&gt;WAV/AIFF&lt;/strong&gt; and general: &lt;code&gt;sox --i file.wav&lt;/code&gt; shows header info, and &lt;code&gt;soxi&lt;/code&gt; or &lt;code&gt;sox file.wav -n stat&lt;/code&gt; will choke on bad data.&lt;br /&gt;
&lt;strong&gt;Ogg/Vorbis/Opus&lt;/strong&gt;: &lt;code&gt;ogginfo file.ogg&lt;/code&gt; reports stream and page errors.&lt;br /&gt;
&lt;strong&gt;MP3&lt;/strong&gt;: &lt;code&gt;mp3val file.mp3&lt;/code&gt; finds (and can fix) broken frames and bad headers. mpck (checkmate) is similar.&lt;br /&gt;
&lt;strong&gt;Metadata/tags&lt;/strong&gt;: &lt;code&gt;mediainfo&lt;/code&gt; or &lt;code&gt;exiftool&lt;/code&gt; are good for spotting inconsistent headers, like a stated duration or size that doesn&#39;t match the file.&lt;/p&gt;
&lt;p&gt;For inspecting the raw bytes yourself, xxd file.wav | head lets you eyeball the magic bytes (RIFF/WAVE, ID3, fLaC, OggS, etc.).&lt;/p&gt;
&lt;p&gt;If you just want one tool, &lt;code&gt;ffmpeg -v error -i file -f null -&lt;/code&gt; is the best all-rounder. It&#39;s also easy to loop over a whole folder, e.g.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt;for&lt;/span&gt;&lt;span&gt; f&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; *&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;v&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; do&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; echo&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;f&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span style=&quot;color: light-dark(#6F42C1, #B392F0);&quot;&gt; ffmpeg&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; error&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span&gt;f&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;color: light-dark(#005CC5, #79B8FF);&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; null&lt;/span&gt;&lt;span style=&quot;color: light-dark(#032F62, #9ECBFF);&quot;&gt; -&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span style=&quot;color: light-dark(#D73A49, #F97583);&quot;&gt; done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
</feed>
