Audio and video questions

Russell Bateman
March 2014
last update:

Tools
  • guvcview
  • pavucontrol
  • package libuvc0
  • cheese

Sound-card connector color codes:
Color Purpose
Line-out, Front speakers, Headphones
Microphone
Stereo line-in
Subwoofer- and Center-out
Rear surround speakers for 5.1 and 7.1
Middle surround speakers for 7.1
Midi/Game port (Joystick)

Audacious audio—listening to music on Linux

I'm running Mint 13 LTS (Ubuntu 12.04 LTS) on a Lenovo ThinkPad with 4 Gb of memory and 240Gb SSD drive.

Of all the audio players I've tried, Audacious is a) the one that actually works and b) close to the behavior of (and even better than) WinAmp. I don't care about skins (and WinAmp had a lot of great skins), but I love the playlist functionality of Audacious which is even more straight-forward than WinAmp. Audacious offers a more natural interface than Banshee, Rhythmbox, or the M Players (GNOME MPlayer, plain old mplayer, etc.).

$ sudo apt-get install audacious

(Note: if on Fedora, yum install audacious will leave you missing very important plug-ins such as for MP3. Use also yum install audacious-plugins-freeworld.)

I got myself into a situation where Audacious Player audio no longer worked. I was able to hear output from jt.france2.fr on-line journals after unplugging my headphones (so, the sound coming from notebook speakers), but not Audacious, which had been working.

Video difficulties

This possibly happened after having trouble removing my notebook computer from its dock to use with a projector. I had various problems with monitor settings that I ultimately had to resolve by only using the following procedure:

  1. Determine that I need to go remote with my notebook.
  2. Close up all browsers windows carefully to ensure that when reopened, I get the content (pages) I want.
  3. Close up all other applications.
  4. Shut down Mint.
  5. Remove from dock, then use remotely as desired. It starts on notebook monitor, with projector, etc.
  6. Shut down when ready to return to office and dock.
  7. Reinsert into dock and start normally. Big monitors will work.

Note that I use ThinkPad notebook at work with two Hewlett-Packard 24" (1920×1200) monitors run from a simple dock. I need to take it remote to conference rooms and other settings, mostly for doing code reviews. I've never liked doing this because of the mess I'm left with having to switch from the notebook monitor/projector back to my dual monitor set-up.

Equalization...

...for example, go to Output → Equalizer..., click on Enable, then fiddle with what you want, the audio output will betray the settings as you make them. Last, click the Close button.

Audio continued...

The symptoms were basically that my wireless headphones would not work.

I Googled around; there wasn't much. Questions on Audacious no longer outputing sound were few and successes were not much explained, but this link made a cryptic reference to something called pavucontrol. I did this:

~ $ pavucontrol
The program 'pavucontrol' is currently not installed.  You can install it by typing:
sudo apt-get install pavucontrol
~ $ sudo apt-get install pavucontrol
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  pavucontrol
0 upgraded, 1 newly installed, 0 to remove and 31 not upgraded.
...
~ $ which pavucontrol
/usr/bin/pavucontrol
~ $ pavucontrol &

Running pavucontrol, I saw this:

I looked around through all the tabs and options, but in the end audio began working again when I changed the Audacious control from "High Definition Audio Controller Digital Stereo (HDMI)" to "Built-in Audio Analog Stereo" as shown here:


pavucontrol settings

pavucontrol installs in whatever language is current (Cinnamon). If you were playing with languages and don't like the one it was installed with, uninstall, then reinstall it.

Here are pictures of my settings while working:


Translating WMA to MP3...

I found a blog post detailing how to convert Windows Media files (WMA) to MP3. I have an audio book of Tolkien's Silmarillion and I haven't been able to listen to it in my car. Here's a script—the for loops of which I mostly plagierized directly from that post. You need mplayer and lame on your host.

wma2mp3.sh:
#!/bin/bash
# Verify that mplayer and lame are there...
exists=`which mplayer`
if [ $? -ne 0 ]; then
  echo "mplayer is not found on this system!"
  exit -1
