No sound at -each- boot!


Something very annoying began to happen on my work laptop. Every time I booted it, it was without sound.

The sound applet did not work, I could adjust the volume, and detected the sound card, but no sound came out of the speakers.

But the curious thing was I surely heard some youtube video before, so it stopped  from work suddenly…

After recheck my system detected de hardware with lspci, and the right modules were loaded with lsmod

# lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation NM10/ICH7 Family High Definition Audio Controller (rev 02)
# lsmod | grep -i intel
snd_hda_intel          31351  6
snd_hda_codec         129274  3 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hda_intel
snd_pcm                63880  4 snd_hda_codec_si3054,snd_hda_codec,snd_hda_intel
snd_page_alloc          5978  2 snd_pcm,snd_hda_intel
snd                    44598  18 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hwdep,snd_timer,snd_pcm,snd_hda_codec,snd_hda_intel
intel_agp               8692  1 i915
intel_gtt              10204  3 i915,intel_agp
agpgart                22047  3 drm,intel_agp,intel_gtt

I openned a terminal and execute alsamixer and I saw this:

alsamixer muted device

Those “MM” between the bar and the “100<>100” means that is “Muted”. To toggle between muted and unmuted we must use the “M” key. Then, if you have something playing, it will sound. 🙂

Now we can exit alsamixer by pressing the “Esc” key.

Even if in each reboot, I was again muted, it was very easy open a terminal, unmute the sound card, and done. As that laptop is my job tool, and I did use it mainly to connect to remote servers, to document, or to code some scripts, and rarely to listen music or to watch a video tutorial or something with audio, that worked fine for me… but I admit its annoying.

So, digging a bit deeper, I found alsactl and only by typing

# alsactl store

The configuration will be saved through the reboots 😉

Bash script to download and rip Youtube playlists to mp3


Recently I’m watching once again Doctor Who. Its soundtrack is simply awesome, so I decided to download it and upload it to google music service to have it both offline and online in all my devices.

On the pirate bay there are only two OSTs of the six seasons. So I searched on youtube and, voilà, there I founded the complete OST for the six seasons. 🙂

So I made a search on AUR to grab a program to download all the videos from those playlist and rip them to mp3. I quickly found youtube-dl and youtube-dl-playlist.

Unfortunately, even though youtube-dl-playlist can donwload (and in my case, most of times, it simply fails to download) a youtube playlist, it does not convert the downloaded items (flv or mp4 videos) to mp3 so we need to use another piece of software in order to get our beloved mp3.

There are so many software for linux we can use to rip off the audio from video, but the simplest one is ffmpeg. In fact, the other software out there requires ffmpeg as dependence… it must be for something…

So I wrote a little bash script that do exactly that: it downloads a entire playlist from youtube and extracts the audio into mp3. Oh, it also takes the image from youtube and put it into mp3 😉

I would like to share it with all of you under the infamous license Do What The Fuck You Want To Public License.

# youtube-dl-playlist-to-mp3
# Utility to download Youtube playlist videos and ripp off their audio into mp3
# @author Angel Docampo
# @license WTFPL version 2 ( )
echo "This script is useful when you want to download and rip a complete Youtuble playlist into mp3"
echo "Enter a name for the playlist"
read -r NAME
echo "Enter the Youtube playlist URL to begin the process (e.g: ):"
read PL
mkdir "$NAME" && cd "$NAME"
mkdir .tmp && cd .tmp
youtube-dl -o '%(stitle)s.%(ext)s' $PL
for i in *.flv; do
ffmpeg -i "$i" -acodec libmp3lame -ac 2 -ab 128 "${i%flv}mp3";
for i in *.mp4; do
ffmpeg -i "$i" -acodec libmp3lame -ac 2 -ab 128 "${i%mp4}mp3";
rm -rf *.flv *.mp4
cd .. && mv .tmp/*.mp3 . && rm -rf .tmp
echo "Conversion finished!"

If you are too lazy to copy and paste it, you can download it from here. Remember to make it executable with chmod +x youtube-dl-playlist-to-mp3 if you named it like that, and put a copy on /usr/bin or /usr/local/bin to make it accessible system-wide.
Of course, you must meet the requirements, those are ffmpeg and youtube-dl installed on your system.


EDIT:  You can now download another script that downloads directly the best quality audio file hosted on youtube without the need of transcode it. Credits and complaints to his author

Embed subtitles from linux command line



To embed subtitles into an avi to see with your dlna device, you can do as follows

transcode -i name_of_video.avi -x mplayer="-sub" -o name_of_subtitled_video.avi -y xvi


After reinsalling my arch box, I had several provems with… I found a easier way to do the same with mencoder
$ mencoder -UTF8 -sub -ovc xvid -xvidencopts bitrate=-700000 -oac copy -o movie.avi

As you will use mplayer to transcode the subtitle, you must configure properly mplayer to show correctly those special characters, like accents, inverted question or exclamation marks. Almost everyone will do with UTF-8 encoding. To configure mplayer, edit ~/.mplayer/config
# Set font.
#set your ttf fonts here, example:

# Set font encoding.

# Set subtitle file encoding.

Note that gmplayer, smplayer and others mplayer-based players, do NOT use that config file, then you MUST edit this file or subtitles will show weird characters and you will transcode the video again. You’re adviced.