<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: 노력이부족</title>
    <description>The latest articles on Forem by 노력이부족 (@richard00726).</description>
    <link>https://forem.com/richard00726</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3811338%2Fabe88d74-e16e-41b5-b95c-acef6eec2637.jpg</url>
      <title>Forem: 노력이부족</title>
      <link>https://forem.com/richard00726</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/richard00726"/>
    <language>en</language>
    <item>
      <title>Building a Browser-Based NCM File Converter (NetEase Cloud Music to FLAC/MP3)</title>
      <dc:creator>노력이부족</dc:creator>
      <pubDate>Sat, 07 Mar 2026 09:41:26 +0000</pubDate>
      <link>https://forem.com/richard00726/building-a-browser-based-ncm-file-converter-netease-cloud-music-to-flacmp3-3c38</link>
      <guid>https://forem.com/richard00726/building-a-browser-based-ncm-file-converter-netease-cloud-music-to-flacmp3-3c38</guid>
      <description>&lt;h2&gt;
  
  
  What is NCM?
&lt;/h2&gt;

&lt;p&gt;NCM (&lt;code&gt;.ncm&lt;/code&gt;) is a proprietary encrypted audio format used by &lt;strong&gt;NetEase Cloud Music&lt;/strong&gt; (网易云音乐), one of the largest music streaming platforms in China. Files downloaded for offline use are stored in this format and can't be played by standard music players like VLC or foobar2000.&lt;/p&gt;

&lt;p&gt;I wanted to convert my NCM files to standard FLAC/MP3 without installing any desktop software, so I built a tool that does it entirely in the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Tool
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://nr2bj.github.io/ncm-converter/" rel="noopener noreferrer"&gt;NCM Converter&lt;/a&gt;&lt;/strong&gt; — a free, open-source web app that converts &lt;code&gt;.ncm&lt;/code&gt; files to FLAC or MP3 with album art.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runs 100% in the browser — no files are uploaded to any server&lt;/li&gt;
&lt;li&gt;Preserves original audio quality (lossless FLAC or MP3)&lt;/li&gt;
&lt;li&gt;Automatically embeds high-resolution album cover art&lt;/li&gt;
&lt;li&gt;Supports batch conversion with drag &amp;amp; drop&lt;/li&gt;
&lt;li&gt;Works on desktop and mobile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try it here: &lt;a href="https://nr2bj.github.io/ncm-converter/" rel="noopener noreferrer"&gt;https://nr2bj.github.io/ncm-converter/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;The conversion process has 4 steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Read the NCM Container
&lt;/h3&gt;

&lt;p&gt;NCM files are essentially encrypted containers. The file starts with a magic header (&lt;code&gt;CTENFDAM&lt;/code&gt;), followed by an AES-encrypted key and metadata.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Decrypt with AES
&lt;/h3&gt;

&lt;p&gt;The tool decrypts the file using the AES algorithm in ECB mode. First it decrypts the RC4 key, then uses that key to decrypt the actual audio stream.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// AES decryption of the key material&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;keyData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subtle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AES-ECB&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nx"&gt;coreKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;encryptedKey&lt;/span&gt;
&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All of this runs client-side using the Web Crypto API — nothing leaves your browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Extract Audio
&lt;/h3&gt;

&lt;p&gt;After decryption, the raw audio data is either FLAC or MP3 format. The tool detects the format by checking the file signature (&lt;code&gt;fLaC&lt;/code&gt; for FLAC, &lt;code&gt;ID3&lt;/code&gt; or sync bits for MP3).&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Embed Metadata
&lt;/h3&gt;

&lt;p&gt;The tool fetches album artwork from the NetEase API and embeds it along with title, artist, and album info directly into the output file using proper FLAC metadata blocks or ID3v2 tags.&lt;/p&gt;

&lt;h2&gt;
  
  
  Privacy
&lt;/h2&gt;

&lt;p&gt;Since everything runs in the browser using JavaScript, your music files never leave your device. There's no backend server processing — it's purely client-side decryption and conversion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source Code
&lt;/h2&gt;

&lt;p&gt;The project is open source on GitHub:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/NR2BJ/ncm-converter" rel="noopener noreferrer"&gt;github.com/NR2BJ/ncm-converter&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There's also a Python CLI version for batch converting files locally.&lt;/p&gt;

&lt;p&gt;Feedback and contributions are welcome!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
