How to record what the PC is playing?

New to Puppy and have questions? Start here

Moderator: Forum moderators

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: How to record what the PC is playing?

Post by rcrsn51 »

rcrsn51 wrote: Mon Jun 06, 2022 8:06 pm
number77 wrote: Mon Jun 06, 2022 7:00 pm

Yes I would still like to do that.

I have posted alsa-capture v1.2 here. Read the Notes section.

I would recommend that you run this on a temporary clean install of Puppy. At this point, it's hard to know what you might have done with your ALSA system.

No reply from number77.

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?

Post by number77 »

rcrsn51 wrote: Wed Jun 08, 2022 10:52 am
rcrsn51 wrote: Mon Jun 06, 2022 8:06 pm
number77 wrote: Mon Jun 06, 2022 7:00 pm

Yes I would still like to do that.

I have posted alsa-capture v1.2 here. Read the Notes section.

I would recommend that you run this on a temporary clean install of Puppy. At this point, it's hard to know what you might have done with your ALSA system.

No reply from number77.

Thanks rcrsn51
I have downloaded it and am giving it a try.

Its brilliant, worked straight off.
Next thing is to reread and understand posts to see how to record to flac. But quality on the laptop seemed very good.
So simple with alsa-capture v1.3, even for me. Thanks for that

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: How to record what the PC is playing?

Post by rcrsn51 »

number77 wrote: Wed Jun 08, 2022 1:55 pm

worked straight off.

Excellent

Next thing is to reread and understand posts to see how to record to flac.

Go to /usr/local/bin and open the script alsa-capture in a text editor.
Comment out line 34 with a #.
Add the line: ffmpeg -y -hide_banner -f alsa -i Loop /root/alsa-capture.flac

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?

Post by number77 »

rcrsn51 wrote: Wed Jun 08, 2022 3:04 pm
number77 wrote: Wed Jun 08, 2022 1:55 pm

worked straight off.

Excellent

Next thing is to reread and understand posts to see how to record to flac.

Go to /usr/local/bin and open the script alsa-capture in a text editor.
Comment out line 34 with a #.
Add the line: ffmpeg -y -hide_banner -f alsa -i Loop /root/alsa-capture.flac

I am doing something wrong, get error message

/usr/local/bin/alsa-capture: line 35: 13144 Segmentation fault ffmpeg -y -hide_banner -f alsa -i Loop /root/alsa-capture.flac
root# ^C

Any ideas

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: How to record what the PC is playing?

Post by rcrsn51 »

That's probably a problem with your install of ffmpeg. What Puppy are you using?

The nice thing about alsa-capture is that it doesn't rely on other apps.

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?

Post by number77 »

rcrsn51 wrote: Wed Jun 08, 2022 5:00 pm

That's probably a problem with your install of ffmpeg. What Puppy are you using?

The nice thing about alsa-capture is that it doesn't rely on other apps.

I had forgotten you said use clean install, mine is not but I have one on another partition so will try again.
(
root# ffmpeg ver
ffmpeg version 3.3.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.4.0 (Debian 6.4.0-4) 20170820
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[NULL @ 0x4920fc0] Unable to find a suitable output format for 'ver'
ver: Invalid argument
)

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?

Post by number77 »

number77 wrote: Wed Jun 08, 2022 5:11 pm
rcrsn51 wrote: Wed Jun 08, 2022 5:00 pm

That's probably a problem with your install of ffmpeg. What Puppy are you using?

The nice thing about alsa-capture is that it doesn't rely on other apps.

I had forgotten you said use clean install, mine is not but I have one on another partition so will try again.
(
root# ffmpeg ver
ffmpeg version 3.3.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.4.0 (Debian 6.4.0-4) 20170820
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[NULL @ 0x4920fc0] Unable to find a suitable output format for 'ver'
ver: Invalid argument
)
PS xenial64

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: How to record what the PC is playing?

Post by rcrsn51 »

I checked xenia64 and ffmpeg worked OK for me. But here is another way to record to flac without using ffmpeg:

arecord -V mono -f cd -D Loop | flac - -s -f -o /root/alsa-capture.flac

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?

Post by number77 »

rcrsn51 wrote: Wed Jun 08, 2022 6:30 pm

I checked xenia64 and ffmpeg worked OK for me. But here is another way to record to flac without using ffmpeg:

arecord -V mono -f cd -D Loop | flac - -s -f -o /root/alsa-capture.flac

Yes that did the trick so once more thank you.
number77

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: How to record what the PC is playing?

