Fix MP3 output corruption#499
Conversation
|
When I built RTLSDR_Airband some time ago I cloned the repo and built it on my R-Pi. My git/github knowledge is limited so I could use a hint on how to get this version for testing, which I'm happy to do. Thanks/Chris. |
If you have the gh pr checkout 499Otherwise, you'll want to do something using just git remote add gabeschine https://github.com/gabeschine/RTLSDR-Airband.git
git fetch gabeschine
git checkout gabeschine/gs/fix-lame-usage^ (untested by me but should work) |
|
Getting this error when I try to build.
CMake Error at CMakeLists.txt:13 (message):
Failed to detect RTL_AIRBAND_VERSION - "did not find a git root directory
at /home/pi/.git and failed to extract a version from pi"
Thanks,
Chris
From: Gabe Schine ***@***.***>
Sent: February 27, 2025 4:00 PM
To: charlie-foxtrot/RTLSDR-Airband ***@***.***>
Cc: Chris Sullivan ***@***.***>; Comment ***@***.***>
Subject: Re: [charlie-foxtrot/RTLSDR-Airband] Fix MP3 output corruption (PR #499)
When I built RTLSDR_Airband some time ago I cloned the repo and built it on my R-Pi. My git/github knowledge is limited so I could use a hint on how to get this version for testing, which I'm happy to do. Thanks/Chris.
If you have the gh command line utility installed, the fastest thing would be:
gh pr checkout 499
Otherwise, you'll want to do something using just git:
git remote add gabeschine https://github.com/gabeschine/RTLSDR-Airband.git
git fetch gabeschine
git checkout gabeschine/gs/fix-lame-usage
^ (untested by me but should work)
—
Reply to this email directly, view it on GitHub<#499 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGMOZXHRKAHTC4DNQFGOOU32R54GXAVCNFSM6AAAAABYAPN4YSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBZGEYDANJVGY>.
You are receiving this because you commented.Message ID: ***@***.***>
[Image removed by sender. gabeschine]gabeschine left a comment (rtl-airband/RTLSDR-Airband#499)<#499 (comment)>
When I built RTLSDR_Airband some time ago I cloned the repo and built it on my R-Pi. My git/github knowledge is limited so I could use a hint on how to get this version for testing, which I'm happy to do. Thanks/Chris.
If you have the gh command line utility installed, the fastest thing would be:
gh pr checkout 499
Otherwise, you'll want to do something using just git:
git remote add gabeschine https://github.com/gabeschine/RTLSDR-Airband.git
git fetch gabeschine
git checkout gabeschine/gs/fix-lame-usage
^ (untested by me but should work)
—
Reply to this email directly, view it on GitHub<#499 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGMOZXHRKAHTC4DNQFGOOU32R54GXAVCNFSM6AAAAABYAPN4YSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBZGEYDANJVGY>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Ah, I just encountered this as well. Pushed a fix to the branch - can you make sure you have commit ed8b648? |
|
Yes. I have that as the HEAD, but I still have the same problem. |
Ok I'm not sure exactly what's going on. You might have to take a look at |
v3.2.1-176-ged8b648 I ran into this same error as @SullivanChrisJ $cmake -DPLATFORM=rpiv2 -DNFM=ON -DPULSEAUDIO=OFF ../ |
|
I got it working. Change CMakeLists.txt to: execute_process( Change the ./scripts/find_version back to -d if [ -d "${PROJECT_GIT_DIR_PATH}" ] ; then She builds, am running, and mp3 seems to be working better, will test it more tomorrow. |
…and into gs/fix-lame-usage * 'gs/fix-lame-usage' of github.com:gabeschine/RTLSDR-Airband: teach scripts/find_version to work in git submodule
|
🤦
I didn't need to do this - not sure what problem it's addressing yet. LMK if you have thoughts.
I feel silly: |
|
It's going to be a while before I can test. It builds all right on a Pi 4, but the Pi 4 I use for production developed a fault some time ago which is causing (TL;DR in December the Pi Micro-SD went read-only. The system build is quite detailed and file protections are very tricky because other airband systems upload to it so I cloned the Micro-SD onto a M.2 NVME and ran the system from USB SSD, with recordings going to USB HDD. All seemed fine until I tried to compile some code and gcc segfaulted. I found that gcc itself is not corrupt by replacing it, but one of its dependencies must have been damaged along the way, so I need to rebuild from scratch, which is a considerable effort). It's a good idea in any case. |
|
I ran the executable directly and got this error: Configuration file is below (renamed to .txt from .conf in order to upload it). |
What's your |
|
Yes of course. Insufficient coffee. Thanks. Running now. |
|
It ran all day yesterday and collected 1216 mp3 files. All processed successfully except 1, which faulted with the error: after the call to Most of the errors came from calls to Chris |
|
I am running this on my feed now, and so far its been great, no crashes. Making progress taking the mp3 stream and converting to text with whisper.cpp. The MP3 files being correct really helps things. |
|
Today I noticed a problem when trying to read some recordings with If you know of a good mp3 analysis tool I'd be happy to try it. The ones I've tried just look at the id3 headers. 50.76 is the number of seconds I expected in the file. At this point, I will probably use pyav and if it raises the error I saw earlier will then punt to libsoundfile. If needed, here is the definition of the pyav function. |
I'm not familiar with the analysis you performed. That said, VBR is turned on for mp3 outputs (see Line 156 in 4845a52 That said, it might simplify things - or avoid issues - to turn VBR off. Something to consider. |
|
Both examples (soundfile and pyav) are used to decode the mp3. The recording has a sample rate of 8000. As it is decode from mp3 to audio, the VBR shouldn't matter, and the output sample rate is fixed at 8000, both would normally (and usually do) result in an output (variables 'audio' and 'a' respectively) of the same number of samples. In the above I divided by 8000 to get the time in seconds and they are vastly different. My application is take mp3 recordings of a repeater output, and cf32 recordings of anything I pick up on the repeater input, demodulate the latter and put them into a single wave file for a day's recordings, slewing when there are long periods of silence and creating markers so I can see the time-of-day and other information about the recording. There are other receivers which also provide cf32 files if they happen to pick up the signal. Yesterday there were 504 cf32 and 734 mp3 files recorded. I noticed that a significant number of the mp3 recordings were truncated, and while investigated I noticed the discrepancy in the output of the 2 libraries, and that libsoundfile doesn't seem to be reading the file correctly 100% of the time. I don't know what is to blame, although both pyav and libsoundfile are widely used. All I know is it is a discrepancy, and something isn't right somewhere. If I find out I'll create another issue, I guess. At this point I have a workaround but I'll do more checking if I run into any more problems. Cheers, |
|
Of course, you're looking at sample rate against the # of samples. My brain substituted file size. Please do continue investigating. If there's another issue here, I'd like to know about it. Thanks for your testing and your time. |
|
No problem. Thank you so much for fixing the the lame issue. It has has vastly improved the integrity of my project. My kluge of using pyav first then libsoundfile has worked around the truncation problem with libsoundfile and the container problem with pyav. Great that your work has been merged into the charlie-foxtrot repo. The results are already paying dividends for locating interference on our repeater system. |
I commented this out to get to CBR, and it seems like VLC and other players start faster, and generally work better. Two other things I have done to help with the sound quality of voice:
lame_set_quality = 2 is better clarity, and the nspsytune enables speech optimizations, the default is tuned for music.LAME uses two psychoacoustic models: GPSYCHO (default) and NSPSY (noise-shaping, activated by --nspsytune). These models analyze the input audio to decide which parts can be discarded or compressed more aggressively without noticeable loss in perceived quality. |
commit 21a8caf Author: charlie-foxtrot <13514783+charlie-foxtrot@users.noreply.github.com> Date: Sun Mar 9 23:24:57 2025 -0700 URL and License updates (rtl-airband#503) * Pull in GPLv2 from https://github.com/microtony/RTLSDR-Airband/ * Update repo URLs * make this a #minor release commit 4845a52 Merge: e7cd0ec 2adbdca Author: Gabe Schine <gabeschine@users.noreply.github.com> Date: Sun Mar 9 13:40:48 2025 -0400 Merge pull request rtl-airband#499 from gabeschine/gs/fix-lame-usage Fix MP3 output corruption commit 2adbdca Author: gabeschine <gabe@schine.net> Date: Sun Mar 9 05:02:17 2025 -0700 try PLATFORM=native commit 902e2c3 Author: gabeschine <gabe@schine.net> Date: Sun Mar 9 04:50:26 2025 -0700 attempt compile flags for rpiv2 on ubuntu-arm commit 9ddf1c0 Author: gabeschine <gabe@schine.net> Date: Sat Mar 8 17:24:24 2025 -0800 fix arm ubuntu version 20.04 -> 22.04 commit 8fae41e Author: gabeschine <gabe@schine.net> Date: Sat Mar 8 12:32:59 2025 -0800 add macos-14 (arm/m1) os to ci_build.yml commit 2557c6d Author: gabeschine <gabe@schine.net> Date: Sat Mar 8 12:30:59 2025 -0800 run platform_build.yml on ubuntu-20.04-arm instead of rpi3b (not available) commit 3df33db Author: gabeschine <gabe@schine.net> Date: Sat Mar 8 12:30:41 2025 -0800 also run ci_build.yml on ubuntu-arm64 commit d40f357 Author: gabeschine <gabe@schine.net> Date: Sat Mar 8 12:21:37 2025 -0800 fix ci: remove unavailable macos-12 runner from matrix commit 8917d0e Merge: bd22b29 ed8b648 Author: gabeschine <gabe@schine.net> Date: Sun Mar 2 06:23:30 2025 -0800 Merge branch 'gs/fix-lame-usage' of github.com:gabeschine/RTLSDR-Airband into gs/fix-lame-usage * 'gs/fix-lame-usage' of github.com:gabeschine/RTLSDR-Airband: teach scripts/find_version to work in git submodule commit bd22b29 Author: gabeschine <gabe@schine.net> Date: Sun Mar 2 06:22:42 2025 -0800 scripts/find_version: use readable check instead of file-specific check commit ed8b648 Author: gabeschine <gabe@schine.net> Date: Thu Feb 27 15:48:16 2025 -0500 teach scripts/find_version to work in git submodule commit 4306311 Author: gabeschine <gabe@schine.net> Date: Wed Feb 26 07:44:01 2025 -0800 associate lame_t with outputs, not channels commit 309b7be Author: gabeschine <gabe@schine.net> Date: Tue Feb 25 12:49:09 2025 -0800 write lametag to MP3 files commit ef10d9d Author: gabeschine <gabe@schine.net> Date: Tue Feb 25 10:32:28 2025 -0800 fix .devcontainer: install pre-commit using apt
Overview
This PR fixes issue #410, specifically two issues identified with MP3 outputs:
Details
lame_tinstance lifecycle with outputs, instead of channels. Every MP3 output now has its own MP3 encoding context.Testing