14 March 2012

PS3 Mediatomb Debian configuration - cont.

I recently made some improvements to my mediatomb setup, so here's my config file.
It now does some server-side transcoding for stuff the PS3 doesn't have native support for like Vorbis audio, video codecs and iso images.
It's not perfect yet, but it works for most of the stuff I've got.
The mediatomb xml is pasted first, then the support scripts which handle the video transcoding, just don't forget to chmod +x them (they can be used standalone as well btw).

/etc/mediatomb/config.xml:


<?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd">
  <server>
    <ui enabled="yes" show-tooltips="yes">
      <accounts enabled="no" session-timeout="30">
        <account user="mediatomb" password="mediatomb"/>
      </accounts>
    </ui>
    <name>[NAME]</name>
    <udn>uuid:dae13796-e78c-486c-ab54-f79c144a20f3</udn>
    <home>[PATH_TO_HOME]</home>
    <webroot>/usr/share/mediatomb/web</webroot>
    <storage caching="yes">
      <sqlite3 enabled="no">
        <database-file>sqlite3.db</database-file>
      </sqlite3>
      <mysql enabled="yes">
        <host>localhost</host>
        <username>mediatomb</username>
        <database>mediatomb</database>
      </mysql>
    </storage>
    <protocolInfo extend="yes"/>
    <custom-http-headers>
      <add header="X-User-Agent: redsonic"/>
    </custom-http-headers>
    <manufacturerURL>redsonic.com</manufacturerURL>
    <modelNumber>105</modelNumber>
    <extended-runtime-options>
      <ffmpegthumbnailer enabled="yes">
        <thumbnail-size>128</thumbnail-size>
        <seek-percentage>5</seek-percentage>
        <filmstrip-overlay>yes</filmstrip-overlay>
        <workaround-bugs>no</workaround-bugs>
        <image-quality>8</image-quality>
      </ffmpegthumbnailer>
      <mark-played-items enabled="no" suppress-cds-updates="yes">
        <string mode="prepend">*</string>
        <mark>
          <content>video</content>
        </mark>
      </mark-played-items>
    </extended-runtime-options>
  </server>
  <import hidden-files="no">
    <scripting script-charset="UTF-8">
      <common-script>/usr/share/mediatomb/js/common.js</common-script>
      <playlist-script>/usr/share/mediatomb/js/playlists.js</playlist-script>
      <virtual-layout type="builtin">
        <import-script>/usr/share/mediatomb/js/import.js</import-script>
      </virtual-layout>
    </scripting>
    <mappings>
      <extension-mimetype ignore-unknown="no">
        <map from="mp3" to="audio/mpeg"/>
        <map from="ogg" to="application/ogg"/>
        <map from="asf" to="video/x-ms-asf"/>
        <map from="asx" to="video/x-ms-asf"/>
        <map from="wma" to="audio/x-ms-wma"/>
        <map from="wax" to="audio/x-ms-wax"/>
        <map from="wmv" to="video/x-ms-wmv"/>
        <map from="wvx" to="video/x-ms-wvx"/>
        <map from="wm" to="video/x-ms-wm"/>
        <map from="wmx" to="video/x-ms-wmx"/>
        <map from="m3u" to="audio/x-mpegurl"/>
        <map from="pls" to="audio/x-scpls"/>
        <map from="flv" to="video/x-flv"/>
        <map from="avi" to="video/divx"/>
        <map from="mkv" to="video/x-matroska"/>
        <map from="mts" to="video/mpeg"/>
        <map from="ts" to="video/mpeg"/>
        <map from="m2ts" to="video/mpeg"/>
        <map from="mov" to="video/x-quicktime"/>
        <map from="vob" to="video/mpeg"/>
        <map from="m4v" to="video/mp4"/>
        <map from="vob" to="video/iso"/>
        <map from="VOB" to="video/iso"/>
        <map from="iso" to="video/iso"/>
        <map from="ISO" to="video/iso"/>
        <map from="img" to="video/iso"/>
        <map from="IMG" to="video/iso"/>
        <map from="rm"  to="video/realmedia"/>
        <map from="rmvb"  to="video/realmedia"/>
      </extension-mimetype>
      <mimetype-upnpclass>
        <map from="audio/*" to="object.item.audioItem.musicTrack"/>
        <map from="video/*" to="object.item.videoItem"/>
        <map from="image/*" to="object.item.imageItem"/>
      </mimetype-upnpclass>
      <mimetype-contenttype>
        <treat mimetype="audio/mpeg" as="mp3"/>
        <treat mimetype="application/ogg" as="ogg"/>
        <treat mimetype="audio/x-flac" as="flac"/>
        <treat mimetype="image/jpeg" as="jpg"/>
        <treat mimetype="audio/x-mpegurl" as="playlist"/>
        <treat mimetype="audio/x-scpls" as="playlist"/>
        <treat mimetype="audio/x-wav" as="pcm"/>
        <treat mimetype="video/x-msvideo" as="avi"/>
        <treat mimetype="video/quicktime" as="mov"/>
        <treat mimetype="video/x-quicktime" as="mov"/>
      </mimetype-contenttype>
    </mappings>
    <online-content>
      <YouTube enabled="no" refresh="28800" update-at-start="no" purge-after="604800" racy-content="exclude" format="mp4" hd="no">
        <favorites user="mediatomb"/>
        <standardfeed feed="most_viewed" time-range="today"/>
        <playlists user="mediatomb"/>
        <uploads user="mediatomb"/>
        <standardfeed feed="recently_featured" time-range="today"/>
      </YouTube>
    </online-content>
  </import>
  <transcoding enabled="yes">
    <mimetype-profile-mappings>
      <transcode mimetype="video/x-matroska" using="transcode-video"/>
      <transcode mimetype="video/x-flv" using="transcode-video"/>
      <transcode mimetype="video/x-quicktime" using="transcode-video"/>
      <transcode mimetype="video/realmedia" using="transcode-video"/>
      <transcode mimetype="application/ogg" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="oggflac2raw"/>
      <transcode mimetype="audio/x-flac" using="oggflac2raw"/>
      <transcode mimetype="video/iso" using="video-iso"/>
    </mimetype-profile-mappings>
    <profiles>
      <profile name="transcode-video" enabled="yes" type="external">
          <avi-fourcc-list mode="ignore">
              <fourcc>DX50</fourcc>
              <fourcc>DM4V</fourcc>
              <fourcc>M4S2</fourcc>
          </avi-fourcc-list>
          <mimetype>video/mpeg</mimetype>
          <accept-url>yes</accept-url>
          <first-resource>yes</first-resource>
          <hide-original-resource>yes</hide-original-resource>
          <accept-ogg-theora>yes</accept-ogg-theora>
          <agent command="/usr/local/bin/transcode-video" arguments="%in %out"/>
          <buffer size="1048576" chunk-size="26214" fill-size="52428"/>
      </profile>
      <profile name="video-iso" enabled="yes" type="external">
          <mimetype>video/mpeg</mimetype>
          <first-resource>yes</first-resource>
          <hide-original-resource>yes</hide-original-resource>
          <accept-ogg-theora>yes</accept-ogg-theora>
          <agent command="/usr/local/bin/transcode-video-iso" arguments="%in %out"/>
          <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
          </profile>
      <profile name="oggflac2raw" enabled="no" type="external">
        <mimetype>audio/L16</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>no</accept-ogg-theora>
        <agent command="ogg123" arguments="-d raw -f %out %in"/>
        <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
      </profile>
      <profile name="vlcmpeg" enabled="yes" type="external">
        <mimetype>video/mpeg</mimetype>
        <accept-url>yes</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>yes</accept-ogg-theora>
        <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit"/>
        <buffer size="14400000" chunk-size="512000" fill-size="120000"/>
      </profile>
    </profiles>
  </transcoding>
