LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2020, 11:21 AM   #1
rhubarbpieguyguy
LQ Newbie
 
Registered: Jul 2019
Posts: 6

Rep: Reputation: Disabled
Capturing streaming audio to a mp3 file using lame.


I'm attempting to save a short streaming audio clip to an mp3 file. I set Capture with alsamixer to 100% and then used the
Code:
arecord -f cd -t raw | lame -x -r – out.mp3
command.

The resultant mp3 file is 544k and identifies as mp3 using the file command. Unfortunately, playing the file with ffplay or gmplayer produces no sound.
 
Old 06-22-2020, 11:45 AM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
I don't see a source there. So arecord is using the default source. What is the default source?

What are you trying to do? Capture the audio coming through your sound device? Or is this a audio file streamed from the internet?

Give more info. I suspect ffmpeg is what you are going to want to use. Or dump the output from a media player.
 
1 members found this post helpful.
Old 06-23-2020, 08:13 AM   #3
rhubarbpieguyguy
LQ Newbie
 
Registered: Jul 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
Perhaps I don't understand your question. The source is streaming audio. I simply want to capture to a file what I'm hearing through my speaker.

I'm certainly willing to use another method, ffmpeg or other. However, as I mentioned, the arecord command produces am mp3 file.
 
1 members found this post helpful.
Old 06-23-2020, 08:34 AM   #4
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
You want to capture what is coming through your sound hardware.

1st question for you to ask yourself. Does your hardware allow that or is it disabled. Some sound hardware has stream capture disabled. If it does then you'll need to make a virtual sound loopback device. Search LQ for that, it has been answered scores of times.

If your hardware allows that , or you have made a virtual loopback device in your ~/.asoundrc or using pulse.

Then it's simple enough to capture stream coming through sound device.
Example:
Code:
ffmpeg -f alsa -i hw:1,1 -c:a libmp3lame -b:a 32k -vn capture.mp3
 
1 members found this post helpful.
Old 06-24-2020, 02:18 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by rhubarbpieguyguy View Post
The source is streaming audio.
The word "streaming" seams to signify something coming from the network, but apparently you don't mean it like that:
Quote:
I simply want to capture to a file what I'm hearing through my speaker.
If you are using plain ALSA that is not so simple.
Should be easier with pulseaudio or jackaudio.
I hear it's possible with plain ALSA too, but requires the sort of superior knowledge (and temporary shifting of static configuration) I do not posses.

In other words: if it works now, good. please share your solution. If it doesn't, you'll have to ask yourself if you cannot achieve the same thing in a different manner (maybe use Audacity to layer two audio tracks?) or install one of the sound architectures mentioned.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A possible lame Multi media lame thread a_c_g_t Fedora 3 08-07-2007 02:59 PM
Installed LAME, command 'lame' works but lame's not in any program directories! ayteebee Linux - Software 8 05-24-2006 05:48 PM
darkice with lame support can't find lame h2gofast Debian 4 03-17-2006 11:20 AM
capturing streaming audio mohapi Linux - Software 2 10-11-2005 01:53 AM
Software dor capturing streaming audio gonniff Linux - Software 5 09-19-2003 05:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration