2009年2月8日 星期日

convert fb's raw data to png

if you want to check your last display from fbdev,
you can "cat /dev/fb0 > fb0.raw" and review it by converting png file.

#!/usr/bin/perl -w

$w = shift || 240;
$h = shift || 320;
$pixels = $w * $h;

open OUT, "|pnmtopng" or die "Can't pipe pnmtopng: $!\n";

printf OUT "P6%d %d\n255\n", $w, $h;

while ((read STDIN, $raw, 2) and $pixels--) {
$short = unpack('S', $raw);
print OUT pack("C3",
($short & 0xf800) >> 8,
($short & 0x7e0) >> 3,
($short & 0x1f) << 3);
}

close OUT;

2009年2月4日 星期三

mkh264 with ES only

REF:Levi
mkh264.sh

#!/bin/bash
: ${1?"Usage: $0 <filename>"}
mkfifo stream.y4m
mplayer ${1} -nosound -benchmark -vf scale=720:-10,rotate=1 -vo yuv4mpeg:file=stream.y4m > LOG &
x264 -q 3 --bframes 0 --no-cabac -o `basename ${1}`.264 stream.y4m `awk '/VO/{print $3}' LOG`
rm -f stream.yuv stream.y4m LOG