fi
exists=`which lame`
if [ $? -ne 0 ]; then
  echo "lame is not found on this system!"
  exit -1
fi

current_directory=$(pwd)

# Remove spaces from filenames to make this easier...
for i in *.wma; do
  mv "$i" `echo $i | tr ' ' '_'`
done

# Rip with mplayer, encode with lame...
for i in *.wma ; do
  mplayer -vo null              \
        -vc dummy             \
        -af resample=44100    \
        -ao pcm:waveheader $i \
        && lame -m s audiodump.wav -o $i
done

# Convert file names to .mp3...
for i in *.wma; do
  mv "$i" "`basename "$i" .wma`.mp3"
done

# Add spaces back into original names (if there were spaces)...
for i in *.mp3; do
  mv "$i" "`echo "$i" | tr '_' ' '`"
done

rm audiodump.wav

It runs like this:

~/Music/J.R.R. Tolkien/Silmarillion.MP3 $ wma2mp3.sh
LAME 3.99.3 64bits (http://lame.sf.net)
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding audiodump.wav to Silmarillion_V1D1-01-Ainulindalë_1.wma
Encoding as 44.1 kHz stereo MPEG-1 Layer III (11x) 128 kbps qval=3
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
 11717/11717 (100%)|    0:08/    0:08|    0:08/    0:08|   35.222x|    0:00
-----------------------------------------------------------------------------------------------------------
   kbps        LR  %     long switch short %
  128.0      100.0        92.2   4.1   3.7
Writing LAME Tag...done
ReplayGain: 0.0dB
MPlayer2 UNKNOWN (C) 2000-2011 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing Silmarillion_V1D1-02-Ainulindalë_2.wma.
Detected file format: ASF format (libavformat)
[lavf] stream 0: audio (wmav2), -aid 0, -alang eng
Clip info:
 WMFSDKVersion: 9.00.00.2980
 WMFSDKNeeded: 0.0.0.0000
 IsVBR: 0
 album: Silmarillion V1D1
 WM/Year: 1977
 genre: Book
 track: 2
 WM/AlbumCoverURL: http://www.albumcoverurl.com
 WM/MCDI: 10+96+5A38+A5F6+F0F0+14C7D+1A19A+1F9D5+217B7+27012+2C40C+32E23+37502+3B171+40F87+464BA+4B0B0+4E6C7
 title: Ainulindalë 2
 artist: J.R.R. Tolkien
Load subtitles in .
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 64.0 kbit/4.54% (ratio: 8000->176400)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
[AO PCM] File: audiodump.wav (WAVE)
PCM: Samplerate: 44100 Hz   Channels: 2   Format: s16le
[AO PCM] Info: Faster dumping is achieved with -novideo
[AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).
AO: [pcm] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 258.6 (04:18.5) of 258.5 (04:18.5)  0.1%


Exiting... (End of file)

What is the "digital copy" disk on the DVD set?

A question about DVD/Blu-ray packaging answered by my nephew.

"What is the 'digital copy' disk on the DVD set of, for exmaple, Narnia: The Voyage of the Dawn Treader'? In this set, there are two disks, the DVD and this second disk I've never paid attention to.

"Should this disk simply contain what I would otherwise be ripping using Handbrake?"

Answer

"The set contains a file, probably in .m4a or .wmv format, and of the movie in DVD quality. Theoretically, you can stick it in your computer and have an instant digital copy of the movie. In reality, the file requires you to sign in, sign up, sign away your firstborn, and then it'll let you download the file—a file with so much DRM on it that almost nothing on this planet can play it.

"It's not really worth trying to get their files to work. It's better just to rip it yourself from the original DVD. I suppose you could use a program in Linux to remove the DRM. That is possible, and I know it works for music (transferring iTunes files over to other players once required a Linux method that stripped out the DRM so the music could be played.)

"You can always try throwing the disc into your drive and see what they have to offer, but I've never had a good experience with those digital copies."


Linux audio-video support issues

This is being done on Ubuntu Lucid. Ubuntu's done a very good job; none of this is anything like difficult.

Microphone

First, for the microphone:

  1. Plug microphone into pink port on back.
  2. Launch Sound Preferences.
  3. Choose Input tab.
  4. Choose Microphone 1.

    You should see an input level representation vary as you make noise.

    Test also using Skype Options -> Sound Devices -> Make a test call.

Things to try when microphone doesn't work:

Video camera

I'm using an inexpensive Philips camera plugged into a USB port. I verified that it was actually working by installing cheese which extorts a simple video stream from it (if it's working):

    ~ $ sudo apt-get install cheese
    [sudo] password for russ:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      nspluginwrapper visualvm
    Use 'apt-get autoremove' to remove them.
    The following extra packages will be installed:
      cheese-common libcheese-gtk18
    The following NEW packages will be installed:
      cheese cheese-common libcheese-gtk18
    0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
    Need to get 2,470kB of archives.
    After this operation, 8,069kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main cheese-common 2.30.1-0ubuntu2 [2,329kB]
    Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main libcheese-gtk18 2.30.1-0ubuntu2 [71.2kB]
    Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main cheese 2.30.1-0ubuntu2 [69.9kB]
    Fetched 2,470kB in 1s (2,038kB/s)
    Selecting previously deselected package cheese-common.
    (Reading database ... 591034 files and directories currently installed.)
    Unpacking cheese-common (from .../cheese-common_2.30.1-0ubuntu2_all.deb) ...
    Selecting previously deselected package libcheese-gtk18.
    Unpacking libcheese-gtk18 (from .../libcheese-gtk18_2.30.1-0ubuntu2_amd64.deb) ...
    Selecting previously deselected package cheese.
    Unpacking cheese (from .../cheese_2.30.1-0ubuntu2_amd64.deb) ...
    Processing triggers for hicolor-icon-theme ...
    Processing triggers for man-db ...
    Processing triggers for desktop-file-utils ...
    Processing triggers for python-gmenu ...
    Rebuilding /usr/share/applications/desktop.en_US.utf8.cache...
    Processing triggers for python-support ...
    Setting up cheese-common (2.30.1-0ubuntu2) ...

    Setting up libcheese-gtk18 (2.30.1-0ubuntu2) ...

    Setting up cheese (2.30.1-0ubuntu2) ...
    Processing triggers for libc-bin ...
    ldconfig deferred processing now taking place
    ~ $ which cheese
    /usr/bin/cheese
    ~ $ cheese &

