Esempio di richiesta di un media, wall3.mpg, al server Helix. Il file, in formato Program Elementary Stream, presenta una sola traccia video codificata con codec mpeg-1. Si noti il paradigma di comunicazione RTSP tra client e server, con le richieste in termini di metodi del client e le relative risposte del server. Si noti inoltre, lindicazione diagnostica di tutti i processi effettuati da mplayer per dare luogo alla riproduzione includendo, tra laltro, lindicazione della particolare libreria necessaria alla decodifica. Si è utilizzata come si vede lopzione v per evidenziare tali passaggi.
[tomosan@genni media]$ mplayer -v rtsp://genni.ing.uniroma1.it:654/wall3.mpg
MPlayer 0.90pre8-2.96 (C) 2000-2002 Arpad Gereoffy (see DOCS)
CPU: Intel Pentium 4 Xeon Foster (Family: 8, Stepping: 2)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
Reading /usr/local/etc/mplayer/codecs.conf: 38 audio & 106 video codecs
CommandLine: '-v' 'rtsp://genni.ing.uniroma1.it:654/wall3.mpg'
get_path('font/font.desc') -> '/home/tomosan/.mplayer/font/font.desc'
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
Using usleep() timing
get_path('input.conf') -> '/home/tomosan/.mplayer/input.conf'
Parsing input config file /usr/local/etc/mplayer/input.conf
Input config file /usr/local/etc/mplayer/input.conf parsed : 50 binds
Playing rtsp://genni.ing.uniroma1.it:654/wall3.mpg
Connected to server: genni.ing.uniroma1.it
This stream is non-cacheable
Stream not seekable!
Sending request: DESCRIBE rtsp://genni.ing.uniroma1.it:654/wall3.mpg RTSP/1.0
CSeq: 1
Accept: application/sdp
User-Agent: mplayer (LIVE.COM Streaming Media v2002.09.10)
Received DESCRIBE response: RTSP/1.0 200 OK
CSeq: 1
Date: Mon, 18 Nov 2002 11:58:31 GMT
Set-Cookie: cbid=jffjjmdicjdflldmeokroultrojrktlufkcgkidlhjffllplmnmrqpgqqoonoqouikqgfhhi;path=/;expires=Thu,31-Dec-2037 23:59:59 GMT
vsrc: http://genni.ing.uniroma1.it:180/viewsource/template.html?nuyhtgAnnxz6h3vgrf2duebg12u157gdq357C7ct581AzA50dozi0m
Last-Modified: Tue, 16 Jul 2002 12:36:58 GMT
Content-base: rtsp://genni.ing.uniroma1.it:654/wall3.mpg/
Content-type: application/sdp
Content-length: 938
v=0
o=- 1026819418 1026819418 IN IP4 151.100.122.85
s=wall3.mpg
i=
c=IN IP4 0.0.0.0
t=0 0
a=SdpplinVersion:1610645029
a=DefaultLicenseValue:integer;1
a=StreamCount:integer;1
a=Title:buffer;"d2FsbDMubXBnAA=="
a=FileType:string;"MPEG1"
a=LicenseKey:string;"license.Summary.Datatypes.RealMPEG1.Enabled"
a=range:npt=0-25.098000
m=video 0 RTP/AVP 32
b=AS:1143
a=control:streamid=0
a=range:npt=0-25.098000
a=length:npt=25.098000
a=mimetype:string;"video/MPV"
a=Width:integer;384
a=StartTime:integer;0
a=AvgBitRate:integer;1142960
a=RMATimestampConversionFactor:integer;1
a=RTPTimestampConversionFactor:integer;90
a=AvgPacketSize:integer;1024
a=Height:integer;288
a=Preroll:integer;1500
a=HasOutOfOrderTs:integer;1
a=MaxPacketSize:integer;1500
a=MaxBitRate:integer;1714440
a=ASMRuleBook:string;"marker=0, Priority=9, timestampdelivery=true; marker=1, Priority=9, timestampdelivery=true;"
Initiated "video/MPV" RTP subsession
Sending request: SETUP rtsp://genni.ing.uniroma1.it:654/wall3.mpg/streamid=0 RTSP/1.0
CSeq: 2
Transport: RTP/AVP;unicast;client_port=33290-33291
User-Agent: mplayer (LIVE.COM Streaming Media v2002.09.10)
Received SETUP response: RTSP/1.0 200 OK
CSeq: 2
Date: Mon, 18 Nov 2002 11:58:31 GMT
Session: 1598649584-2
Reconnect: true
RDTFeatureLevel: 2
Transport: rtp/avp;unicast;client_port=33290-33291;server_port=27066-27067
Sending request: PLAY rtsp://genni.ing.uniroma1.it:654/wall3.mpg/streamid=0 RTSP/1.0
CSeq: 3
Session: 1598649584-2
Range: npt=0-
User-Agent: mplayer (LIVE.COM Streaming Media v2002.09.10)
Received PLAY response: RTSP/1.0 200 OK
CSeq: 3
Date: Mon, 18 Nov 2002 11:58:31 GMT
RTP-Info: url=rtsp://genni.ing.uniroma1.it:654/wall3.mpg/streamid=0;seq=0;rtptime=0
==>t; Found video stream: 0
Searching for sequence header... OK!
VIDEO: MPEG1 384x288 (aspect 1) 30.00 fps 131071.5 kbps (16383.9 kbyte/s)
[V] filefmt:21 fourcc:0x10000001 size:384x288 fps:30.00 ftime:=0.0333
get_path('sub/') -> '/home/tomosan/.mplayer/sub/'
X11 opening display: :0.0
vo: X11 color mask: FFFF (R:F800 G:7E0 B:1F)
vo: X11 running at 1024x768 with depth 16 and 16 bpp (":0.0" => local display)
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 384 x 288 (preferred csp: Mpeg PES)
Couldn't find matching colorspace - retrying with -vop scale...
Opening video filter: [scale]
SwScale params: -1 x -1 (-1=no scaling)
Sorry, selected video_out device is incompatible with this codec.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder v2.0
libmpeg2: Using MMXEXT for IDCT transform
libmpeg2: Using MMXEXT for motion compensation
VDec: vo config request - 384 x 288 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO Config (384x288->384x288,flags=1,'MPlayer',0x32315659)
VO: [xv] 384x288 => 384x288 Planar YV12 [fs]
VO: Description: X11/Xv
VO: Author: Gerd Knorr and others
Xvideo image format: 0x32595559 (YUY2) packed
Xvideo image format: 0x32315659 (YV12) planar
Xvideo image format: 0x30323449 (I420) planar
Xvideo image format: 0x59565955 (UYVY) packed
using Xvideo port 47 for hw scaling
[xv] dx: 0 dy: 0 dw: 384 dh: 288
Detected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2)
==========================================================================
Audio: no sound!!!
Freeing 0 unused audio chunks
Start playing...
*** [vo] Allocating mp_image_t, 384x288x12bpp YUV planar, 165888 bytes
[xv] dx: 0 dy: 0 dw: 1024 dh: 768
[xv-fs] dx: 0 dy: 0 dw: 1024 dh: 768
*** [vo] Allocating mp_image_t, 384x288x12bpp YUV planar, 165888 bytes
EOF code: 1 4% 6% 0.0% 0 0 0%
[tomosan@genni media]$
Esempio di richiesta RTSP di un media codificato in MPEG-4 video ed audio AAC.
[tomosan@genni tomosan]$ [tomosan@genni tomosan]$ gmp4player rtsp://genni.ing.uniroma1.it:654/mpg4video.mp4 gmp4player 11:15:43.539-plugin-6: Adding audio plugin rawa /usr/local/lib/mp4player_plugin/raw_audio_plugin.so 11:15:43.543-plugin-6: Adding audio plugin celp /usr/local/lib/mp4player_plugin/celp_plugin.so 11:15:43.543-plugin-6: Adding video plugin rawv /usr/local/lib/mp4player_plugin/raw_video_plugin.so 11:15:43.547-plugin-6: Adding video plugin xvid /usr/local/lib/mp4player_plugin/xvid_plugin.so 11:15:43.549-plugin-6: Adding video plugin mpeg3 /usr/local/lib/mp4player_plugin/mpeg3_video_plugin.so 11:15:43.550-plugin-6: Adding RTP plugin mpeg4-generic /usr/local/lib/mp4player_plugin/isma_rtp_plugin.so 11:15:43.553-plugin-6: Adding audio plugin aac /usr/local/lib/mp4player_plugin/aac_plugin.so 11:15:43.555-plugin-6: Adding audio plugin mp3 /usr/local/lib/mp4player_plugin/mp3_plugin.so 11:15:43.574-plugin-6: Adding video plugin MPEG4 ISO /usr/local/lib/mp4player_plugin/mpeg4_iso_plugin.so 11:15:43.574-plugin-6: Adding audio plugin wav /usr/local/lib/mp4player_plugin/wav_plugin.so 11:15:43.642-my_player-7: Creating streaming rtsp://genni.ing.uniroma1.it:654/mpg4video.mp4 11:15:43.663-plugin-7: Found matching video plugin MPEG4 ISO 11:15:43.663-plugin-7: Found matching audio plugin aac 11:15:43.664-my_player-7: First port is 1024 11:15:43.664-my_player-7: Ip ports are 1024 1025 11:15:43.724-media-6: Transport returned is rtp/avp;unicast;client_port=1024-1025;server_port=13232-13233 11:15:43.727-my_player-7: First port is 1026 11:15:43.727-my_player-7: Ip ports are 1026 1027 11:15:43.742-media-6: Transport returned is rtp/avp;unicast;client_port=1026-1027;server_port=7702-7703 11:15:43.769-media-6: Setting source address from rtsp - 151.100.122.85 11:15:43.772-media-6: Setting source address from rtsp - 151.100.122.85 11:15:44.091-media-7: media video - rtp tps 0 ntp per rtp 11:15:44.091-my_player-7: Starting rtp bytestream mpeg4-generic from plugin 11:15:44.092-ismartp-7: Rtp ts add is 1024 (32000 32000) 11:15:44.092-ismartp-7: min headers are 16 16 11:15:44.092-media-7: media audio - rtp tps 0 ntp per rtp 11:15:45.762-rtpbyst-6: video buffering complete - seq 0 head 0 tail 11100 2002 11:15:45.762-plugin-7: Found matching video plugin MPEG4 ISO iso throw 810 11:15:45.763-mp4iso-7: Caught exception in VOL mem header search iso throw 810 11:15:45.764-mp4iso-7: Caught exception in VOL mem header search iso throw 810 11:15:45.764-mp4iso-7: Caught exception in VOL mem header search 11:15:45.767-mp4iso-7: Found VOL in header 11:15:45.768-media-7: Starting MPEG4 ISO codec from decode thread 11:15:45.783-mp4iso-7: Back to normal decode 11:15:45.783-mp4iso-7: decode but no frame 0 11:15:45.813-rtpbyst-6: mpeg4-generic buffering complete - seq 0 head 0 tail 64512 2016 11:15:45.814-plugin-7: Found matching audio plugin aac 11:15:45.814-aac-6: AAC object type is 2 11:15:45.816-aac-6: Setting freq to 32000 11:15:45.816-media-7: Starting aac codec from decode thread 11:15:45.823-audiosync-7: buffer size 4096 msec per frame 32 11:15:45.824-aac-7: Back to good at 0 11:15:45.941-videosync-7: Created mscreen 0x810ec28 hxw 240 320 11:15:45.942-audiosync-7: Sample size is 1024 11:15:45.942-audiosync-6: requested f 32000 chan 2 format 8010 samples 1024 11:15:45.951-audiosync-6: got f 32000 chan 2 format 8010 samples 1024 size 4096 11:15:45.951-audiosync-5: Using delay measurement from SDL 11:15:45.951-avsync-7: Astart is 0 11:15:45.951-avsync-7: Resynced at time 0 0 11:15:45.983-avsync-7: Aisready 1038219345983 11:15:45.984-avsync-7: Audio is ready 0 - latency 0 11:15:45.984-avsync-7: m_start is f1bab2003f 11:15:45.995-avsync-7: Current time is 12 11:15:52.440-rtpbyst-7: video Timedout at range end - last 7040 range end 7741 11:15:52.441-rtpbyst-7: mpeg4-generic Timedout at range end - last 7552 range end 7712 11:15:52.448-media-6: audio hit eof 11:15:52.448-audiosync-7: Setting audio EOF 11:15:52.464-media-6: video hit eof 11:15:52.940-rtpbyst-7: mpeg4-generic Timedout at range end - last 7552 range end 7712 11:15:52.941-rtpbyst-7: video Timedout at range end - last 7040 range end 7741 11:15:53.440-rtpbyst-7: video Timedout at range end - last 7040 range end 7741 11:15:53.440-rtpbyst-7: mpeg4-generic Timedout at range end - last 7552 range end 7712 11:15:53.781-my_player-7: gui received finished message 11:15:53.781-my_player-7: rtp bytestream reset 11:15:53.782-my_player-7: rtp bytestream reset 11:15:57.331-media-7: closing down media 1 11:15:57.441-media-5: Video decoder skipped 0 frames 11:15:57.441-media-5: video - bytes 280824, seconds 7.04, fps 30.1136 bps 32094111:15:57.441-mp4iso-6: MPEG4 codec results: 11:15:57.441-mp4iso-6: total frames : 212 11:15:57.441-mp4iso-6: wait for I times: 0 11:15:57.441-mp4iso-6: wait I frames : 0 11:15:57.442-media-6: Media video 11:15:57.442-media-6: Time: 14 seconds 11:15:57.442-media-7: closing down media 0 11:15:57.443-media-5: audio - bytes 62374, seconds 7.552, fps 31.3824 bps 71284 11:15:57.443-media-6: Media audio 11:15:57.443-media-6: Time: 14 seconds 11:15:57.443-videosync-5: Video Sync Stats: 11:15:57.443-videosync-5: Displayed-behind frames 188 11:15:57.443-videosync-5: Total frames displayed 211 11:15:57.443-videosync-5: Max behind time 15 11:15:57.443-videosync-5: Average behind time 5 11:15:57.443-videosync-5: Skipped rendering 0 11:15:57.443-videosync-5: Filled frames 211 11:15:57.443-audiosync-5: Audio sync skipped 0 buffers 11:15:57.444-audiosync-5: didn't fill 0 buffers [tomosan@genni tomosan]$
A.3 File di configurazione per mp4live (livetv)
duration=2 file0=/dev/dsp file1=/dev/video0 audioInput=line audioChannels=1 videoInput=0 videoSignal=0 videoTuner=0 videoChannelListIndex=3 videoChannelIndex=44 videoFrameRate=25.000000 videoBitRate=150 recordEnable=0 rtpEnable=1 rtpDestAddress=151.100.122.85 rtpAudioDestPort=38430 rtpVideoDestPort=38428 rtpMulticastTtl=63 audioSampleRate=16000 audioEncoding=AAC sdpFile=/tmp/capturedalinkare.sdp audioBitRate=8 audioEncoder=faac videoRawWidth=320 videoRawHeight=240
#!/bin/sh
echo content-type: text/html
echo
eval `./proccgi.sh $*` > /dev/null
echo "<SCRIPT>"
echo "window.resizeTo(640,500);"
echo "</SCRIPT>"
if [ "$FORM_button" = play ]
then
if ( ls /tmp/testmp4live > /dev/null ) ; then
cat /tmp/testmp4live
exit 0
else touch /tmp/testmp4live
fi
echo
echo "<h2>attivo l'mp4live con la configurazione scelta...</h2>"
echo
echo duration="2" > /tmp/livetv
echo file0="/dev/dsp" >> /tmp/livetv
echo file1="/dev/video0" >> /tmp/livetv
echo audioInput="line" >> /tmp/livetv
echo audioChannels="$FORM_canaliaudio" >> /tmp/livetv
echo videoInput="0" >> /tmp/livetv
echo videoSignal="0" >> /tmp/livetv
echo videoTuner="0" >> /tmp/livetv
echo videoChannelListIndex="3" >> /tmp/livetv
echo videoChannelIndex="$FORM_videochanindex" >> /tmp/livetv
echo videoFrameRate="$FORM_videofr" >> /tmp/livetv
echo videoBitRate="$FORM_videobr" >> /tmp/livetv
echo recordEnable="0" >> /tmp/livetv
echo rtpEnable="1" >> /tmp/livetv
echo rtpDestAddress="151.100.122.85" >> /tmp/livetv
echo rtpAudioDestPort="38430" >> /tmp/livetv
echo rtpVideoDestPort="38428" >> /tmp/livetv
echo rtpMulticastTtl="63" >> /tmp/livetv
echo audioSampleRate="$FORM_freqaudio" >> /tmp/livetv
echo audioEncoding="$FORM_tipoaudio" >> /tmp/livetv
echo sdpFile="/tmp/capturedalinkare.sdp" >> /tmp/livetv
if [ "$FORM_freqaudio" = 44100 ]
then
if [ "$FORM_audiobr" = 8 -o "$FORM_audiobr" = 16 -o "$FORM_audiobr" = 24 ]
then
echo audioBitRate="56" >> /tmp/livetv
audio="56"
else
echo audioBitRate="$FORM_audiobr" >> /tmp/livetv
audio="$FORM_audiobr"
fi
fi
if [ "$FORM_freqaudio" = 16000 ]
then
echo audioBitRate="$FORM_audiobr" >> /tmp/livetv
audio="$FORM_audiobr"
fi
if [ "$FORM_tipoaudio" = AAC ]
then
echo audioEncoder="faac" >> /tmp/livetv
fi
case $FORM_size in
1) width="128" && height="96" ;;
2) width="176" && height="144" ;;
3) width="320" && height="240" ;;
4) width="640" && height="480" ;;
esac
echo videoRawWidth="$width" >> /tmp/livetv
echo videoRawHeight="$height" >> /tmp/livetv
case $FORM_videochanindex in
34) canale="reteA";;
38) canale="MTV";;
58) canale="teleambiente";;
55) canale="televita" ;;
47) canale="homeshopping" ;;
48) canale="telemarket" ;;
50) canale="GOLD" ;;
56) canale="telecampione" ;;
21) canale="EuropaTV" ;;
31) canale="TVR Voxon" ;;
32) canale="Super3" ;;
37) canale="GBR" ;;
25) canale="RaiDue" ;;
45) canale="Rete4" ;;
42) canale="Canale5" ;;
54) canale="Italia1" ;;
44) canale="La7" ;;
esac
case $FORM_videofr in
2.000000) fr="2 fps" ;;
6.000000) fr="6 fps" ;;
10.000000) fr="10 fps" ;;
14.000000) fr="14 fps" ;;
17.000000) fr="17 fps" ;;
20.000000) fr="20 fps" ;;
25.000000) fr="25 fps" ;;
esac
./tvlive.sh > /dev/null &
echo "<h3>...ora puoi ricevere il media all'url rtsp://genni.ing.uniroma1.it/capture.sdp</h3>"
echo
echo "hai scelto il canale: $canale<br>"
echo "la riproduzione è in atto con le seguenti caratteristiche:<br>"
echo "codifica video: MPEG4<br>"
echo "video bit rate: $FORM_videobr kbps<br>"
echo "frame rate: $fr<br>"
echo "dimensione quadro: $width"X"$height<br>"
echo "codifica audio: $FORM_tipoaudio<br>"
echo "canali audio: $FORM_canaliaudio<br>"
echo "frequenza di campionamento audio: $FORM_freqaudio Hz<br>"
echo "audio bit rate: $audio kbps<br>"
echo
echo "La risorsa televisiva e' impegnata nella trasmissione MPEG4<br>" >> /tmp/testmp4live
echo "Per partecipare alla trasmissione MPEG4 collegati con gmp4player o quicktime a rtsp://genni.ing.uniroma1.it/capture.sdp<br>" >> /tmp/testmp4live
echo "Per ulteriori informazioni sulla trasmissione MPEG4 qui a LabTel visita questa pagina<br>" >> /tmp/testmp4live
echo "Se ti interessa invece la videoconferenza in H323, visita questa pagina<br><br>" >> /tmp/testmp4live
fi
if [ "$FORM_button" = reset ]
then
if ( ls /tmp/testmp4live > /dev/null ) ; then
pidof mp4live > /tmp/pido.txt &
./pido > /dev/null
read pidtokill < /tmp/pidouno.txt
if [ "$pidtokill" = 1073834212 ]
then
echo "<h3>non posso resettare la trasmissione della TV in quanto essa non è in atto!</h3>"
cat /tmp/testmp4live
else
kill $pidtokill
echo "ho ucciso il processo con pid $pidtokill"
fi
else
echo "non è in atto alcun processo!"
fi
fi
#!/bin/sh /usr/local/bin/mp4live --file /tmp/livetv --sdp > /dev/null /usr/local/bin/mp4live --file /tmp/livetv --automatic --headless > /dev/null 2>&1 rm -f "/tmp/testmp4live"
#!/bin/bash
# From
# Advanced Bash-Scripting Guide
# An in-depth exploration of the gentle art of shell scripting
# Mendel CooperBrindle-Phlogiston Associates
# thegrendel@theriver.com
# 29 September 2002
while getopts "sf:htd:rx:y:" Option
# Initial declaration.
# s, and f are the options (flags) expected.
# The : after option 'f' shows it will have an argument passed with it.
do
case $Option in
f )
export FILE=$OPTARG;; # ll nome del file da leggere
# se assente, da standard input
s )
export SAVE="yes";; # salva le immagini
h )
export HELP="yes";;
t )
export TROUGH="yes";; # calcola il throughput
d )
export DELTAT=$OPTARG;; # il valore del dt se -t
r )
export RANGE="yes";; # permette di inserire un range tra i pacchetti
x )
export MINIMO=$OPTARG;; # il primo pacchetto del range se -r
y )
export MASSIMO=$OPTARG;; # l'ultimo pacchetto del range se -r
esac
done
shift $(($OPTIND - 1))
# Move argument pointer to next.
# All this is not nearly as complicated as it looks <grin>.
octave udpstatprova.m
# Programma Octave
# grafico di statistiche di pacchetti UDP relativi a streaming multimediale
#
# INPUT: l'output di tcpdump, con opzione UDP
# consigli: 1) si genera un file capture.pcap con l'opzione -w
# 2) si crea un file di testo con tcpdump -T rtp -r capture.pcap > udp.txt
# OUTPUT:
#
a=1; # cosi' non crede che sia solo una funzione
warn_comma_in_global_decl = 0; # cosi' non rompe
echo off; # cosi' scrive le cose a schermo quando le carica
file_def = "udpstat"; # il file da elaborare di default
MXPKT = 1000; # numero massimo di pacchetti
#timein [MXPKT]; # istante di arrivo del pacchetto
#bytes [MXPKT]; # numero di bytes nel pacchetto
# il file da elaborare
file = getenv("FILE");
if (strcmp(file, ""))
file = "stdin";
filin = stdin;
else
file = strcat (file, ".txt");
[filin, err] = fopen (file, "r");
file = getenv("FILE"); # cosi' lo uso eventualmente per i grafici
endif
printf ("Utilizzo come file di input %s\n", file);
if (strcmp(file, "stdin"))
file = file_def; # cosi' lo uso eventualmente per i grafici
endif
if (filin == -1)
printf ("Errore apertura file %s: %s\n\n", file, err);
endif
if (filin == -1 || strcmp(getenv("HELP"),"yes"))
puts ("usage: udpstat [-f name]] [-s] [-h]\n\n");
puts (" -f name indicates tcpdump output file with no ext,\n");
puts (" to be extended with .txt, or stdin if null or absent\n\n");
puts (" -s allows to save graphics as name.gt.ps where gt is graphic type,\n");
printf (" or name eq %s if null or absent\n\n", file_def);
puts (" -h this help. Hoping is useful.\n\n");
exit (-1);
endif
np = 1; # numero di pacchetto corrente
puts ("Un puntino = 100 pacchetti\n");
npf = 0;
currentsize = 0;
puntfile = strcat (file, ".frames.txt");
cfrPtr = fopen (puntfile, "w");
while ((linea = fgets (filin, 200)) && feof(filin)==0)
#puts (linea);
[ti, f, m, to, prot, size, pt, mark, sn, ts, c] = sscanf (linea, "%s %s %s %s %s %d %s %s %d %d", "C");
if (strcmp (prot, "udp/rtp") != 1)
printf ("scarto %s\n", linea);
else
if (strcmp (mark, "*") != 1)
currentsize = currentsize + size;
else
npf = npf + 1;
currentsize = currentsize + size;
frames (npf) = currentsize;
fprintf (cfrPtr, "frame: %d dimensione: %d\n", npf, currentsize);
currentsize = 0;
endif
# le dimensioni dei pacchetti
bytes (np) = size;
# gli istanti di arrivo relativi
[ora, min, sec, c] = sscanf (ti, "%d:%d:%f", "C");
time = sec + 60*min + 3600*ora;
if (np==1) # primo pacchetto
dtime(np) = 0;
t0 = time;
else
dtime(np) = time - ptime; # tempo di interarrivo
endif
if (dtime(np)>1)
printf ("\npacket %d delayed %f secs\n", np, dtime(np));
endif
ptime = time;
# gli istanti di arrivo assoluti
timearr (np) = time - t0;
if (rem (np, 100)==0) # puntini di sospensione
puts (".");
endif
np += 1;
endif
#pause
endwhile
fclose (filin);
npkt = np -1; # numero di pacchetti letti
if (psgra = strcmp(getenv("SAVE"),"yes"))
printf ("Graphic output on file (%s).gt.ps\n", file);
gset term postscript eps;
endif
printf ("\nTrovati %d frames. \n", npf);
printf ("\nLetti %d pacchetti.\n", npkt);
puts ("\nGrafico delle dimensioni di pacchetto (byte) nel tempo\n");
if (psgra)
fo1 = strcat (file, ".size.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
plot (bytes, "@;dimensioni dei pacchetti(byte);");
puts (" -> Premi un tasto\n");
pause
puts ("\nGrafico delle dimensioni dei frames (byte) nel tempo\n");
if (psgra)
fo1 = strcat (file, ".sizeframe.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
plot (frames, "-;dimensioni dei frames(byte);");
puts (" -> Premi un tasto\n");
pause
puts ("\nGrafico dell'istogramma della dimensione (byte) di pacchetto\n");
if (psgra)
fo1 = strcat (file, ".siz_his.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
hist (bytes, sqrt(npkt));
pmean = mean (bytes);
puts (" -> Premi un tasto\n");
pause
puts ("\nGrafico dell'istogramma della dimensione (byte) dei frames\n");
if (psgra)
fo1 = strcat (file, ".siz_frame_his.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
hist (frames, sqrt(npf));
pmeanframes = mean (frames);
puts (" -> Premi un tasto\n");
pause
#pmin = min (bytes); # it seems a bug, min() gives an error which disappear
#pminframes = min (frames); # it seems a bug, min() gives an error which disappear
# removing the statement about time
pmax = max (bytes);
pmaxframes = max (frames);
pdev = std (bytes);
pdevframes = std (frames);
#printf ("Dimensioni pacchetti min avg max stddev %f %f %f %f\n", pmin, pmean, pmax, pdev);
printf ("Dimensioni pacchetti min avg max stddev - %f %f %f\n", pmean, pmax, pdev);
puts (" -> Premi un tasto\n");
pause
#printf ("Dimensioni frames min avg max stddev %f %f %f %f\n", pminframes, pmeanframes, pmaxframes, pdevframes);
printf ("Dimensioni frames min avg max stddev - %f %f %f\n", pmeanframes, pmaxframes, pdevframes);
puts (" -> Premi un tasto\n");
pause
pacfra = npkt / npf;
printf ("Valor medio numero pacchetti per ciascun frame %f\n", pacfra);
puts (" -> Premi un tasto\n");
puts ("\nGrafico dell'autocorrelazione della dimensione (byte) dei frames\n");
if (psgra)
fo1 = strcat (file, ".autocorr_frame.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
plot (autocor (frames,200), "-;autocorrelazione frames;");
puts (" -> Premi un tasto\n");
pause
puts ("\nGrafico dei tempi di interarrivo (sec)\n");
if (psgra)
fo1 = strcat (file, ".arrival.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
plot (dtime, "@;interarrivo (sec);");
puts (" -> Premi un tasto\n");
pause
puts ("\nIstogramma tempi di interarrivo (sec)\n");
if (psgra)
fo1 = strcat (file, ".arr_his.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
hist (dtime);
puts (" -> Premi un tasto\n");
pause
if (pstr = strcmp(getenv("TROUGH"),"yes"))
puts ("Inizio il calcolo del throughput\n");
dt = str2num(getenv("DELTAT"));
if (strcmp(getenv("RANGE"),"yes"))
min = str2num(getenv("MINIMO"))
max = str2num(getenv("MASSIMO"))
if (min < 1)
rif = 1;
else
rif = min;
endif
if (max > npkt)
puts ("L'estremo superiore scelto è maggiore del numero dei pacchetti\n");
printf ("Considero come estremo superiore %d\n", npkt);
else
npkt = max;
endif
else
rif = 1;
endif
ith = 1;
somma = 0;
#timearr(1:200)
tpunt = timearr (rif) + dt; # fin dove accumulare il throughput
for i=rif:npkt
while (tpunt <= timearr (i))
tpunt += dt;
throughput (ith) = somma;
somma = 0;
ith++;
endwhile
somma += bytes (i);
endfor
throughput (ith) = somma;
provatr = 0;
provatr = sum (throughput);
printf ("Valore totale in byte dei pacchetti da tr %f\n", provatr);
provapa = 0;
provapa = sum (bytes);
printf ("Valore totale in byte dei pacchetti da pac %f\n", provapa);
printf ("\nGrafico del throughput (byte/dt) calcolato in una finestra temporale di %f secondi\n", dt);
if (psgra && pstr)
fo1 = strcat (file, ".byte_su_dt.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
plot (throughput, "-;Throughput(byte/dt);");
puts (" -> Premi un tasto\n");
pause
printf ("\nGrafico del throughput (byte/sec) calcolato in una finestra temporale di %f secondi\n", dt);
if (psgra && pstr)
fo1 = strcat (file, ".byte_su_sec.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
plot ((throughput / dt), "-;Throughput(byte/sec);");
puts (" -> Premi un tasto\n");
pause
endif
#!/bin/bash
# From
# Advanced Bash-Scripting Guide
# An in-depth exploration of the gentle art of shell scripting
# Mendel CooperBrindle-Phlogiston Associates
# thegrendel@theriver.com
# 29 September 2002
while getopts "sf:h" Option
# Initial declaration.
# s, and f are the options (flags) expected.
# The : after option 'f' shows it will have an argument passed with it.
do
case $Option in
f )
export FILE=$OPTARG;; # ll nome del file da leggere
# se assente, da standard input
s )
export SAVE="yes"; # salva le immagini
h )
export HELP="yes";;
esac
done
shift $(($OPTIND - 1))
# Move argument pointer to next.
# All this is not nearly as complicated as it looks <grin>.
octave udpstatGOP.m
# Programma Octave
# grafico di statistiche di pacchetti UDP relativi a streaming multimediale
#
# INPUT: l'output di tcpdump, con opzione UDP
# consigli: 1) si genera un file capture.pcap con l'opzione -w
# 2) si crea un file di testo con tcpdump -r capture.pcap > udp.txt
# OUTPUT:
#
a=1; # cosi' non crede che sia solo una funzione
warn_comma_in_global_decl = 0; # cosi' non rompe
echo off; # cosi' scrive le cose a schermo quando le carica
file_def = "udpstat"; # il file da elaborare di default
MXPKT = 1000; # numero massimo di pacchetti
#timein [MXPKT]; # istante di arrivo del pacchetto
#bytes [MXPKT]; # numero di bytes nel pacchetto
# il file da elaborare
file = getenv("FILE");
if (strcmp(file, ""))
file = "stdin";
filin = stdin;
else
file = strcat (file, ".txt");
[filin, err] = fopen (file, "r");
file = getenv("FILE"); # cosi' lo uso eventualmente per i grafici
endif
printf ("Utilizzo come file di input %s\n", file);
if (strcmp(file, "stdin"))
file = file_def; # cosi' lo uso eventualmente per i grafici
endif
if (filin == -1)
printf ("Errore apertura file %s: %s\n\n", file, err);
endif
if (filin == -1 || strcmp(getenv("HELP"),"yes"))
puts ("usage: udpstat [-f name]] [-s] [-h]\n\n");
puts (" -f name indicates tcpdump output file with no ext,\n");
puts (" to be extended with .txt, or stdin if null or absent\n\n");
puts (" -s allows to save graphics as name.gt.ps where gt is graphic type,\n");
printf (" or name eq %s if null or absent\n\n", file_def);
puts (" -h this help. Hoping is useful.\n\n");
exit (-1);
endif
nframe = 1; # numero di frame corrente
contGOP= 0; # contatore GOP
puts ("Un puntino = 100 frames\n");
while ((linea = fgets (filin, 200)) && feof(filin)==0)
#puts (linea);
[fr, nfr, q, vq, fsi, size, ssi, sssi, ti, vti, br, vbr, abr, vabr, type, tipoframe, c] = sscanf (linea, "%s %d %s %d %s %d %s %s %s %f %s %s %s %s %s %s", "C");
if (strcmp (vabr, "0.0kbits/s") == 1)
printf ("scarto %s\n", linea);
else
if (strcmp (tipoframe, "P") == 1) # discrimina i frames P dai frames I
tip = 0;
else
tip = 1;
endif
typeframe (nframe) = tip;
nframe += 1;
endif
endwhile
#typeframe
nfra = nframe -1; # numero dei frames
tg = 0;
cont = 0;
for i=2:nfra
if ( typeframe (i) == 0 )
cont += 1;
else
tg += 1;
gop (tg) = cont + 1;
cont = 0;
contGOP +=1;
endif
endfor
contGOP -=1; # numero dei GOP
printf ("Letti %d GOP\n",contGOP);
# gop
if (psgra = strcmp(getenv("SAVE"),"yes"))
printf ("Graphic output on file (%s).gt.ps\n", file);
gset term postscript eps;
endif
puts ("\nGrafico dell'andamento dei GOPs\n");
if (psgra)
fo1 = strcat (file, ".GOP.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
plot (gop, "@;dimensioni dei GOPs;");
puts (" -> Premi un tasto\n");
pause
puts ("\nIstogramma GOP \n");
if (psgra)
fo1 = strcat (file, ".GOP_his.ps\""); # builds up the command
fo2 = strcat ("gset output \"", fo1);
eval (fo2);
endif
hist (gop);
puts (" -> Premi un tasto\n");
pause

Figura C.1- FFMPEG, QCIF, Byte/frame medio
|
4 fps |
10 fps |
25 fps |
|
|
30 kbps |
1187,153846 |
746,595021 |
566,832339 |
|
150 kbps |
4813,671518 |
1952,590871 |
792,27104 |
|
750 kbps |
18318,90852 |
9426,183402 |
3775,712392 |
Figura C.2 FFMPEG, CIF, Byte/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
3001,669439 |
2244,824896 |
1758,235255 |
|
150 kbps |
4862,580042 |
2256,171784 |
1779,825655 |
|
750 kbps |
23548,94179 |
9435,823237 |
3763,685676 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Figura C.3 FFMPEG, VGA, Byte/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
7965,309623 |
5894,428096 |
4907,320292 |
|
150 kbps |
8110,257862 |
5879,76534 |
4932,265739 |
|
750 kbps |
23657,27883 |
9379,325833 |
4942,724104 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Figura C.4 MP4LIVE, QCIF, Byte/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
842,354298 |
584,261925 |
418,4855 |
|
150 kbps |
5275,428571 |
1886,773869 |
740,1143 |
|
750 kbps |
22405,21384 |
9984,324937 |
3767,814 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Azzurro bit rate minimo di codifica 82 kbps
Figura C.5 MP4LIVE, CIF, Byte/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
2404,241164 |
1750,942761 |
1314,99 |
|
150 kbps |
4721,978992 |
1832,503361 |
1311,627 |
|
750 kbps |
28113,9957 |
9427,380151 |
3748,042 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Figura C.6 FFMPEG, QCIF, pacchetti/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
1,261954 |
1,13278 |
1,093771 |
|
150 kbps |
3,798337 |
1,897925 |
1,123923 |
|
750 kbps |
13,029106 |
6,949378 |
3,175944 |
Figura C.7 FFMPEG, CIF, pacchetti/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
2,544699 |
2,028216 |
1,698807 |
|
150 kbps |
3,844075 |
2,035685 |
1,71296 |
|
750 kbps |
16,636175 |
6,953257 |
3,215517 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Figura C.8 FFMPEG, VGA, pacchetti/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
5,974895 |
4,547797 |
3,894894 |
|
150 kbps |
6,073375 |
4,536484 |
3,911199 |
|
750 kbps |
16,691824 |
6,9225 |
3,918327 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Figura C.9 MP4LIVE, QCIF, pacchetti/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
1,02945 |
1,004184 |
1,002388 |
|
150 kbps |
4,094538 |
1,867672 |
1,04324 |
|
750 kbps |
15,825996 |
7,325777 |
3,081905 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Azzurro bit rate minimo di codifica 82 kbps
Figura C.10 MP4LIVE, CIF, pacchetti/frame medio
|
|
4 fps |
10 fps |
25 fps |
|
30 kbps |
2,168399 |
1,718013 |
1,363221 |
|
150 kbps |
3,752101 |
1,760504 |
1,363343 |
|
750 kbps |
19,793548 |
6,953743 |
3,067322 |
Nota: Valori ottenuti con codifiche non precise per limitazione del codificatore nei campi:
Figura C.11 DivX, QCIF/25/150, autocorrelazione
Figura C.12 XviD, QCIF/25/150, autocorrelazione
Figura C.13 DivX, CIF/4/750, autocorrelazione
Figura C.14 DivX, CIF/10/750, autocorrelazione
Figura C.15 DivX, CIF/25/750, autocorrelazione
Figura C.16 DivX, CIF/4/750, istogramma dei GOPs
Figura C.17 DivX, CIF/10/750, istogramma dei GOPs
Figura C.18 DivX, CIF/25/750, istogramma dei GOPs
Figura C.19 DivX, CIF/4/750, dimensione dei GOPs
Figura C.20 DivX, QCIF/25/30, autocorrelazione
Figura C.21 DivX, QCIF/25/150, autocorrelazione
Figura C.22 DivX, QCIF/25/750, autocorrelazione
Figura C.23 - Darwin, DT = 1*FR , throughput
Figura C.24 Helix, DT = 1*FR, throughput
Figura C.25 Darwin, DT = 1*FR , 100°-500° pacchetto, throughput
Figura C.26, Helix, DT = 1*FR, 100°-500° pacchetto, throughput
Figura C.27 Darwin, DT = 0.1*FR, throughput
Figura C.28 Darwin, DT = 10*FR, throughput
Figura C.29 Helix, 100 pacchetti, 1 client, tempi di interarrivo
Figura C.30 Darwin, 100 pacchetti, 1 client, tempi di interarrivo
Figura C.31 Helix, 100 pacchetti, 3 clients, tempi di interarrivo
Figura C.32 Darwin, 100 pacchetti, 3 clients, tempi di interarrivo
Figura C.33 Darwin, 1 client, throughput
Figura C.34 Darwin, 3 clients, throughput
[1] F. Halsall, Multimedia Communications: Applications, Networks, Protocols and Standards, Addison-Wesley
[2] J. Watkinson, The MPEG Handbook, Focal Press
[3] J. Watkinson, An Introduction to Digital Video, Focal Press
[4] ISO/IEC JTC1/SC29/WG11 N4668: MPEG-4 Overview - V.21
[5] C. Li, J. Lu, K.B.Letaief, Adaptive Error Resilient Video Transmission over Wide-Band CDMA Networks, IEEE
[6] A Matrawy, I. Lambadaris, C. Huang, MPEG4 Traffic Modelling Using the Transform Expand Sample Methodology, IEEE
[7] A. Golaup, A.H. Aghvami, Modelling of MPEG4 Traffic at GoP Level Using Autoregressive Processes, IEEE
[8] F.H.P. Fitzek, M. Reisslein, MPEG-4 and H.263 Video Traces for Network Performance Evaluation, IEEE
[9] N. Blefari Melazzi, Internet: Architettura, Principali Protocolli e Linee Evolutive, versione 3.0
[10] H. Schulzrinne, S. Casner, R. Frederick, V. Jacobson, RTP: A Transport Protocol for Real-Time Applications, Request for Comments 1889, IETF
[11] H. Schulzrinne, RTP Profile for Audio and Video Conferences with Minimal Control, Request for Comments 1890, IETF
[12] M. Handley, V. Jacobson, SDP: session description protocol, Request for Comments 2327, IETF
[13] H. Schulzrinne, A. Rao, R. Lanphier, Real Time Streaming Protocol (RTSP), Request for Comments 2326, IETF
[15] AA.VV, RTP Payload Format for MPEG-4 Audio/Visual Streams, Request fo Comments 3016, IETF
[16] http://www.live.com
[18] http://www.realnetworks.com
[19] http://mpeg4ip.sourceforge.net
[20] http://www.mplayerhq.hu/
[21] http://www.apple.com
[22] http://ffmpeg.sourceforge.net
[24] http://mpeg.telecomitalialab.com/standards/mpeg.4/