Projet

Général

Profil

GStreamer » Historique » Version 5

P.G Bareges, 17/05/2013 17:47

1 1 P.G Bareges
h1. GStreamer
2 1 P.G Bareges
3 1 P.G Bareges
4 2 P.G Bareges
h2. command line 
5 3 P.G Bareges
6 3 P.G Bareges
7 4 P.G Bareges
h3.  theora over udp 
8 1 P.G Bareges
9 3 P.G Bareges
*nécessite de lancer le receiver avant le sender... 
10 3 P.G Bareges
*reprise possible du flux d'émission apres l'initialisation des 2 pipelines (sender/receive)
11 3 P.G Bareges
*ne marche pas sous windows.
12 3 P.G Bareges
13 1 P.G Bareges
<pre>
14 1 P.G Bareges
Sender : 
15 1 P.G Bareges
 gst-launch-0.10 -v v4l2src device=/dev/video0 ! \
16 1 P.G Bareges
 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \
17 1 P.G Bareges
 theoraenc ! udpsink host=10.20.0.62 port=1234
18 1 P.G Bareges
19 1 P.G Bareges
Receiver :
20 1 P.G Bareges
gst-launch-0.10 -v udpsrc port=1234 \
21 1 P.G Bareges
 caps="video/x-theora, width=640, height=480, framerate=30/1, pixel-aspect-ratio=1/1" ! \
22 1 P.G Bareges
 theoradec ! xvimagesink 
23 1 P.G Bareges
24 1 P.G Bareges
stats on i7-2620M
25 1 P.G Bareges
26 1 P.G Bareges
 ps -eo psr,pid,tid,class,rtprio,ni,pri,pcpu,stat,wchan:14,comm | grep [g]st
27 1 P.G Bareges
  3 23360 23360 TS       -   0  19  8.6 Sl+  poll_schedule_ gst-launch-0.10
28 2 P.G Bareges
  2 23363 23363 TS       -   0  19 47.8 Sl+  poll_schedule_ gst-launch-0.10
29 1 P.G Bareges
30 1 P.G Bareges
</pre>
31 1 P.G Bareges
32 3 P.G Bareges
33 4 P.G Bareges
h3. theora over rtp 
34 2 P.G Bareges
35 3 P.G Bareges
*le serveur envoie ses caps toute les 5 secondes via config-interval=5
36 3 P.G Bareges
*marche sous windows \o/ :)
37 2 P.G Bareges
38 2 P.G Bareges
<pre>
39 2 P.G Bareges
40 2 P.G Bareges
sender: 
41 2 P.G Bareges
42 2 P.G Bareges
gst-launch-0.10 -v v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! theoraenc ! rtptheorapay config-interval=5 ! udpsink host=10.20.0.62 port=1234
43 2 P.G Bareges
44 2 P.G Bareges
receiver : 
45 2 P.G Bareges
46 2 P.G Bareges
gst-launch-0.10 -v udpsrc port=1234 caps="application/x-rtp" ! rtptheoradepay ! theoradec ! xvimagesink
47 2 P.G Bareges
48 2 P.G Bareges
</pre>
49 2 P.G Bareges
50 2 P.G Bareges
51 2 P.G Bareges
52 1 P.G Bareges
h2. Processing
53 1 P.G Bareges
54 1 P.G Bareges
<pre>
55 1 P.G Bareges
/**
56 1 P.G Bareges
 * Ripped from
57 1 P.G Bareges
 * Camera capture pipelines. 
58 1 P.G Bareges
 * By Andres Colubri
59 1 P.G Bareges
 * 
60 1 P.G Bareges
 * 
61 1 P.G Bareges
 */
62 1 P.G Bareges
63 1 P.G Bareges
import codeanticode.gsvideo.*;
64 1 P.G Bareges
65 1 P.G Bareges
GSPipeline pipeline;
66 1 P.G Bareges
67 1 P.G Bareges
void setup() {
68 1 P.G Bareges
  size(640, 480);
69 1 P.G Bareges
  frameRate(30);
70 1 P.G Bareges
  pipeline = new GSPipeline(this, "udpsrc port=1234 caps=\"video/x-theora, width=640, height=480, framerate=30/1, pixel-aspect-ratio=1/1\" ! theoradec ");  
71 1 P.G Bareges
  pipeline.play();
72 1 P.G Bareges
}
73 1 P.G Bareges
74 1 P.G Bareges
void draw() {
75 1 P.G Bareges
  // When the GSPipeline.available() method returns true, 
76 1 P.G Bareges
  // it means that a new frame is ready to be read.
77 1 P.G Bareges
  if (pipeline.available()) {
78 1 P.G Bareges
    pipeline.read();
79 1 P.G Bareges
    image(pipeline, 0, 0);
80 1 P.G Bareges
  }
81 1 P.G Bareges
}
82 1 P.G Bareges
83 1 P.G Bareges
84 1 P.G Bareges
</pre>
85 1 P.G Bareges
86 1 P.G Bareges
87 5 P.G Bareges
h3. 2 Dazzle DVC 100
88 5 P.G Bareges
89 5 P.G Bareges
pour fonctionner, necessite de connecter les dazzles sur 2 bus differents r
90 5 P.G Bareges
<pre>
91 5 P.G Bareges
root@stream1:~# lsusb
92 5 P.G Bareges
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
93 5 P.G Bareges
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
94 5 P.G Bareges
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
95 5 P.G Bareges
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
96 5 P.G Bareges
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
97 5 P.G Bareges
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
98 5 P.G Bareges
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
99 5 P.G Bareges
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
100 5 P.G Bareges
Bus 001 Device 003: ID 2304:021a Pinnacle Systems, Inc. Dazzle DVC100 Audio Device
101 5 P.G Bareges
Bus 002 Device 002: ID 2304:021a Pinnacle Systems, Inc. Dazzle DVC100 Audio Device
102 5 P.G Bareges
103 5 P.G Bareges
</pre>
104 5 P.G Bareges
105 5 P.G Bareges
Gstreamer theora over udp avec 2 sources video mixé (WIP)
106 5 P.G Bareges
<pre>
107 5 P.G Bareges
gst-launch-0.10  videomixer name=mix sink_0::zorder=1 sink_1::xpos=480 sink_1::ypos=0 sink_1::zorder=2 ! ffmpegcolorspace ! theoraenc quality=32 ! udpsink host=127.0.0.1 port=1234  v4l2src device=/dev/video1  ! decodebin ! videoscale ! video/x-raw-yuv,width=160,height=120 ! videobox border-alpha=0  ! mix.sink_1 v4l2src device=/dev/video0 ! decodebin ! videoscale ! video/x-raw-yuv,width=640,height=480   ! videobox border-alpha=0 top=0 left=0 ! mix.sink_0
108 5 P.G Bareges
109 5 P.G Bareges
</pre>
110 5 P.G Bareges
111 5 P.G Bareges
112 1 P.G Bareges
h2. Liens
113 1 P.G Bareges
114 2 P.G Bareges
115 2 P.G Bareges
116 2 P.G Bareges
*http://gsvideo.sourceforge.net/
117 2 P.G Bareges
*http://wiki.oz9aec.net/index.php/Gstreamer_cheat_sheet 
118 2 P.G Bareges
*http://lists.freedesktop.org/archives/gstreamer-devel/2011-July/032234.html
119 5 P.G Bareges
*http://www.noah.org/wiki/video_4_linux_2_notes
120 5 P.G Bareges
*http://wiki.oz9aec.net/index.php/Gstreamer_cheat_sheet