niedziela, 30 stycznia 2011

ffserver + ps3 eye or logitech webcam = madness

I tried many times run streaming server from server room. I'm using ffmpeg for converting video files so I would use that software for streaming (default ffmpeg rpm from OpenSuse 11.3). Finally after many changes of configuration. I understand that my version of ffmpeg is just broken (I didn't found any solution to my problem's). Latest sources from http://www.ffmpeg.org/ (http://www.ffmpeg.org/releases/ffmpeg-0.6.1.tar.gz) works very well with minimum of configuration.

All I had to do is comment lines for streaming in mpeg and uncomment streaming in swf:

<Stream test.swf>
Feed feed1.ffm
Format swf
VideoSize 320x240
VideoFrameRate 10
VideoIntraOnly
NoAudio
</Stream>

Finaly and executed:

./ffserver -f ffserver.conf &
./ffmpeg -f video4linux2 -i /dev/video0 -f ffm http://127.0.0.1:8090/feed1.ffm

środa, 26 stycznia 2011

How to configure linux to act as advertisement display part 1

From some time I'm working on system to display ads (this is not main purpose of this system) in places like pub's and shops.
Every device consist of 17 inch display and computer (HP t5720 thin client) with linux installed on pendrive. Computer is connected to internet by wireless network (usb wifi card).
I chose OpenSuse 11.3 distribution because I used this distro before (I think that's good reason :)
There was couple of problems with installation (mostly with grub) but now I have a installed system which i can simply copy many time without a problem. The main problem is a configuration of grub to run copied system on every pendrive. We have to change mapping of storage device in /boot/grub/menu.lst

Default settings after OpenSuse installation

root (hd0,1)
kernel /boot/vmlinuz-2.6.34-12-desktop root=/dev/disk/by-id/usb-Kingston_DT101_II_0019E06B0840AA3107620383-0:0-part2 resume=/dev/disk/by-id/usb-Kingston_DT
101_II_0019E06B0840AA3107620383-0:0-part1 splash=silent quiet showopts vga=0x31a

Change to (in my situation):

root (hd0,1)
kernel /boot/vmlinuz-2.6.34-12-desktop root=/dev/sda2 resume=/dev/sda2 splash=silent quiet showopts vga=0x31a

I updated grub from my development computer so I had to change also /boot/grub/device.map to

(hd0) /dev/sdb

and run command:

root# grub-install.unsuported --root-directory=/media/mounted_disk/ /dev/sdb

Thank's to simple linux tool called dd:

Example for backup whole pendrive image:

root# dd if=/dev/sdb of=my_iso.iso

We can of course reverse this for creating new installation:

root# dd if=my_iso.iso of=/dev/sdb

If you have to look into this raw image and found a specific file You have to just mount saved disk image. But I made backup of all partitions of disk and can't mount like mount -o loop -t ext4 file.iso /mnt/image.

Solution is to show mount command where is the beginning of my root partition, we can found start byte using parted utility.

parted my_image.iso

next type u b for change default unit to bytes
and p to print partition

this is a example result:

GNU Parted 2.2
Using /home/marian/my_image.iso
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) u b
(parted) p
Model: (file)
Disk /home/marian/my_image.iso: 8024752128B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 1048576B 731906047B 730857472B primary linux-swap(v1) type=82
2 731906048B 8024752127B 7292846080B primary ext4 type=83

(parted) q

now we know that root partition starts with 731906048B byte so:

mount -o loop,offset=731906048 -t ext4 my_image.iso /mnt/image

we can mount and start using root filesystem.

niedziela, 23 stycznia 2011

Dobra rada...

... dla zapominalskich jak ja.
Zawsze rób listę zakupów mimo że to czego potrzebujesz wydaje się oczywiste.