</config>


/usr/local/bin/transcode-video:

#!/bin/bash
exec "/usr/bin/avconv" -i "$1" -vcodec mpeg2video -b 4096k -r 25 -acodec ac3 -ar 48000 -ac 2 -ab 448000 -f mpegts - > "$2"

 /usr/local/bin/transcode-video-iso:

#!/bin/bash
exec "/usr/bin/vlc" -v dvdsimple://"$1" -I dummy --sout "#transcode{vcodec=mpgv,vb=800,fps=25,acodec=mpga,ab=192,samplerate=48000,channels=2,deinterlace,soverlay,audio-sync}:standard{mux=ps,access=file,dst=$2" --sub-language=en vlc:quit >> /var/log/transcode.log 2>&1


13 March 2012

About gallops and down picking

I've got some serious problems with alternate picking.
From when I first picked up a guitar down picking felt much more natural than alternate picking but now I'm starting to realize I've made a serious mistake ignoring it.
I've always wanted being able to play kick ass down picked riff like that MoP riff.
So I practiced and practiced and built up speed until it sounded pretty good.
Meanwhile I practiced galloping as well but somewhere along the way it went wrong and now I'm re-learning to gallop the 'proper' way.
A couple days ago I realized why this happened.

Let's take this riff from MoP as an exmaple:

