Thursday, September 13, 2012

Opus now/soon in gstreamer-plugins-bad-free


Opus is a new audio codec covering a wide range of use cases. You can read more about the codec (at least) here and here.

If you want to get started with it, just try a freshly rebuild gstreamer-plugins-bad-free package which packages the opus plugin.
You will be able to use the en- and decoders in your normal gst pipeline.

It should soon land as an update on Fedora near you.

[Update]
The update has landed in updates testing:
su -c 'yum update --enablerepo=updates-testing gstreamer-plugins-bad-free-0.10.23-11.fc18'

Saturday, September 8, 2012

Easier streaming with presence-0.4.8


Presence is a small - but yet flexible - tool to do simple and high-quality streaming (using dirac+vorbis over RTP) in a local broadcast domain.
When not using the MDNS feature this can also be endpoints on any routable network.
Not shown on in the screen shot, but a feature, is picture-in-picture mode for secondary streams.

Anyhow, this new release (0.4.8) contains an improvement related to publishing a stream. It's now done in two clicks with reasonable defaults, even for low-end machines.

Install or update it now on Fedora 16/17/18:
$ sudo yum clean metadata
$ sudo yum install --enablerepo=updates-testing presence
# or
$ sudo yum update --enablerepo=updates-testing presence

Or - hero-like -using this one-click technology.

The release was motivated by my new Logitech HD Pro Webcam C920 which is working out of the box on Fedora - so YUV and MJPEG besides the (unsupported) h.264 support.
When looking at the video quality of this camera and two built-in cameras of laptops, this is clearly a big step forward in image quality - So a decent camera is always a good way to improve a video conference.
As said, the video quality is great - and using MJPEG it can deliver a 720p video with up to 24fps, so ideal for telepresence. 

Monday, September 3, 2012

Screenshotting /dev/vcs

If you ever wanted to know how to take a "screenshot" of a VCS (where your login prompt is displayed) you can use the following snippet:
cat ../tests/igor/libs/common/vcs.py 
#!/bin/env python
#
# bash only:
# su -c 'cat /dev/vcs3 | fold -w $(stty size | cut -d " " -f 2) > /tmp/term'
#


import Image, ImageDraw
import subprocess
import argparse
import sys


def execute(cmd):
    proc = subprocess.Popen(cmd, shell=True, \
                            stdout=subprocess.PIPE, \
                            stderr=subprocess.STDOUT)
    (stdout, stderr) = proc.communicate()
    proc.wait()
    return str(stdout)

def get_size_of_tty(n):
    """Return the number of rows and cols of tty n
    """
    cmd = "stty -F /dev/tty%d size" % n
    rows, cols = execute(cmd).split(" ")
    return (int(rows), int(cols))

def capture_vcs(n, fold_at):
    """Return the contents of vcs n
    Thsi can also be used with (bash) fold -w
    """
    tty = "/dev/vcs%d" % n
    cmd = "cat %s | fold -w %d" % (tty, fold_at)
    return execute(cmd)

def image_from_vcs(n, stridex=6, stridey=12):
    """Create an image from vcs n
    """
    height, width = get_size_of_tty(n)
    im = Image.new(Image.MODES[6], (width * stridex, height * stridey))
    draw = ImageDraw.Draw(im)
    nl = 0
    screen = capture_vcs(n, fold_at=width)
    for line in screen.split("\n"):
        draw.text((0, stridey * nl), line)
        nl += 1
    return im

def screenshot_from_vcs(n, filename, format="png"):
    """Create a screenshot of a vcs and write it to a file
    """
    im = image_from_vcs(args.vcs)
    im.save(open(filename, "wb"), format.upper())

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Create a screenshot from ' +
                                                 'a console.')
    parser.add_argument('vcs', type=int,
                        help='The VCS/TTY to be captured')
    parser.add_argument('--format', metavar='t', type=str,
                        choices=['png'], default="png",
                        help='The image format')
    parser.add_argument('file', metavar='dst', type=str,
                        help='The destination file')
    args = parser.parse_args()
    screenshot_from_vcs(args.file, args.format.upper())
The images can be used to create a screen capture of your console.