Skype camera support

Skype is 32-bit only. Therefore, on 64-bit Linux, when you attempt to correct a missing library it needs (that you found out about Googling) like this, one of...

    $ LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype
    $ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype

...you get the error:

ERROR: ld.so: object '/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.

The solution to this is pretty simple. First, it's the first of the two above you want because Skype is 32-bit. (Some of the responses out there might leave you wondering about which.) Second, you just have to install the ia1386 libraries:

~ # apt-get install ia32-libs

After that, as long as you launch Skype with this preload, you'll get the camera in working order. Note, however, that you do not have to keep launching Skype thus. Once you've done this, it will find the library the next time.


Microphone on Cinnamon

See Microphone on Cinnamon.


Sound output settings on Cinnamon

These are details oriented especially to my Audio Unlimited® 900MHz Wireless Transmitter and Headphones. And, yes, for some reason, under Linux Mint Sound Settings, plugged into the front TRS jack on my Dell notebook dock, it's Headphone USB Audio that I must select. See details below.

Hardware and software details

Switching back and forth between Speakers Built-in Audio and USB Audio Headphone often clears the problem of no-audio.

* TRS, tip-ring-sleeve bayonnette connectors (and sockets) come in 2.5mm monophonic (TS), 3.5mm monophonic and stereophonic (TRS), and also (legacy) ¼-inch stereophonic phone connectors.

✓ support of TRS-connected headphones.

** On Dell (Thunderbolt and non-Thunderbolt multiplier) docking stations, audio only works on the front (not rear) connector whether under Linux or Windows.