Post by williams2 »

Perhaps you mean ffmpeg -version ?

Your ffmpeg is fmpeg version 3.3.4-static http://johnvansickle.com/ffmpeg/
Your ffmpeg does not seem to have flac support built into the executable.
So ffmpeg is probably trying to use the flac libraries in Puppy,
but they are incompatible with the static build.
Probably the original ffmpeg that came with your Puppy would work properly.

Piping directly to the flac executable is using the flac executable that came with your Puppy,
which is using the library shared object files that also came with your Puppy.

It is the ffmpeg static build which is incompatible and does not work.

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?

Post by number77 »

williams2 wrote: Wed Jun 08, 2022 7:50 pm

Perhaps you mean ffmpeg -version ?

Your ffmpeg is fmpeg version 3.3.4-static http://johnvansickle.com/ffmpeg/
Your ffmpeg does not seem to have flac support built into the executable.
So ffmpeg is probably trying to use the flac libraries in Puppy,
but they are incompatible with the static build.
Probably the original ffmpeg that came with your Puppy would work properly.

Piping directly to the flac executable is using the flac executable that came with your Puppy,
which is using the library shared object files that also came with your Puppy.

It is the ffmpeg static build which is incompatible and does not work.

That explains it. Thank you

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?(Solved)

Post by number77 »

number77 wrote: Thu Jun 02, 2022 4:27 pm

Hello
I would like to record some audio I have playing on the PC in digital quality. Has anyone succeeded or got any advise.
I have asked this a few times and either forgotten, quite possible, or never had any success.
I have a Dell E6230 with Xenial64 and other Puppy OSs, but will try any Puppy that would help.
Help appreciated.
number77

User avatar
fredx181
Posts: 3085
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 375 times
Been thanked: 1314 times
Contact:

Re: How to record what the PC is playing?

Post by fredx181 »

As discussed already, briefly I think, about exact copy a web stream e.g. with mplayer, there's also "streamripper" to rip a web stream, but will not always work, anyway for example ripping from radio paradise;
streamripper "http://www.radioparadise.com/m3u/mp3-192.m3u" -u FreeAmp/2.x -c -o larger -D "$HOME/%S/%1q - %T - %A"
Nice is that it does split the tracks and often includes metadata (tags).

2022-06-09_13-18-09.png
2022-06-09_13-18-09.png (91.36 KiB) Viewed 1217 times
User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: How to record what the PC is playing?

Post by mikewalsh »

williams2 wrote: Wed Jun 08, 2022 7:50 pm

Perhaps you mean ffmpeg -version ?

Your ffmpeg is fmpeg version 3.3.4-static http://johnvansickle.com/ffmpeg/
Your ffmpeg does not seem to have flac support built into the executable.
So ffmpeg is probably trying to use the flac libraries in Puppy,
but they are incompatible with the static build.
Probably the original ffmpeg that came with your Puppy would work properly.

Piping directly to the flac executable is using the flac executable that came with your Puppy,
which is using the library shared object files that also came with your Puppy.

It is the ffmpeg static build which is incompatible and does not work.

Personally, I always found in the past that Puppy's elderly, stripped-back builds of ffmpeg were at the root of all my audio problems. This is why I started using John van Sickle's statically-compiled ffmpeg binaries.....but then, I only ever record in either .mp3 or .wav.

I like audio to sound good, but I wouldn't describe myself as an "audiophile".....hence, not fussed about purity of stream/audio quality.

I'm now using a combination of capture "tools" across the kennels. Bill's "alsa-capture" works beautifully in older Puppies, and since it does work so well, I'm not messing with it. I'll leave this well alone!

I'm also using the .asoundrc file that jamesbond offered up (which makes an "always-on" loopback permanently available), along with ffmpeg, and my own YAD-based simple "recorder" interface in several newer Puppies.

Image

Older Puppies seem to need an "older" build of ffmpeg, and as williams2 has pointed out, here JvS's static builds appear to generate more problems than they solve. For anything from Bionic onwards, the static ffmpeg builds seem to give a definite improvement over the Puppy default as supplied OOTB, so.....swings & roundabouts, I guess.

Whichever setup I'm using, I finally have a usable way of capturing what the default card outputs across the kennels.....after nearly 2½ fruitless & frustrating years of messing about with it. I'd never have dreamt that a relatively new Intel audio chip could give this much hassle when attempting what should be a simple operation, but.....there ya go.

