Archive for June, 2011
The following is (I hope) an adequately-documented procedure to stream desktop audio capture via icecast2.
What you will need:
- Basic audio hardware
- An Internet connection
- Ability to accept inbound connections on a port (default 8000)
- Some basic idea of what you’re doing :)
Setting up the icecast2 server
Icecast2 is a free server for streaming multimedia similar to SHOUTcast. I won’t go in to all of the differences here — you can easily Google them or visit the respective websites and do some light reading. What I will actually explain here is how to get the server actually running.
Install icecast2 from either Synaptic or command line.
sudo apt-get install icecast2
By default, the icecast2 server’s logging configuration is set up in a way that might deeply frustrate the amateur user. This is because it is set up to log to /var/log/icecast2, which is set up with the following permissions:
drwxr-xr-x 2 icecast2 icecast 4096 2011-06-27 23:45 icecast2
That’s 0755 for user icecast2 and group icecast. Fortunately that user and group account are already created for us, but the configuration file isn’t set to change the running process id (it’s commented out) and the entered defaults are for user nobody. No worries. Read on.
Now edit the /etc/icecast2/icecast.xml config file using your favorite text editor. If you don’t mind my recommendation, and you’re doing this on a machine running Gnome or Unity, gedit is excellent. Make sure to edit the file as root.
sudo gedit /etc/icecast2/icecast.xml
Edit the file to your preference.
The next settings change depends on whether you’re running Ubuntu Desktop or Server. Find the section below that applies to you.
Ubuntu Desktop: Make sure to head down to the bottom and make the important change to set the correct user/group combination. Find the
section and uncomment (remove the
--> marks) from around the
to icecast2 and
to icecast, like so:
Now start the icecast2 server
sudo icecast2 -c /etc/icecast2/icecast.xml
You should see messages similar to the following:
Changed groupid to 125. Changed userid to 115.
… and then the program will not produce any more output, but remains running (does not drop back to a prompt). Congratulations, your icecast2 server is running. If it produced an error message, or dropped back to a prompt, investigate the configuration file for any problems, and make sure the port you have icecast2 set to isn’t being used by another process.
To stop the server, hold ctrl and press c (CTRL-c). It does take a few seconds after the keypress to completely halt.
Ubuntu Server: Edit the /etc/default/icecast2 file. The uid and gid should already be set correctly. Verify they are set as follows:
# Name or ID of the user and group the daemon should run under USERID=icecast2 GROUPID=icecast
Next, follow the instructions on the last 3 lines:
# Edit /etc/icecast2/icecast.xml and change at least the passwords. # Change this to true when done to enable the init.d script ENABLE=true
Now start the service
You should get the following output:
Starting icecast2 Detaching from the console icecast2.
Finding your audio device for streaming
I tried using various programs to set up my audio stream, such as the SHOUTcast Transcoder (sc_trans), darkice, and a few others that I don’t even recall — but none worked correctly for my case. The reason? I either couldn’t figure out what audio device to use, or it wouldn’t work with the audio device I gave it.
As it turns out, Linux machines primarily use PulseAudio as a sound system and many of these utilities expect or are designed to work with an ALSA sound system. I tried /dev/dsp and /dev/audio as input devices but neither existed on my system. I tried padsp with darkice configured to use /dev/dsp but that didn’t work either. I found Alexandru Csete’s GStreamer article and a few other posts and figured gst-launch-0.10 would be the answer that I needed. As it turns out, that was completely correct.
With all credit to Alexandru Csete, here are the steps to find the correct PulseAudio device name for your scenario.
Run the following command:
pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2
You should get output similiar to the following:
alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor alsa_output.pci-0000_00_1b.0.analog-stereo.monitor alsa_input.pci-0000_00_1b.0.analog-stereo
These output ‘monitor’ sources feed your devices entire playback stream — effectively ‘what you hear’. The input sources are a microphone or other line-in device. Select the device appropriate for your scenario. If you are trying to capture a webcam microphone or other removable device, generate this list with your device plugged and then unplugged and then compare the lists to find your device.
Once you have your device name, it’s time to…
Set up your audio stream
gst-launch-0.10 pulsesrc device=DEVICE ! audioconvert ! vorbisenc bitrate=BITRATE ! oggmux ! shout2send ip=IP port=PORT password=PASSWORD mount=MOUNT
An explanation of the options:
- DEVICE: Your audio device (from above)
- IP and PORT: The IP address and PORT number of your Icecast2 server
- PASSWORD: The password to your icecast2 server
- MOUNT: The mount point of your stream.
- BITRATE: The bitrate you want your audio to be (see examples below)
In my case the audio device I wanted to use was:
So my line was:
gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! vorbisenc bitrate=32000 ! oggmux ! shout2send ip=localhost port=8000 password=XXXXXX mount=stream
The above produces an OGG stream. This works pretty well, but some Windows users report issues with OGG streaming. If you want MP3 streaming instead, try this:
gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! lame bitrate=32 ! shout2send ip=localhost port=8000 password=XXXXXX mount=stream
Note that if you are streaming to a SHOUTcast server (as opposed to an Icecast2 server), change the command as follows:
mount= and replace it with
protocol=2. Make sure you are connecting on the port specified in sc_serv.conf and not the +1 port. Example:
gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! lame bitrate=32 ! shout2send ip=localhost port=8000 password=XXXXXX protocol=2
Running this produces output similar to the following:
Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstAudioSrcClock
If you get some sort of error investigate your shout2cast settings.
Again, CTRL-c stops the streaming.
At this point, you should have a working icecast2 server and a working stream (via gst-launch-0.10). Congratulations!
I’m sure this guide is far from perfect, so please feel free to share any feedback you may have in the comment sections below. Thank you!
Here’s a quick run-down of the steps that I took when setting up Guild Wars on a friends Ubuntu machine under PlayOnLinux.
We chose PlayOnLinux because of the ability to use Wine prefixes, so we could customize the Guild Wars prefix for best play experience and no interfere with other configured Wine software. It also gave the easiest installation experience. We also chose PlayOnLinux as a free alternative to commercial programs like CrossOver Games.
Your experience may vary but this is what worked for us.
First, install PlayOnLinux either from Synaptic or the command line.
sudo apt-get install playonlinux
PlayOnLinux will be found under Applications > Games > PlayOnLinux (Gnome) or can be searched for in Unity.
Next, install Guild Wars
After starting PlayOnLinux, click the Install button, then click Games in the left column, and locate Guild Wars on the right side. Click Apply. Follow the on-screen dialogs to complete the installation of Guild Wars.
Once Guild Wars is installed, it’s time to tune it for performance. Note that much of the following is subjective, and may not be needed under certain circumstances.
— Tune the Guild Wars wine configuration
Once Guild Wars is installed, locate it’s entry in PlayOnLinux and click it, then click Configure this application. The application configurator will open. Click Forward and choose Configure Wine, then Forward again to launch the Wine configuration utility.
Once the Wine configuration utility is open, click the audio tab. If you get a dialog message stating that the audio driver was auto-detected. That’s fine. Set the DirectSound Hardware Acceleration mode to Emulation. Next choose the Graphics tab and under Direct3D, uncheck Allow Pixel Shader.
— Force Guild Wars to start in windowed mode.
Guild Wars will inititally start in full-screen mode. If this causes the client to crash or causes strange graphics issues, you may force it to start in windowed mode using the following terminal command:
WINEPREFIX=~/.PlayOnLinux/wineprefix/GuildWars/ WINEDEBUG=-all wine "C:GWGw.exe" -windowed
This will start Guild Wars in a window.
— Further registry tweaks
Locate the Guild Wars entry in PlayOnLinux and click it, then click Configure this application. The application configurator will open. Click Forward and choose Registry Editor, then Forward again to launch the Wine configuration utility.
Navigate the registry to
(If the Direct3D key does not exist, right-click on Wine and choose New > Key and name it Direct3D)
Right-click and choose New > String value. Call it UseGLSL. Double-click on UseGLSL and set Value data to “disabled” without quotes.
This is one of several issues that I ended up helping a friend with last night on his Ubuntu installation. When clicking an item in the ‘Places’ menu, such as Pictures, Home, Music, etc, a dialog box appears that reads “Error: File not found”. We were scratching our heads until I realized that the error dialog looked suspiciously like it was being displayed using Wine.
After a bit of searching my suspicions were confirmed. This happens when, through one action or another, Wine is assigned the ‘Open Folder’ association. When you try to open a folder using the menu, Wine tries to open it and subsequently fails, and that’s where the error comes from.
Unfortunately I don’t have a screenshot but I do have a solution courtesy of Ubuntu Forums.
Open and edit the ~/.local/share/applications/mimeapps.list file. You can use this command:
Locate the line that starts with
inode/directory= and change it to read as follows:
Save. Changes take effect immediately.
This explains how to quickly and easily create a multipart (multivolume) RAR file using Gnome / File Roller in Ubuntu.
First, locate the file(s) / folder(s) you want to compress and highlight them. Next, right-click and select Compress...
When the Compress dialog appears, enter a filename for your archive and select rar as the extension. Click the arrow next to Other Options to expand the dialog. Check the box next to Split into volumes of and enter the desired max individual file size here.
Click Create and the compression process will begin. Note that on extremely large multipart archives with lots of part files, a heavy amount of disc activity may occur, and the archiving process (and some other programs) may stall or momentarily freeze because of the disc activity. Be patient and allow the process to complete.
This will explain how to create an ISO image from a CD/DVD using Brasero in Linux.
First, insert the disc from which you want to make an ISO image. Wait until, and make sure, an icon for the disc appears on your desktop, indicating the disc has been read and mounted.
Next, open Brasero and select the Disc Copy function.
On the Copy CD/DVD dialog, change Select a disc to write to to ISO by clicking on the drop-down itself (not the properties button) and choosing Image file.
Click the Properties button and choose a name and location for the output ISO image and then click Close.
Verify your settings and then click Start copy.
Brasero will start creating your disc image, which will be quite large — up to the full capacity of your media (4.7GB for single-layer DVDs, 8.5GB for dual-layer).
If you’re using DD-WRT on your router you may find that certain wireless configurations cause the wireless clients to either be unable to connect or drop connection. This seems to be the most noticeable on Windows 7 systems, but likely happens on other systems as well. Note that I did not observe this at all on a Linux-based system and I’m completely unable to explain why. Perhaps a difference in the wireless stacks between Windows and Linux highlights this issue.
Issues related to this include not being able to connect to the wireless AP, instead receiving a message such as “The access point did not allow the connection” or something similar (Apologies, I don’t have the exact error message.), and losing wireless connection to the network or AP, even though it is still shown in the list of wireless networks.
This appears to be related to the wireless security settings, specifically the settings for security mode and WPA algorithm. See the following screenshot:
Having the security mode set to WPA2 Personal Mixed and the algorithm set to TKIP+AES appears to cause the problem.
According to the DD-WRT help:
This mode allows for mixing WPA2 and WPA clients. If only some of your clients support WPA2 mode, then you should choose WPA2 Mixed. For maximum interoperability, you should choose WPA2 Mixed/TKIP+AES.
So, according to this, it should work — but it doesn’t seem to work quite as advertised. Instead, this is the recommended setup as long as all your wireless clients support WPA2:
Security mode set to WPA2 Personal and algorithm set to AES only appeared to completely solve the problem.
For the curious, this is DD-WRT v24-sp2 (08/12/10) mega (SVN revision 14929), the current recommended build.
If you’re experiencing font display problems in Ubuntu, you may want to check the list of installed font packages. It’s likely you have uninstalled or replaced one or more font packages, which are changing the displayed fonts on your system. Here is the list of font packages installed by default:
Packages can be installed or uninstalled using Synaptic Package Manager.
Systems with i3/i5/i7 chipsets and nVidia video may experience Ubuntu not booting, and instead getting a blank screen with a flashing cursor or corrupt video display.
This seems to be an issue with some combination of kernel, video card, and nouveau driver, and appears to stem from the fact that the system technically has two sets of video hardware: that on the Intel CPU and the nVidia GPU.. While the Ubuntu developers work to get this corrected, there is a workaround to get you going.
When your system starts to boot up, hold the shift key to get to the GRUB menu, then press ‘e’ to edit the command line. Go to the kernel line (the line that starts with
linux and has
quiet splash in it) and press the ‘end’ key to scroll to the end of the line. Add
nouveau.modeset=0 to the end of the line, then press F10 to boot.
After booting up, you can install the nVidia proprietary drivers and reboot and graphics will work great for you.
You can also permanently disable the nouveau module by running the following:
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf sudo update-initramfs -u
You may experience a low-resolution splash or login screen. See my post nVidia proprietary drivers and low-resolution Plymouth splash screen for a solution to this.