LAME MP3 3.101 and 4.0 q0 fix

LAME Encoder Logo

Man, I haven’t used LAME in maybe 2 decades. And so, I had a use case for it again and that lead me down a bit of a rabbit-hole. Ultimately, the short version is, LAME has a bug with CBR recordings where specifying -q0 through -q3 can cause a LOSS of quality!

So, they recommend using -q4 to avoid a quality loss with CBR files (and ABR; VBR is unaffected).

The official bug report is available here: https://sourceforge.net/p/lame/bugs/516/

Based on the information that report, I patched lame in the following way. Only one file was modified, lame.c:

@@ -427,7 +427,11 @@
     case 3:
         if (cfg->noise_shaping == 0)
             cfg->noise_shaping = 1;
+        if (cfg->vbr == vbr_off || cfg->vbr == vbr_abr) {
+            cfg->noise_shaping_amp = 0;
+        } else {
         cfg->noise_shaping_amp = 1;
+        }
         cfg->noise_shaping_stop = 1;
         if (cfg->subblock_gain == -1)
             cfg->subblock_gain = 1;
@@ -440,7 +444,11 @@
             cfg->noise_shaping = 1;
         if (gfc->sv_qnt.substep_shaping == 0)
             gfc->sv_qnt.substep_shaping = 2;
+        if (cfg->vbr == vbr_off || cfg->vbr == vbr_abr) {
+            cfg->noise_shaping_amp = 0;
+        } else {
         cfg->noise_shaping_amp = 1;
+        }
         cfg->noise_shaping_stop = 1;
         if (cfg->subblock_gain == -1)
             cfg->subblock_gain = 1;
@@ -453,7 +461,11 @@
             cfg->noise_shaping = 1;
         if (gfc->sv_qnt.substep_shaping == 0)
             gfc->sv_qnt.substep_shaping = 2;
+        if (cfg->vbr == vbr_off || cfg->vbr == vbr_abr) {
+            cfg->noise_shaping_amp = 0;
+        } else {
         cfg->noise_shaping_amp = 2;
+        }
         cfg->noise_shaping_stop = 1;
         if (cfg->subblock_gain == -1)
             cfg->subblock_gain = 1;
@@ -466,7 +478,11 @@
             cfg->noise_shaping = 1;
         if (gfc->sv_qnt.substep_shaping == 0)
             gfc->sv_qnt.substep_shaping = 2;
+        if (cfg->vbr == vbr_off || cfg->vbr == vbr_abr) {
+            cfg->noise_shaping_amp = 0;
+        } else {
         cfg->noise_shaping_amp = 2;
+        }
         cfg->noise_shaping_stop = 1;
         if (cfg->subblock_gain == -1)
             cfg->subblock_gain = 1;

This allows you to use -q0, -q1, -q2 or -q3 with CBR and still get the rest of the settings that would apply in those cases, without forcing you to use -q4.

It has the benefit of also allowing you to keep using VBR to the highest quality.

Both version 3.101 and 4.0 are included in the zip file. You do not need any DLL files, it is statically compiled which means the DLL files are baked-in to the exe essentially.

Download here: lame-3.101-and-4.0-q0-patched.zip

pfSense WAN 5GbE to AT&T Modem

There’s a few ways to do this, I think the simplest, if you have the PCIE slot room would be to buy an ethernet card that supports 10/5/2.5/1GbE network speed negotiation.

But since I only have one real usable slot in my pfSense machine, and I need 10G for LAN, I opted for a dual-port Mellanox ConnectX-3 SFP card that I purchased off of eBay for $21 USD. An incredible buy. I would definitely recommend putting a fan on the heatsink if you have room, or blowing across the card is even better to help cool the SFP modules themselves. Especially when using ethernet modules, they run hotter than fiber modules.

For the SFP module, I chose a H!Fiber branded module: https://www.amazon.com/dp/B06XQBFHNL

