Sunday, July 24, 2011

Mencoder webcam grab for youtube

Standard
I have been looking for an easy way to grab the signal from a regular USB webcam and get something from it that is usable on youtube. In the newer versions of ubuntu the /dev/audioN has been dropped from the kernel, so you have to use the audio signal from the ALSA layer instead. Here is how:


mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:alsa:adevice=hw.1:amode=1:channel=3:fps=30:audiorate=32000 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1500:keyint=25 -oac mp3lame -lameopts cbr:br=128:mode=3 -fps 30 -o webcam.avi


The output will be in mpeg4.

Saturday, July 9, 2011

Google hosting of services and djbdns

Standard
Introduction
I have just completed a clean up of the config on my local dns server running dns service on my local network. The one in my house behind the firewall. I left a lot of configuration residue from many configuration hacks / tweaks and so forth over the time.

I host the barnabas.dk domain internally on the LAN as well as on a public dns server, that lead you to this blog.

The advantage is, that I am able to let services resolve to different things internally and externally.

However, I spent a lot of time finding a solution to making http://blog.barnabas.dk resolve correctly from my internal server onto the Google hosting where it lives. With blogger.com.

Here is how:
I use the djbdns tools (tinydns / dnscache) for hosting dns on my LAN. It has a low footprint and is much much much easier to live with than bind. Also it runs perfectly with the supervise service setup.

This is the config:


#
# REVERSE ZONE
#
# (reverse) dns servers: primary and secondary
Z1.168.192.in-addr.arpa:ns.barnabas.dk:hostmaster.barnabas.dk::::::::

# NS records
&1.168.192.in-addr.arpa::ns.barnabas.dk:::

#
# FORWARD ZONE:
#
# SOA record: primary nameserver is ns.example.net and hostmaster
# mail address is hostmaster@example.net
# (the 'Z' configuration line is the only one that
# allows specifying the hostmaster mail address)
Zbarnabas.dk:bar.barnabas.dk:hostmaster.barnabas.dk::::::::

# NS records: primary nameservers
&barnabas.dk::bar.barnabas.dk:::

# ANAME records
=bar.barnabas.dk:192.168.1.2:3600::

# CNAME records:
Cfoo.barnabas.dk:bar.barnabas.dk:::
Cblog.barnabas.dk:ghs.google.com:::


Just simply add the entry for the Google service as a CNAME. I spent a lot of time trying to make it work with an ANAME record. You can, but you have to refer the IP address of the Google service. That could change if Google configure new setup so refering the ghs.google.com cannonical name is the best way to do it.