Tuesday, November 30, 2010

Adding XSUB support to GStreamer

So I have been working on adding XSUB support to GStreamer as a landing task at my new job. To be honest, I didn't expect it to go as easy. Don't get me wrong, I do know most subpicture encoding schemes are kind of trivial, what I expected to be hard was to work with the GStreamer's plugin API, which was a completely new monster for me. Long history short; with the help of several coworkers and some good documentation, I have patch ready to be tested. There are still a few things here and there that might benefit from some tweaking but overall the code does its job and its in dire need of some testing love :) Dunno how long it would take for it to land in -bad but for the time being you can follow current development here.

If you want to test the code you might consider using a pipeline along these lines:

gst-launch-0.10 -v --gst-debug=xsub:5 xsub name=overlay show-background=FALSE ! ffmpegcolorspace ! xvimagesink filesrc location=/somepath/small.divx ! avidemux name=d d.video_00 ! queue ! decodebin2 ! ffmpegcolorspace ! overlay.video_sink d.video_01 ! queue ! overlay.xsub_sink
I'd put some screenshots here but I have been unable to find samples I can share.

Monday, October 18, 2010

Making great ER diagrams without drawing


This one will be short :-)

I needed to draw a decent looking Entity Relationship diagram for an academic assignment --BORING. This is the kind of thing that makes me wonder why I surrendered my soul to this degree hunting battle. Anyway, there are two utilities (Maybe more, who knows) that might help the candidate ER Michelangelo: Dia and kivio. Now, if you are into buttons and mousing that's all you should need; pick one, search for some online examples and you will be done in no time. Chances are your drawing will look like shit but then again, you'd be an artist you proly wouldn't be reading this anyway. Now, I'm not really into WYSIWYG so I searched a little more and discovered a life savior: The Tikz-er2 LaTeX package.

Not wanting to bore you more than what's strictly needed to communicate my joy, here is a complete example almost right from the documentation.



Neat isn't it?

Well, If you are still interested you should take a look at the
package documentation. It's quite short, just a few pages
long. For the time being and to aid your experiments here
is the LaTeX source for the above displayed diagram:

\documentclass[a4paper,10pt]{report}
\usepackage{ucs}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{tikz-er2}

\usetikzlibrary{positioning}
\usetikzlibrary{shadows}

\tikzstyle{every entity} = [top color=white, bottom color=blue!30,
draw=blue!50!black!100, drop shadow]
\tikzstyle{every weak entity} = [drop shadow={shadow xshift=.7ex,
shadow yshift=-.7ex}]
\tikzstyle{every attribute} = [top color=white, bottom color=yellow!20,
draw=yellow, node distance=7em, drop shadow]
\tikzstyle{every relationship} = [top color=white, bottom color=red!20,
draw=red!50!black!100, drop shadow]
\tikzstyle{every isa} = [top color=white, bottom color=green!20,
draw=green!50!black!100, drop shadow]

\begin{document}
\begin{tikzpicture}[node distance=8em, every edge/.style={link}]
\node[entity] (persona) {Persona};
\node[attribute] (pid) [left of=persona] {\key{id\_persona}} edge (persona);
\node[attribute] (name) [below left of=persona] {nombre} edge (persona);
\node[multi attribute] (fono) [above of=persona] {fono} edge (persona);
\node[attribute] (anex) [right of=fono] {anexo} edge (fono);
\node[attribute] (number) [below left of=fono, node distance=5em] {number} edge (fono);
\node[attribute] (email) [above right of=persona] {email} edge (persona);
\node[relationship] (pertenece) [right of=persona] {Pertenece} edge node[auto,swap] {1:1} (persona);

\node[entity] (depto) [right of=pertenece] {Depto} edge node[auto,swap] {0:N} (pertenece);
\node[attribute] (iddepto) [above of=depto] {\key{id\_depto}} edge (depto);
\node[attribute] (dname) [above right of=depto] {d\_name} edge (depto);
\node[rectangle, draw=black, fit=(pertenece), inner sep=0em] (ipertenece) {};
\node[relationship] (tieneun) [below of=pertenece] {Ocupa} edge node[auto,swap] {1:1} (pertenece);

\node[entity] (cargo) [right of=tieneun] {Cargo} edge node[auto,swap] {0:N} (tieneun);
\node[attribute] (idcargo) [right of=cargo] {\key{id\_cargo}} edge (cargo);
\node[attribute] (cname) [above right of=cargo] {c\_name} edge (cargo);
\node[attribute] (plevel) [below right of=cargo] {nivel} edge (cargo);

\node[relationship] (responde) [below of=persona] {Responde} edge node[auto,swap] {1:N} (ipertenece);

\node[entity] (pregunta) [below of=tieneun] {Pregunta};
\node[attribute] (idpreg) [below of=pregunta] {\key{id\_preg}} edge (pregunta);
\node[attribute] (ptexto) [below right of=pregunta] {p\_texto} edge (pregunta);
\node[attribute] (pnumber) [right of=pregunta] {p\_numero} edge (pregunta);

\node[relationship] (tiene) [below of=responde] {Tiene} edge node[auto,swap] {1:N} (pregunta) edge node[auto,swap] {0:N} (responde);
\node[rectangle, draw=black, fit=(tiene), inner sep=0em] (itiene) {};

\node[entity] (alternativa) [left of=tiene] {Alternativa} edge node[auto,swap] {1:1} (tiene);
\node[attribute] (idalt) [above of=alternativa] {\key{id\_altern}} edge (alternativa);
\node[attribute] (atexto) [below of=alternativa] {a\_texto} edge (alternativa);
\node[attribute] (anumber) [below right of=alternativa] {a\_numero} edge (alternativa);
\end{tikzpicture}
\end{document}


Hope it helps.

Tuesday, June 15, 2010

Attempting to filter out the annoying Vuvuzela with MPlayer

So, just followed an Slashdot link that got me to a lifehacker post about removing the infamous Vuvuzela sound from the FIFA 2010 worldcup broadcasts by equalizing out ~250 and ~500 Hz respectively. Now, as some of you might know, with MPlayer -af equalizer you can attempt such procedure.

Here is a quick cmd line for you to try out:

mplayer -af resample=192000,equalizer=0:0:0:-12:-12:0:0:0:0:0 [someavfile]

The resampling is almost guaranteed to be needed, otherwise the equalizer will throw away everything above your original material's sample rate. You might also want to try out sinesupress from the -af filters, let me know if you get any better results with that approach.