Per the previous guide, I updated my /conf/dhcp6_att.conf to replace interface re0 with interface mlxen1 (by process of elimination or checking ifconfig to determine which slot is which. What the bracket of the card calls port 0 actually was my mlxen1 interface, in this case.

In pfSense, you will see it negotiate as 10Gbase-CX4. The speed of the port does not matter, assuming it supports your standard 1G/10G SFP+ port speeds. The module is what matters. The modules SFP end will interface with the port at 10Gbase-CX4, and the ethernet side of the module will interface with your modem at 5Gbase-T. You’ll have to login to your AT&T modem to confirm the speed of the client (under Device > Device List). Make sure you’re connected to the 5G port on the back of your AT&T BGW320!

As I only pay for the 1G plan, I am at least now able to pull the full speed.

Insanity.

Website Upgrade: Now on Symmetrical Fiber!

The website now runs on symmetrical fiber (1000mbit). This doesn’t really mean anything but hopefully it feels a little snappier now. Much faster than the ~15mbit the site was running on before!

I upgraded from Spectrum cable to AT&T fiber internet. Even though I was paying for 1000/40 from Spectrum, I rarely was able to get above 20mbit for upload.

I can’t believe my last real post was so long ago… I really do want to update some of my guides.

Edit: Whoa, todays date is a palindrome!

WireGuard Guide Update coming!

Today I realized my VPN has been setup kind-of-wrong the last oh… 4 years or so. I’ve just never had a reason to notice as I was always accessing internal things.

So, an updated WireGuard Guide for pfsense 2.7.2 will be forthcoming soon!

I’m also just working on adding some better CSS support to my powershell server status script as well. I will soon get that online.

Update 2025: man, I suck. Sorry all, I just lost motivation for a while. I move on to other projects fairly readily, and I’ve just been so tired. I still plan to do this at some point.

PowerShell on.. a Pi ?!

That’s right! If you didn’t know, powershell is (nearly?) completely cross-platform.

I’ve recently been working on a server status script for work and I chose to do it in powershell. It does threaded pings, generates html files, etc.

With zero modifications at all the script runs flawlessly on both Ubuntu Linux and my Orange Pi. All I had to do was extract the powershell tarball, chmod +x pwsh and run the script.

Truly awesome.

What blew my mind was Powershell was markedly faster on my Pi than it was on my Ubuntu server.

I’ll be posting more about the script soon, as I need to figure out some things still. But it will be released in due time. I really like it!

Edit 7-03-2026: That server status script became much more in depth than I ever planned. I’d still like to learn github better one of these days, and upload projects there.

Revisiting Frigate & Home Assistant

I’ve been revisiting frigate as of late, and using homeassistant for sending notifications to my phone. I wish I could do this without homeassistant…it feels so excessive just to get camera notifications.

Anyway, after months and months of procrastinating I hope to post my frigate portainer config soon, and an overall frigate configuration file that I’m using. I’ll also attempt to cover notifications on a separate post afterwards.

Hope everyone had a Happy Thanksgiving! ?

I.T Bacon is (was, for a while) now ARMed!

…with an Orange-Pi Zero 3! I’ve moved the website to this tiny little device that doesn’t even have a home yet.

A case of sorts is on the way. I did attach a heatsink to the CPU in the above picture, which was not included.

My impressions so far are very positive. I’m running their Ubuntu image and haven’t had any problems. It reboots in several seconds. It runs the website very well.

I even toyed around with building an arm version of q2pro with no problems at all.

Only downsides: USB 2.0 port not 3.0, and SD slot speed. SD speed is maxed around 22-24MB/s. So a high speed card will not make a difference.

Update: Now with a home of its own! This little fan lowered temps by 13+⁰C!

Docker + Portainer + Frigate + Mosquito MQTT…

Update 9-02-2023: I’ve stopped using HomeAssistant as it’s just not for me.

Update 8-01-2023: Ok! I feel fairly confident with everything now. Inititally my plan was to just give some docker run commands that would get everyone up and running quickly. But I have since discovered Stacks in Portainer, and I feel this is a much better method for deploying containers. Especially since it offers an easy way to upgrade them. Truly hope to have something together eventually!

Update 7-18-2023: I’ve managed to get an iPhone, an OBS stream, and my Amcrest camera into frigate using go2rtc as a restream source. Guide is coming along nicely!

…guide will be coming soon. I am slowly learning it all this weekend. I am really enjoying Portainer. I have a camera arriving tomorrow, an Amcrest one, and hope to have everything up and running by next weekend. Then I can begin taking some screenshots for the guide.

The absolute mixture and mess across the internet has made this challenging at best. But I really want to run my own NVR!

Oh yeah, and I’ll include Google Coral AI support as well assuming the card I ordered works in the PC I’m using for frigate. Hoping to make use of the wifi card slot.

I’m using Ubuntu for the base OS. Personally, I enabled auto-login and screen sharing so I can remote desktop in to it. I may switch to just plain VNC later on but this is working well for me at the moment. As I’ve always been a Gentoo Linux guy, learning Ubuntu (well, Gnome) has been interesting too. I haven’t ran a window manager in YEARS!