I "tagged-on" to this thread, it's true; for the simple reason that I've started threads about this on the Forum before, but never seemed to get any response.....and this thread appeared to "mean business" as more & more members got involved. I just want to give heartfelt thanks - and a big round of applause! - to everyone who's been involved & helped to get a handle on this issue. Well done, everybody.....and especially to the OP, number77, who started the thread in the first place.

Thanks, everyone. It's hugely appreciated; sound config stuff is one thing I simply cannot get my head round!

Mike. :thumbup: :D

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: How to record what the PC is playing?

Post by rcrsn51 »

FWIW, the instructions for alsa-capture state that you should shut down the source player after each recording to reset its .asoundrc. This is not always true once you understand how alsa-capture works.

For example, if you are recording from a web page, you could leave the browser open and record several clips. By timestamping the output filenames, you could play them back in an audio player while the browser is still running.

User avatar
fredx181
Posts: 3085
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 375 times
Been thanked: 1314 times
Contact:

Re: How to record what the PC is playing?

Post by fredx181 »

rcrsn51 wrote:

By timestamping the output filenames ...

That would be a good improvement IMO if alsa-capture outputs in timestamped filenames, or perhaps in something like alsa-capture(1).mp3, alsa-capture(2).mp3 etc...

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: How to record what the PC is playing?

Post by rcrsn51 »

I have added a note here about how to do this.

User avatar
fredx181
Posts: 3085
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 375 times
Been thanked: 1314 times
Contact:

Re: How to record what the PC is playing?

Post by fredx181 »

@mikewalsh I think that sharing someday your GUI yad powered would be appreciated by me and others, or if you think something like "Mmm.. not quite ready yet" :roll: :D , that' s okay of course.

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: How to record what the PC is playing?

Post by mikewalsh »

fredx181 wrote: Thu Jun 09, 2022 4:55 pm

@mikewalsh I think that sharing someday your GUI yad powered would be appreciated by me and others, or if you think something like "Mmm.. not quite ready yet" :roll: :D , that' s okay of course.

Umm....heh. You'd be disappointed, Fred. It looks more impressive than it really is. I'm sure you've put together better stuff in your sleep!

I wanted to keep it compact, and since I've never got the hang of gtk-dialog I decided that with the style of button I wanted to use, rather than add text beside it I would put the text actually ON the button itself. The --button calls no text, just an image.....plus the command, of course.

An 'undecorated' YAD window; 3 "field" columns with a single 'field' in each, and two simple buttons on the next line down.

The 'Record' button brings up a small 'rxvt' terminal with ffmpeg already running in it. (I pinched this idea from DriveSpeed!) To stop, you just hit 'Q'. I couldn't figure out how to stop ffmpeg neatly, and

Code: Select all

killall ffmpeg

....makes a mess of the recording for some reason. So; no stop button for recording.

The other two use MPlayer to play the recorded track back to check it's OK. The 'Stop Playback' button just uses 'killall' to quit mplayer, which doesn't mind this. (That's if it's a long track, and I don't want to listen to it all the way through.)

MochiMoppel figured-out a way for me to auto-move these tracks into a 'Saved' directory, incrementally numbering them in the process. (That was when Bill suggested time-stamps instead...)

-----------------------------------------------

It's very much a personal set-up, TBH. No doubt others could think of all sorts of extra features they would want to make it a 'proper' music player, but that isn't the idea behind it.

My issue was not having a loopback device to start with. With what we've discussed and tried-out in this thread, I've cobbled-together summat that works for ME.....it wouldn't suit anyone else. And by using jamesbond's "loopback always on" .asoundrc, I can use several other 'recorders' now by simply selecting "mixout" as the source. (For example, Will's original pRecord now works at long last..!)

This was just me playing-around for the hell of it! You're welcome to look at the whole thing if ya want - it's all in one directory - though it DOES require ffmpeg and mplayer to be on the system.

I rather think it'll be too simplistic to be of much interest, TBH.

Mike. ;)

Clarity
Posts: 3842
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1632 times
Been thanked: 525 times

Re: How to record what the PC is playing?

Post by Clarity »

There are 2 threads that I find are excellent on this subject of sound capture and playback. And the various solutions presented are very helpful. @jamesbond presented a step-wise, on another thread, that, too, clearly explains successful approach for audio management.

This post is NOT a solution, but ask a question about the "elephant" in this room: Is this going to be consistent as the world continues to barrel toward Pipewire? For example, @jamesbond's solution allow us to envision a "wire" carrying a stream into a splitter with 2 simultaneous outputs "wired pipes" emerging.

I know its the long game outlook, but certainly could be useful without retrofitting, in the future.

Just a thought. AND, THANKS to EVERYONE for bringing this topic to the forum, thus far. :thumbup:

User avatar
fredx181
Posts: 3085
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 375 times
Been thanked: 1314 times
Contact:

Re: How to record what the PC is playing?

Post by fredx181 »

See here for a 'alsa capture' GUI : viewtopic.php?p=60063#p60063

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: How to record what the PC is playing?

Post by williams2 »

@mikewalsh said:

This is why I started using John van Sickle's statically-compiled ffmpeg binaries

To be clear, what I was trying to say, was

ffmpeg was not working because it was not compiled with builtin flac support.
The static version of ffmpeg does not support flac.
The dynamically linked version of ffmpeg does not support flac.
So I would expect neither version to work with flac.

Often, not always, a segfault error can occur because a shared object library file is not compatible with an executable or with another shared object file.

ffmpeg, if it does not have flac support built in, should fail with an error message, like Error flac not supported It should not segfault. Which made me think maybe ffmpeg was trying to use the flac library files.
Which made me think that the dynamically linked ffmpeg that came with the OS might be more compatible with the flac library files, than the static ffmpeg.

That is,
1) ffmpeg should not segfault, it's a bug if it does.
2) I would expect the static ffmpeg to be less compatible with the flac libraries than the dynamic ffmpeg, which was compiled in the same environment as the rest of the OS files.