Daily use cycle Audio Unlimited headset

I just stand the headphones upon their charger each night before leaving work and then put them back on the next morning.

Sadly, I find the Linux Mint Sound Settings to be very touchy. If ever I launch Windows in a VM, my audio (input and output) settings are torched and, to restore them, I must often even reboot after downing Windows.


Sound output settings for Bluetooth on Cinnamon

The details are for the Avantree Audition Bluetooth Headset.

Hardware and software details

I show Avantree Audition Headset alongside Speakers Built-in Audio in the Cinnamon Sound settings, Output tab. I also show it (as the only device) in the Input tab.

Daily use cycle Avantree Audition headset

  1. Charge using micro USB.
  2. Unnecessary to charge every day, but doesn't hurt. They are rated at 40 hours and I've probably got about that out of them, but there aren't super concrete signs they're juiced out. They just stop working (but that could be due to a loss of audio setting).
  3. Connect to Bluetooth as directed.
  4. In morning, press center button/bar and hold until rising tone is heard (means "turned on") and the headphones are connected (the Bluetooth configuration will say, "Connected").
  5. In evening, press center button/bar and hold until descending tone is heard (means "turned off"). and the headphones are connected (the Bluetooth configuration will say, "Disconnected").
  6. In either case, to enter "discovery mode" for Bluetooth, press and hold center button/bar longer still. There is a flashing light on the headphones that goes from blue to red (or something—see the headphones guide) indicating discovery mode.

Sadly, I find the Linux Mint Sound Settings to be very touchy. If ever I launch Windows in a VM, my audio (input and output) settings are torched and, to restore them, I must often even reboot after downing Windows.

For Audacious to work, when it appears to work, but Audacious sound doesn't seem to reach the Avantree Audition headset, though any browser sound appears to work, etc., in Audacious, try File → Settings... → Audio → Output plugin: and choose ALSA Output.


Sound input settings for Bluetooth on Cinnamon

I find that the Avantree Audition microphone works fine, I just set it up using the Linux Mint Bluetooth configuration applet from the Cinnamon panel.

However, ...

...as I have to run Windows 10 in a VirtualBox VM and Skype for Business, I find it's very hard to get the headphones back into decent sound after dropping my Skype call. I have a better experience leaving the built-in microphone to do the job of input and just not mess up my headphones. This said, most of the time Windows in a VM still trashes my sound settings.


Reset/re-pair SoundPEATS bluetooth earbuds

After trouble connecting both earbuds to each other and/or pairing them to any device, follow these instructions.

See this video: Reset the earbuds, or, the steps below:

    Deleting the pairing record on devices and resetting the earbuds...
  1. Clear the Bluetooth settings for the earbuds on all paired devices.
  2. Turn both earbuds off.
    1. Remove earbuds from case.
    2. Turn each off by holding down on the (big, MFB) button until the LEDs flash red, then go off.
    3. Release both buttons.
    4. Press and hold both buttons for 20 seconds until the LEDs flash white once, then flash red and white alternately and go out.
    5. Keep holding down the buttons until the LEDs reappear.
    6. LED will flash alternately red and white three times very fast.
    7. Release the buttons; the earbuds are now reset.
  3. Return both earbuds to the box/charging dock.
  4. Repairing earbuds in stereo mode...
  5. Take both earbuds out of the box/charging dock; they will automatically pair with each other (the LEDs will flash).
  6. The left earbud will connect to the right one automatically when its LED stops blinking.
  7. The right earbud LED will flash red and white indicating pairing mode.
  8. At this point, activate Bluetooth on the device.
  9. Find and connect to SoundPEATS TrueFree R.
  10. The earbuds should now be reset and connected in stereo to the device.

Sony WH-1000XM3 headphones help guide

