1

Is it possible to record playing audio on an Ubuntu 16.04 laptop? I mean part of audio the from a video file or playing music.

As requested in comments:

Output of arecord -l

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: 92HD87B1/3 Analog [92HD87B1/3 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I tried

ffmpeg -f alsa -i hw:0 -t 360 na_re_full.wav

The output was just a blank file (of chosen length) with some random noise. Nothing was recorded from the streaming music :(

$ arecord -L
default
    Playback/recording through the PulseAudio sound server
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
sysdefault:CARD=PCH
    HDA Intel PCH, 92HD87B1/3 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
dmix:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    Direct sample mixing device
dsnoop:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    Direct sample snooping device
hw:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    Direct hardware device without any conversions
plughw:CARD=PCH,DEV=0
    HDA Intel PCH, 92HD87B1/3 Analog
    Hardware device with all software conversions
Zanna
  • 70,465
user227495
  • 4,089
  • 17
  • 56
  • 101
  • https://askubuntu.com/questions/80954/how-can-i-convert-audio-from-mp4-or-flv-video-files-to-mp3possible duplicate of – kenn Dec 09 '17 at 19:35
  • Can be done with FFmpeg, can you give the results of arecord -L? Details are here: https://trac.ffmpeg.org/wiki/Capture/ALSA – andrew.46 Dec 09 '17 at 23:47
  • @kenn what if the playing audio is being streamed ? – user227495 Dec 10 '17 at 03:15
  • @andrew.46 Thank you. Is it possible to get the output as .mp3 ? Updated the post with aredcord -l output – user227495 Dec 10 '17 at 03:16
  • @user227495 Sure is but first to capture any sound at all :). Make the arecord command with the option -L rather than -l. – andrew.46 Dec 10 '17 at 04:14
  • @andrew.46 , updated the original post. :) – user227495 Dec 10 '17 at 04:23
  • @user227495 So perhaps: ffmpeg -f alsa -i sysdefault:CARD=PCH -t 10 out.wav ? – andrew.46 Dec 10 '17 at 05:28
  • @andrew.46 Not working :* I even tried using Audacity with sound card as default , sysdefault, pulse and by manually selecting the card from drop down. All of them gives blank audio with some noise – user227495 Dec 10 '17 at 09:06
  • Finally, found a workaround. Removed headphone and tried recording source as default in Audacity. That worked :) – user227495 Dec 10 '17 at 09:34
  • This sounds like an X-Y Problem. If you want to record streaming media I suggest you rephrase your question to clarify which stream you want to capture to allow solutions that capture it directly rather than record its playback. – David Foerster Dec 10 '17 at 10:46

1 Answers1

3
  1. Use Audacity

  2. Remove any headphones/mic plugged in

  3. Use recording source as default ( if not working, try trial and error )

  4. Click the " Record " button ( a maroon dot )

  5. You can see the GUI listing variations if audio is recording

  6. Start and stop at desired points

  7. Save as Audacity project

  8. Delete unwanted part of the audio

  9. Use File > Save other > Export as mp3 to your desired location

enter image description here

user227495
  • 4,089
  • 17
  • 56
  • 101