Advertisements

Archive for June, 2011

Broadcasting a multimedia stream using icecast2 and gst-launch in Ubuntu Linux

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 <!-- and --> marks) from around the section. Change to icecast2 and to icecast, like so:

icecast2
icecast

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

/etc/init.d/icecast2 start

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

Example command:

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:

alsa_output.pci-0000_00_1b.0.analog-stereo.monitor

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:

Remove 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!

Advertisements

, , , , , ,

Leave a comment

Cooling the Linksys E3000 – Part 2 – Inside the box

After much discussion and feedback regarding my original post “Cooling the Linksys E3000“, and my own curiosity as to why this router got so hot, I decided to press on and look further into it.

I’ve heard rumors that speculate that one of the reasons this router gets so hot is because of an underpowered AC/DC adapter. I generally don’t agree with that and here’s why: The device is hot but the adapter isn’t. In my experience AC/DC adapters which are under-powered will run the adapter hot — as it’s overloaded — and the device won’t function under load, as there’s not enough power to all of the components. In this case, the AC/DC adapter isn’t hardly warm (I just checked mine) and appears to meet the device requirements (12VDC 2A). So I don’t believe the heat issues are related to the adapter. So if the problem isn’t related to the AC/DC adapter, it must be due to lack of adequate cooling. I removed my cooling fan and opened the case. The screws are T10 torx security screws, labeled CR-VT10 in my kit, for the interested. The first thing I noticed after opening the router was that there was plenty of RF shielding and actually a heatsink mounted on one chipset. I decided against removing it as I didn’t have anything to replace it with if the adhesive didn’t re-stick. I then set up a moderate test to keep the router busy while I probed the uncovered chips with an infrared thermometer.
Here is my setup:

Wired:

  • Port 1: Wii streaming Netflix
  • Port 2: Gigabit NAS

Wireless:

  • 5Ghz Wireless-N device (300Mb/s) copying a large amount of data from the NAS

As you can see I’m far from pushing the router to it’s limits but I am certainly keeping it moderately busy. I ran this level of network activity for about 5 minutes then started taking temps. I found two chips that had operational temperatures above 45C:

The first was the Broadcom BCM4322KFBG controller at 62.8C

bcm4322kfbg

This is a product of the Broadcom BCM4322 family of 802.11n controllers. Here’s the datasheet.

The second was the Winbond W9751G6JB-3 DRAM chip at 47.6C. This is a 512Mb DDR2 SDRAM chip.

w9751g6jb-3

It seems to me now that the Broadcom chips are almost solely responsible for much of the overheating issues in this router family, with the DRAM chip potentially taking some of the blame as well. I’m planning on ordering a set of Zalman VGA heatsinks and put one of them on each of these chips. It should help a lot, especially with the fan on the bottom to keep the air moving.

As the nature of heatsinks is to transfer the heat from the chipset to the air, I’m sure that I’ll notice a slight increase in the temperature of the router’s case itself, but the resulting heat transfer should be improved with the aid of the fan, and I’m sure I’ll be able to expect my router to live a much longer life.

If anyone has any thoughts to share on this please do so in the comments below. Thank you!

, , ,

Leave a comment

Guild Wars on PlayOnLinux

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

HKEY_CURRENT_USERSoftwareWineDirect3D

(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.

See also:

, , , ,

Leave a comment

Gnome places menu items give ‘File not found’ error

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:

gedit ~/.local/share/applications/mimeapps.list

Locate the line that starts with inode/directory= and change it to read as follows:

inode/directory=nautilus-folder-handler.desktop;

Save. Changes take effect immediately.

, ,

Leave a comment

How to easily create a multipart (multivolume) RAR file easily in Ubuntu

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.

,

Leave a comment

How to create an ISO in Brasero

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).

,

Leave a comment

Example of a fake antivirus web page with screenshots

So I was browsing for something today via google Images and I happened upon a malicious web page.

The web page tried to convince me to install an “Anti-Virus” program, on the premise that “Chrome Security” had found viruses on my computer.

Back in 2010, Google themselves issued a warning about these very same “fake antivirus” attacks:

“Constant improvements are being made on the fake anti-virus software with sophisticated tactics designed to trick the computer users in downloading and installing the software which is meant to create malicious code in your computer.” — Source: techgenie.com

Take a careful look at the below screenshots I captured and see firsthand how an attack like this works. The key here is that the website detects your browser and displays a message that matches the browser to make it more believable.

Click for larger image

The website first gives you a simple dialog. Clicking OK here begins the following series of screens. The safest thing to do once you get a dialog like this is to click the X and then close the window. Notice that the dialog message contains a vital “tell”: the website is displaying the message, not your browser.

Click for larger image

Click for larger image

This screen shows the fake “scan”, which is likely just a flash video (I didn’t actually check). The safest thing here is to close the tab/window immediately.

Click for larger image

Click for larger image

The “result” screen. Notice that it’s tried to download an .exe file, no doubt the fake antivirus software itself. The fake antivirus software would actually be the trojan — the web page itself is mostly harmless, minus the persuasion to install the payload. The safest thing here to is to close the tab/window immediately.

So in this case I can report the site to Google by clicking wrench icon > Tools > Report an issue.

The take-away lessons from this are:

  • Your browser doesn’t have any tools within it to detect viruses
  • Any notice about viruses should display as being from your antivirus program, not your web browser
  • Close web page prompts and pop-ups using the X rather than hitting any OK or other buttons

Also, I’m running Linux, and therefore none of the above “viruses” could have actually been detected, not to mention the exe couldn’t have done anything to me. :)

,

Leave a comment

Intermittent wireless connection and disconnects with DD-WRT and Windows 7

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:

ddwrt_wpa_mixed

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:

WPA2 Mixed
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:

ddwrt_wpa

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.

, ,

Leave a comment

Default font packages installed on Ubuntu 11.04 (Natty)

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:

  • ttf-kacst-one
  • ttf-khmeros-core
  • ttf-liberation
  • ttf-takao-pgothic
  • ttf-unfonts-extra

Packages can be installed or uninstalled using Synaptic Package Manager.

Leave a comment

TPMS needs an urgency indicator

Right now, the TPMS sensor in your car’s tires can tell you if they’re underinflated, but not by how much or how urgent you need to inflate them. wouldn’t it be better if it could?

For example, a 33PSI tire at 28PSI would cause the TPMS light to come on and stay on. I could drive around all day on 28PSI and not have to worry too much, but what if that tire dropped to 15PSI, or even 10PSI, or less? I wouldn’t know until there was just a layer of rubber between my rim and the road — by then it would be too late.

TPMS should be improved to at least let you know if the tire pressure drops dangerously low, to separate that ‘put some air in your tires before you pull in the garage’ message from the ‘put some air in your tires NOW’ message. The ‘Check Engine’ light already does it (in a way). Oxygen sensor bad? Light comes on to annoy you. Something catastrophic happens? The light will actually start flashing.

I say the TPMS light out to flash or change to red if the tire pressure drops below 20PSI.

That’s my thoughts. What are yours?

Leave a comment