The right headphone surface is basically a track pad. Here's how it works: Controlling the audio device (Bluetooth connection)

  1. Play/pause
  2. Next track: Swipe back to front.
  3. Previous track: Swipe front to back.
  4. Fast forward: Swipe front to back and hold, release at desired point.
  5. Fast reverse: Swipe back to front and hold, release at desired point.
  6. Increase amplitude: swipe bottom to top repeatedly or sweep and hold, release at desired volume.
  7. Decrease amplitude: swipe top to bottom repeatedly or sweep and hold, release at desired volume.

To halt noise-cancelling and music, cover entire control surface with palm of right hand. Release to reengage.

To take a phone call, double-tap the center of the surface. To end the call, double-tap again.

To use Alexa, install Alexa application on phone. Open Sony phone application and set NC/AMBIENT button as the Amazon Alexa button. Press NC/AMBIENT button to use Alexa. This may negate using this button to optimize noise-cancellation.

Sony advises never to leave headphones in a parked vehicle.


Sony WH-1000XM3 headphones go bong interrupting music

Sony WH-1000XM3 headphones go bong periodically interrupting the music playing. This is because of the headphones changing the noise-cancelling profile. If adaptive noise-cancelling is deactivated—this is done in the phone application—it won't do this anymore.


StarTech.com USB External Sound Card with SPDIFF Digital Audio

In my development host, tirion, I attempted to replace the graphics adapter (EVGA NVIDIA GeForce 730) with a new one, but the new one didn't work out so well. Unfortunately, removing the new card and re-installing the GeForce 730 left the on-board (Asus TUF GAMING B460M-PLUS (WI-FI) Micro ATX LGA1200 Motherboard) in a horrible state that I could not fix. It made sounds beating like a drum; produced a shrill note that rose in pitch like a siren until out of sight, then stopped and started again.

Of course, I tried swapping out the speakers in case they had gone bad. I have been having clicking problems (like the drumming) for weeks when changing workspaces, powering up, etc.

Here is the user manual.

I cast around for an audio card solution and found an externally mounted solution for under $40 including a 4-year protection plan. I attached it to a rear USB port and plugged in the green line to my age-old Altec-Lansing sound system. Then I fired up my computer and sound just worked. I may move my microphone over to this device if it no longer works plugged in where it is.


My own StarTech set-up...

(Last time I fussed with this: 20 July 2022)

In my case, I have the StarTech device described above set up thus:

  1. The braided USB connector that came with the device is plugged into my Linux host. I did not need any driver (only Windows drivers are available anyway).
  2. I have a micro-stereo cable plugged into the green output connector on my host's backplane and then into the StarTech's LINE-IN connector. (Yeah, I'm not sure why either and I think that, originally, I didn't have this and it was working without it.)
  3. I have a second micro-stereo cable running from the StarTech's FRONT (2.1) connector to my (Altec Lansing) speaker system.
  4. I have my stand-alone microphone's micro-stereo cable plugged into the L[EFT] MONO connector on the side of the StarTech device.

This is how I am getting audio out (speakers) and -in (microphone). Here's what that looked like on 2022-08-02:


Webcam diagnostics

The most frequent problem with a webcam is that it's not recognized by anything like Skype, cheese or guvcview, however, this last one will "work harder" at finding it and, once it has, the former two may begin to work. (I'm not an expert, this is only an observation and I might be drawing a false conclusion.)

Diagnosing starts by installing then running cheese and also guvcview:

$ sudo apt-get install cheese
$ sudo apt-get install guvcview
$ which guvcview
/usr/bin/guvcview
$ guvcview

If this utility doesn't find your camera, terminate guvcview. Yank your camera from its USB, count to 20, then plug it back in. Retry guvcview. It might work, whereupon, cheese and Skype probably will too.

$ which cheese
/usr/bin/cheese
$ cheese

Skype

Note that, in the past at least, Skype required 32-bit library support for cameras. You might do this to see if you already have it:

$ sudo dpkg --list | grep [i]a32
ii  ia32-libs                                     2020.05.27                          amd64

Then, if not, install it thus. (This should not hurt your 64-bit Linux installation, but only ensure the presence of 32-bit libraries whenever an application asks to use them):

$ sudo apt-get install ia32-libs

You probably do not need to restart your system.