Projet

Général

Profil

GStreamer » Historique » Version 1

P.G Bareges, 25/02/2013 20:29

1 1 P.G Bareges
h1. GStreamer
2 1 P.G Bareges
3 1 P.G Bareges
4 1 P.G Bareges
h2. from command line : simple theora encoding stream over udp 
5 1 P.G Bareges
6 1 P.G Bareges
<pre>
7 1 P.G Bareges
Sender : 
8 1 P.G Bareges
 gst-launch-0.10 -v v4l2src device=/dev/video0 ! \
9 1 P.G Bareges
 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \
10 1 P.G Bareges
 theoraenc ! udpsink host=10.20.0.62 port=1234
11 1 P.G Bareges
12 1 P.G Bareges
Receiver :
13 1 P.G Bareges
gst-launch-0.10 -v udpsrc port=1234 \
14 1 P.G Bareges
 caps="video/x-theora, width=640, height=480, framerate=30/1, pixel-aspect-ratio=1/1" ! \
15 1 P.G Bareges
 theoradec ! xvimagesink 
16 1 P.G Bareges
17 1 P.G Bareges
stats on i7-2620M
18 1 P.G Bareges
19 1 P.G Bareges
 ps -eo psr,pid,tid,class,rtprio,ni,pri,pcpu,stat,wchan:14,comm | grep [g]st
20 1 P.G Bareges
  3 23360 23360 TS       -   0  19  8.6 Sl+  poll_schedule_ gst-launch-0.10
21 1 P.G Bareges
  2 23363 23363 TS       -   0  19 47.8 Sl+  poll_schedule_ gst-launch-0.10
22 1 P.G Bareges
23 1 P.G Bareges
</pre>
24 1 P.G Bareges
25 1 P.G Bareges
h2. Processing
26 1 P.G Bareges
27 1 P.G Bareges
<pre>
28 1 P.G Bareges
/**
29 1 P.G Bareges
 * Ripped from
30 1 P.G Bareges
 * Camera capture pipelines. 
31 1 P.G Bareges
 * By Andres Colubri
32 1 P.G Bareges
 * 
33 1 P.G Bareges
 * 
34 1 P.G Bareges
 */
35 1 P.G Bareges
36 1 P.G Bareges
import codeanticode.gsvideo.*;
37 1 P.G Bareges
38 1 P.G Bareges
GSPipeline pipeline;
39 1 P.G Bareges
40 1 P.G Bareges
void setup() {
41 1 P.G Bareges
  size(640, 480);
42 1 P.G Bareges
  frameRate(30);
43 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 ");  
44 1 P.G Bareges
  pipeline.play();
45 1 P.G Bareges
}
46 1 P.G Bareges
47 1 P.G Bareges
void draw() {
48 1 P.G Bareges
  // When the GSPipeline.available() method returns true, 
49 1 P.G Bareges
  // it means that a new frame is ready to be read.
50 1 P.G Bareges
  if (pipeline.available()) {
51 1 P.G Bareges
    pipeline.read();
52 1 P.G Bareges
    image(pipeline, 0, 0);
53 1 P.G Bareges
  }
54 1 P.G Bareges
}
55 1 P.G Bareges
56 1 P.G Bareges
57 1 P.G Bareges
</pre>
58 1 P.G Bareges
59 1 P.G Bareges
60 1 P.G Bareges
h2. Liens
61 1 P.G Bareges
62 1 P.G Bareges
http://gsvideo.sourceforge.net/