1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-12-22 15:13:54 +02:00

mlt/wpan-ipv4/: demo setup and editing process for the wpan-ipv4 video

This commit is contained in:
Werner Almesberger 2011-05-15 02:57:49 -03:00
parent 311ce9db37
commit 5ae2c4677f
6 changed files with 315 additions and 0 deletions

50
mlt/wpan-ipv4/README Normal file
View File

@ -0,0 +1,50 @@
Demo setup
----------
Two Ben NanoNotes. We'll call them ben1 and ben2. Each has an atben
board and the usual software stack (WPAN-enabled kernel with TUN,
lowpan-tools, and ben-wpan's dirtpan.)
scp ben1 ben1.rmt pex ben1:
scp ben2 pex ben2:
ben1:
rm -f lease
./ben1
ben2:
./ben2
Audio and video editing
-----------------------
Prerequisites:
melt 0.5.4 or better (from MLT)
sox
mplayer or equivalent
# Raw files: the original video recording and and audio track.
# Warning: these files are big. 327 MB for the video, 39 MB for the audio.
wget http://downloads.qi-hardware.com/people/werner/wpan/tmp/raw/MVI_1374.MOV
wget http://downloads.qi-hardware.com/people/werner/wpan/tmp/raw/p97-3.wav
# Adjust the speed of the audio track to match the video clip.
# Also reduce the bass a little, to avoid clipping.
# Takes about 335 s on a Q6600
sox p97-3.wav p97-3fast.wav speed 1.005 bass -3
# Edit the video clip and encode as Theora.
# Takes about 5 min on q Q6600
./edit | sh
# Play the resulting 18 MB, 209 s video
mplayer wpan-ipv4.ogg
The result is on
http://downloads.qi-hardware.com/people/werner/wpan/tmp/wpan-ipv4.ogg

11
mlt/wpan-ipv4/ben1 Executable file
View File

@ -0,0 +1,11 @@
#!./pex
!dmesg -n 1
!clear
iz add wpan-phy0
ip link set wpan0 address ca:fe:ca:fe:ca:fe:ca:fe
ifconfig wpan0 up
izcoordinator -d 1 -l lease -i wpan0 -p 0x777 -s 1 -c 11 &
dirtpan 777 1 8001 'ifconfig $ITF 10.0.0.1 dstaddr 10.0.0.2 up'

4
mlt/wpan-ipv4/ben1.rmt Executable file
View File

@ -0,0 +1,4 @@
#!./pex
echo hello >/dev/tty0
pstree
exit

14
mlt/wpan-ipv4/ben2 Executable file
View File

@ -0,0 +1,14 @@
#!./pex
!dmesg -n 1
!clear
iz add wpan-phy0
ip link set wpan0 address be:e2:be:e2:be:e2:be:e2
ifconfig wpan0 up
iz assoc wpan0 777 1 11 short
dirtpan 777 8001 1 'ifconfig $ITF 10.0.0.2 dstaddr 10.0.0.1 up' &
ping -c 10 10.0.0.1
:ssh 10.0.0.1
ssh -t 10.0.0.1 ./ben1.rmt

213
mlt/wpan-ipv4/edit Executable file
View File

@ -0,0 +1,213 @@
#!/bin/sh
#
# Edit the wpan-ipv4 demo clip
#
# Written 2011 by Werner Almesberger
# Copyright 2011 Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
F=MVI_1374.MOV
debug=false
seg=1
pos=0
seg()
{
echo '' -video-track -blank $pos $F in=$1 out=$2 \\
$debug && echo -attach watermark:+#$seg.txt \\
start=$pos
pos=`expr $pos + $2 - $1`
end=$pos
seg=`expr $seg + 1`
}
say()
{
echo '' -track -blank $1 pango text="\"$3\"" in=$1 out=$2 \\
echo '' align=1 fgcolour=0xffffffff bgcolour=0x00000040 weight=400 \\
echo '' -transition composite out=$end geometry=0%,50%:100%x10% \\
echo '' halign=c a_track=0 \\
}
overlay()
{
echo '' -track -blank $1 pango text="\"$3\"" in=$1 out=$2 \\
echo '' align=1 fgcolour=0x00000030 weight=600 \\
echo '' -transition composite out=$end geometry=-1%,94%:100%x6% \\
echo '' halign=r \\
[ "$4" ] && echo a_track=$4 \\
}
endtitle()
{
echo '' -track -blank $1 pango text="\"$3\"" in=$1 out=$2 \\
echo '' align=1 fgcolour=0x000000ff weight=600 \\
echo '' -transition composite out=$end geometry=0%,50%:100%x10% \\
echo '' halign=c a_track=$4 \\
}
cmd()
{
e=`expr $2 - 1`
echo '' -track -blank $1 pango text="\"$3\"" in=$1 out=$e \\
echo '' align=1 fgcolour=0xffff40ff weight=600 \\
echo '' -transition composite out=$end geometry=0%,83%:100%x7% \\
echo '' halign=c a_track=0 \\
}
explain()
{
echo '' -track -blank $1 pango text="\"$3\"" in=$1 out=$2 \\
echo '' align=1 fgcolour=0x000000ff bgcolour=0xc0c0ffc0 weight=400 \\
echo '' -transition composite out=$end geometry=$4%,90%:100%x7% \\
echo '' a_track=0 \\
}
label()
{
echo '' -track -blank $1 pango text="\"$3\"" in=$1 out=$2 \\
echo '' align=1 fgcolour=0xff2020ff weight=600 \\
echo '' -transition composite out=$end geometry=$4%,$5%:100%x10% \\
echo '' a_track=0 \\
}
echo melt \\
echo colour:black out=50 \\
seg 0 470 # 1
echo '' -transition luma in=0 out=50 \\
echo '' -audio-track p97-3fast.wav in=60 \\
# "resample" sux - do this in SOX
#echo '' -filter resample frequency=47000 \\
seg 486 517 # 2
seg 712 1864 # 3
seg 1897 2785 # 4
seg 2874 3082 # 5
seg 3164 3300 # 6
seg 3450 3889 # 7
seg 4019 4703 # 8
seg 4764 5595 # 9
seg 5731 6103 # 10
seg 0 580 # filler
echo '' -track -blank 5130 colour:white in=5130 out=5200 \\
echo '' -transition luma in=5130 out=5200 a_track=0 \\
echo '' -track -blank 5200 colour:white in=5200 out=5800 \\
overlay 5200 5600 "2011 by Werner Almesberger, CC-BY-SA"
endtitle 5250 5600 "THE BEGINNING" 13
overlay 10 100 "2011 by Werner Almesberger, CC-BY-SA" 0
overlay 5150 5200 "2011 by Werner Almesberger, CC-BY-SA" 0
label 70 150 "ben1" 35 59
label 110 150 "ben2" 63 66
say 230 280 "We won't need that"
label 415 447 "OpenWRT" 20 51
cmd 487 620 "iz add wpan-phy0"
say 530 620 "Add WPAN interface"
cmd 630 730 "ip link set wpan0 ..."
cmd 730 840 "... address ca:fe:ca:fe:ca:fe:ca:fe"
say 680 840 "Set MAC address"
cmd 850 960 "ifconfig wpan0 up"
say 900 960 "Enable WPAN interface"
cmd 970 1140 "izcoordinator -d 1 -l lease -i wpan0 ..."
explain 1020 1140 "Debug" 33
explain 1040 1140 "Lease file" 48
explain 1060 1140 "Interface" 70
cmd 1140 1290 "... -p 0x777 -s 1 -c 11 &"
explain 1190 1290 "PAN" 35
explain 1210 1290 "Self" 51
explain 1230 1290 "Chan" 62
explain 1250 1290 "Fork" 75
say 1100 1290 "WPAN coordinator"
label 1660 1710 "Jlime" 55 53
cmd 1770 1930 "iz add wpan-phy0"
say 1800 1930 "Add WPAN interface"
cmd 1940 2040 "ip link set wpan0 ..."
cmd 2040 2170 "... address be:e2:be:e2:be:e2:b2:e2"
# don't explain the joke :-)
#cmd 2040 2140 "... address be:e2:be:e2:be:e2:b2:e2"
#cmd 2141 2170 "... address be:eR:be:eR:be:eR:be:eR"
say 2000 2170 "Set MAC address"
cmd 2180 2277 "ifconfig wpan0 up"
say 2230 2277 "Enable WPAN interface"
cmd 2280 2520 "iz assoc wpan0 777 1 11 short"
explain 2300 2370 "PAN" 52
explain 2320 2370 "Coordinator" 62
explain 2400 2520 "Chan" 58
explain 2420 2520 "Short addr" 73
say 2340 2520 "Get WPAN address"
label 2550 2600 "<-- Request" 40 50
label 2620 2670 "Response -->" 20 55
cmd 2780 2880 "Received short address 8001"
say 2950 3040 "Set up IP tunnel"
cmd 3000 3150 "dirtpan 777 1 8001 ifconfig ..."
explain 3050 3150 "PAN" 32
explain 3070 3150 "Self" 41.2
explain 3090 3150 "Peer" 50
cmd 3150 3300 "... $ITF 10.0.0.1 dstaddr 10.0.0.2 up"
explain 3200 3300 "Local" 24
explain 3220 3300 "Remote" 63
say 3330 3400 "The other end ..."
say 3410 3500 "... of the tunnel"
cmd 3410 3550 "dirtpan 777 8001 1 ifconfig ..."
explain 3450 3550 "PAN" 33
explain 3470 3550 "Self" 45.5
explain 3490 3550 "Peer" 56
cmd 3550 3700 "... $ITF 10.0.0.1 dstaddr 10.0.0.2 up"
explain 3600 3700 "Local" 24
explain 3620 3700 "Remote" 63
cmd 3700 3960 "ping -c 10 10.0.0.1"
say 3750 3960 "Test the connection"
cmd 4170 4380 "ssh 10.0.0.1"
cmd 4403 4470 "root@10.0.0.1 password:"
cmd 4475 4605 "echo hello >/dev/tty0"
explain 4500 4605 "Console" 56
cmd 4770 4825 "hello"
cmd 4870 4950 "pstree"
cmd 4970 5070 "exit"
if $debug; then
echo '' -consumer sdl audio_off=1
else
echo '' -consumer avformat f=ogg vcodec=libtheora \\
echo b=600k acodec=libvorbis '>wpan-ipv4.ogg'
fi

23
mlt/wpan-ipv4/pex Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
in=$1
prompt="${1##*/}"
prompt="${prompt%.*}"
shift
{
read c
while read c; do
if [ "${c#!}" != "$c" ]; then
eval "${c#!}" </dev/tty
continue
fi
if [ "${c#:}" = "$c" ]; then
cmd=$c
else
c=${c#:}
read cmd
fi
echo -e -n "$prompt> \033[1m$c\033[m "
read x </dev/tty
eval "$cmd" </dev/tty
done
} <$in