Raspberry Pi Basics: Part II-Audio/Video

Okay! so here I am again with a little more on RaspberryPi (~RasPi).  In last blog post, we discussed about the basic GPIO usage of the Raspi.  I think that I tried to explain the GPIO quite well. (lolz.. self-praise).  Yeah, I know its late since my last post and there is quite a few days gap.  I do have a strong reason for this, I was actually LOST out watching HOMELAND and BREAKING BAD!! Nevertheless, I finished them watching. :p
Also, I have written down three most posts on RasPi and will publish all along.  Sort of basic tutorial Series for RasPi.

So, as said this post is all about Audio and Video in RasPi.

I am running Debian Wheezy to work on Raspi, so most of the things will work ‘out of the box’  by the use of the almighty *package manager*.  Just do a `apt-get install **’ and you are done.  Daaaaaaaahh, you actually managed to run the  application on the RasPi.

First of all make sure, you are updated by the following

  • sudo apt-get update
  • sudo apt-get upgrade

Making the sound work!

First check whether the sound module is loaded or not by use of ‘lsmod’ command.  You may get something like “snd-bcm**” if your module is loaded. Otherwise you have to load it via the following commands but first get the root shell.

  • sudo su –

Now at the root shell, just append the sound modules to /etc/modules

  • echo ‘snd-bcm2835’  >> /etc/modules

exit the shell and come back to user Pi,  and load the module

  • sudo modprobe snd-bcm2835

Since we have loaded the module, we are left with the soundserver and the drivers ‘ALSA’,  after that your sound should be working!

Testing the sound is really simple: you all need is to atleast have the player to play your sound file.  One can have Totem, VLC or mplayer.  I prefer VLC everywhere.

  •  sudo apt-get install mplayer  alsa-base alsa-utils pulseaudio mpg123

that installed mplayer, mpg123 and alsa, pulseaudio all in a single time.  Do download the VLC media player too, because I did all the work on it ( lolzzz)

  • sudo apt-get install vlc

Do all of this and have a reboot.

  • sudo reboot

Now simply test the audio file with vlc media player

  • cvlc /path/to/myaudiofie.mp3

and you should be listening to the audio.


VLC media player does most of the work for you,  it plays smaller and not very high quality videos for you for free! But for high quality you have to convert them to match our needs using ffmpeg obviously, or use OPENELEC.  Videos were playing quite OK on Pi,  but when I tried with the heavier videos I got messages of “frame dropping” and vlc was hang (the video section) though the sound was working.

There may be the case that your user PI is not added in the video group so you may not have the permissions to play the videos, so simply add it to the video group.

  • sudo usermod -aG video pi

which simply means to append the user the Group.  Here video is the group and pi is the user.  Note as the man page says use -a only with -G option, not to append elsewhere.


Sincere thanks to wrightrocket!!

About Beyond

an electronics hobbyst, 8 bit microcontroller(8051/AVR/Arduino) programmer, Linux lover, in love with Embedded Linux systems ... TGL: just push it "BEYOND THE LIMITS"..

Posted on September 29, 2012, in Embedded Linux, Embedded Systems and tagged , , , , , , , , , , . Bookmark the permalink. 2 Comments.

  1. can you please suggest me that whether rasperberry pi would be a good platform to learn embedded linux or beagleboard xm ? i m really confused and really want to see my output (LCD must!), low cost and long run hardware that could keep me busy for months and years. it would be really good if i can have some signal processing features so that i could use my hardware for image processing applications,in future.
    what would u suggest ??

    • in that case…i would say go for beagleboardXM

      a lot to explore for it… but thats quite costly.
      but you will learn a lot of things from beagleboard XM, being completely open source. porting linux step by step and also porting and tweaking with other OS, support for Image processing with hardware support for camera, and HDMI and S-video output for screen.
      Higher processor power and RAM.
      plus a seperate DSP core which is quite interesting for Signal Processing stuff

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s