What I wrote was not exactly wrong, but it might be a little misleading, which I did not intend.
And is somewhat off topic.
And very few people care about.
But what I wrote originally was slightly misleading, hence this clarification.

User avatar
fredx181
Posts: 3085
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 375 times
Been thanked: 1314 times
Contact:

Re: How to record what the PC is playing?

Post by fredx181 »

williams2 wrote:

The static version of ffmpeg does not support flac

I don't think that's true. I tested ffmpeg version 5.0.1-static https://johnvansickle.com/ffmpeg/ on a very minimal system, without any (lib)flac or libav... codecs installed and converting to flac works well.
Also, btw, tested on a system with all the libav... codecs and the flac libraries installed (so just replaced existing dynamically linked existing ffmpeg with the static), no problems either.

User avatar
rockedge
Site Admin
Posts: 6551
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2757 times
Been thanked: 2627 times
Contact:

Re: How to record what the PC is playing?

Post by rockedge »

I started using static ffmpeg builds some time ago when first working on getting Zoneminder to work on Lucid 5.28 and UPUP Raring 3.9.9.2. I have used them since on and off and also have not had any problems with FLAC conversion or playing using the static versions.

I remember suggesting the use of the static builds in some cases on the oldforum way back in those Lucid Lynx days to beef up audio processing instead of that avconv "replacement" which was awful in many use cases.

User avatar
mikewalsh
Moderator
Posts: 6163
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 795 times
Been thanked: 1983 times

Re: How to record what the PC is playing?

Post by mikewalsh »

I, too, have been using them on & off for the last 4-5 years. It's one of the single biggest improvements that can be made to Tahrpup, for instance.....that avconv is dreadful for most use-cases. Use of the static ffmpeg makes video-editing a completely feasible proposition, all of a sudden..!

Regardless of the video-editor in use, and whether it uses mlt or not, they all devolve onto the installed ffmpeg for a "back-end" when it boils down to it.

(Even Cinelerra, which takes some getting used to and uses a totally different approach to pretty much every other video-editor on the market, has a dedicated button to let the user set ffmpeg as the "primary" encoder OR as the "fallback" device when every other supported method fails to deliver the results you want....)

Mike. ;)

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: How to record what the PC is playing?

Post by williams2 »

I don't think that's true.

You are right, of course.

What I looked at was the configuration options that were used when the ffmpeg was compiled and there was no configuration option enabling flac support. But there doesn't need to be, flac support would be enabled by default, no need to enable it as a configuration option.

But it really should not segfault. Especially a static build, with it's own library .so files built into the executable.

EDIT: PS ffmpeg -codecs shows what codecs are supported.

number77
Posts: 378
Joined: Tue Jul 14, 2020 3:14 pm
Has thanked: 4 times
Been thanked: 12 times

Re: How to record what the PC is playing?

Post by number77 »

Can I take this chance to thank everyone for the massive help given by members. I can now record what I am playing and don't understand the further developments on the thread. But for me it's a good conclusion. I won't mark the thread as solved as it still seems live.
For my point of view, thanks everyone.
number77

Post Reply

Return to “Beginners Help”