A |-----2-----3-----4-----3-----2-2-- [...]
E |-0-1---0-1---0-1---0-1---0-1------ [...]
    D D D D D D D D D D D D D D D D

This is played at 218 bpm, so it's pretty fucking fast.
Down picking obviously implies performing a down stroke, then bringing the pick back up without hitting the string and down pick again and doing this really really fast.
Now let's take this basic gallop:

E |-0--0-0-0--0-0-0--0-0-0--0-0-0-- ...
    D  D U D  D U D  D U D  D U D

And this is where my problem starts...
I'm so used at performing the D-D movement, I'm now having the greatest problems performing a basic DUD movement.
Instead I noticed I perform a gallop like this:

E |-0--0-0-0--0-0-0--0-0-0--0-0-0--
    D  U D U  U D U  U D U  U D U

Somewhere along the way my brain decided to perform a gallop, which is a form of alternate picking of course, starting with an 'up' movement to, I guess, differentiate between the regular down stroke and an alternate pick.
When doing faster alternate picked stuff I caught myself starting with an 'up' movement as well, losing speed, needlessly creating extra hand movement so losing efficiency while doing so.
Detecting and realizing why one makes mistakes is the first step, right.
So now I've got to unlearn starting an alternate series with an up stroke by default and that's easier said than done.

17 February 2012

Dunlop Black Fang vs Ultex Sharp

Disclaimer:
This basically is one big Dunlop advertisement, so deal with it.
No, I'm not getting paid to do this and if you're reading this, Dunlop dudes: why the fuck don't you lot answer my emails?

Anyways, for what it's worth: a bit of history first... maybe this'll help someone.

Since I started learning playing the guitar I've been a bit obsessed with finding the perfect pick for me.
I noticed very early on the kind of pick I used greatly affected my playing.
The dude in the music store I bought my first guitar at (grossly overpriced, but what did I know... bastards) recommended those floppy light nylon ones, I tossed those after 5 minutes. That started my search for the perfect pick... (still haven't found the Pick of Destiny)

I recently fell in love with Dunlop's Ultex Sharps 1.0.
I already was using regular Ultex which I love for the material it's made of: durable, very nice sound and they don't slip as much as, let's say, the Tortex ones.
The Tortex ones, I used the green 0.88 ones, were great at first, but they wear down as fast as hell and they get incredibly slippery after half an hour of use.
Now, before Tortex I used the famous Jazz III for quite a while.
Incredible picks, I bought a couple of them and only had to grab another one when I lost one. They last forever, they really do.
The sharp tip was so great to use and the small size forced me learning to pick more accurately, which was great as well at first.
They only have one major downside: they're extremely slippery.
Heh, I used to cut them up with a knife to increase friction.
So when I heard Dunlop would release a Max Grip version I immediately placed an order at the local music store.
The Max Grip version has this diamond plate thing going on on the surface which really works and I used them for quite some time as well.
After a while I grew tired of the additional harmonics I created while playing fast riffs as the thumb of my picking hand would keep hitting the strings because of the small size of the pick.
Yes, I know, it's all technique and all and I guess I just suck.
But that lead me back to normal sized picks.
Ultex ones were the next ones I tried but I really missed having a sharp tip.
Apart from that Ultex is an amazing pick: the brightness of the tone it produces is amazing .
After another trip to the Dunlop site I saw the Ultex Sharp ones... and placed an order at my local music store.

Btw, start seeing a pattern here? For some arcane reason they don't stock a great variety of picks, I wonder why...
Anyways, about 2 weeks later they arrived and I fell in love.
Lightweight, durable with a sharp tip and they produce a great sound. I absolutely love them.

I noticed people talking about Hetfield's Black Fangs on a couple websites.
Looking at the specs it seemed just a branded Ultex Sharp in varying thicknesses the regular ones aren't available at and way more expensive of course.
Rephrase: ridiculously more expensive.
They go €7,50 for 6 here which is 2.5 times more than what I buy the regular ones for.
Just because of that I wouldn't buy them but it kept bugging me: was it really just a Ultex Sharp in another color, another gauge and with a fancy drawing on it or was there something else going on?
Reviews just reviewed the pick, not comparing it to a regular Ultex Sharp of course, that'd be too obvious and easy... sigh.

Then, my mother got me some as a present (thanks, Lien!) so when I got home I tried the Black Fang and Ultex Sharp back-to-back, not expecting much difference.
The first thing I noticed about Black Fang is it's a much rougher texture than regular Ultex, which is smooth as a baby's bottom.
They're exactly the same size, apart from the thickness that is.
So without further ado, here's my take on Ultex Sharp vs Black Fang:

Black Fang is better.

There's no sound difference at all but due to the rougher texture they're so much more enjoyable to hold as they're even less slippery than the regular Ultex and a bit more durable as far as I can see.
And, let's be honest here, they're just plain fucking cool; appealing to my inner Metallica fanboy even.
A black rhino silhouette on transparent yellow doesn't exactly scream metal to me.

That's it.
So, are they worth the money? Hard to say, isn't it... how much do you want to spend on a pick?
One could spend 1000's on guitars, amps and effect pedals while saying 'you get what you pay for'.

I used to say €7,50 for 6 picks is ridiculous, but I'm not too sure anymore.
Time will tell which ones I'll buy next, but chances are it'll be Black Fang.


01 February 2012

DHCP IP end is not in the subnet or not autorized

Yesterday night the Sagem bridge supplied by my ISP suddenly decided to reboot around 4:00.
Remote firmware update? I don't think so, the firmware build number seems pretty old.
Anyways, afterwards dhcp wasn't working anymore.
Turns out the dhcp server configuration was changed to serve 192.168.1.100 to 192.168.1.63...
Trying to change the .63 to something like 120 simply didn't work, the damn thing refuses to accept anything over 63... "DHCP IP end is not in the subnet or not autorized".
So I changed the dhcp config to serve 192.168.1.10-50, now it works again.

Firmware-VTU-R:5.5.1.2IK105012 Time Oct 1 2009, 14:04:47

31 January 2012

Why du and df report different disk usage.

Two different programs with two different goals.
du: diskusage, df: diskfree.
du is used to see how much space is used by files and folders on a file system.
df is used to see how much space is used/free on a partition.
Big difference.

du and df will report different disk usage and there are two main reasons.
Indeed, there are two main reasons and for some arcane reason when I hear people talking about this subject they almost never mention both possibilities.

du calculates the amount of space used by stuff on the file system by (special) files and directories.
df looks at the file system usage: how many blocks are available and how many blocks are used.
As file systems use some disk space to store meta data about the stuff on the file system, so even on an 'empty' file system df will still report a usage of a couple of MB, depending on the options chosen at creation time of course.
That metadata consists of inode tables, superblocks, extended attributes etc.
Those bits have to be stored somewhere, hence the difference in reported size.

The other reason they can differ in output is open file descriptors.
Let's say you edit a file and delete it from another terminal.
df won't report the used size as the inode isn't pointing anymore to the file (it was dereferenced after all), but du will still include the file in its calculation as the file is still open.
This situation is also valid in case where defunct processes are still keeping files open which are since long deleted.

Disclaimer: this is at least true on GNU/Linux and *BSD systems.

30 January 2012

Linux: about swap


I can't even begin to count how many time I've heard this argument: "You don't really need swap space as in an ideal situation your system shouldn't be swapping anyhow."

Well...*sigh*... no.

Linux has this little cool thing called swapiness; it's a number between 0 and 100, basically telling Linux how fast it should swap out unused applications.
That's right: how fast... not if.
Setting swapiness to 0 will result in Linux avoiding swapping out stuff as long as possible, turn it up to 100 and Linux will swap out agressively, trying to have as much free physical memory available at all time.
Everything in between 0 and 100... well, you get the picture.

Swapping out stuff is a good thing!
I'm not going to start a crusade to set swapiness to 100, but c'mon... don't tell me an application running 24/7 but only occasionally actually doing something should keep all its data in physical memory.
I like the idea of Linux swapping it out to disk, freeing valuable and expensive physical memory for something important in need of fast memory space.
Have a look on your system right now, do a  cat of /proc/sys/vm/swappiness.
I'm willing to bet it's not set to 0.

What I'm trying to say here is swap is a cool system, but it depends on what you're building.
Some systems can benefit greatly of having swap space at their disposal, sometimes you just want to run everything in RAM all the time.

Oh and btw: not having swap space at all is fucking retarded (we're talking desktops and servers here, not embedded stuff).

23 January 2012