Projet

Général

Profil

GStreamer » Historique » Version 2

« Précédent - Version 2/9 (diff) - Suivant » - Version actuelle
P.G Bareges, 25/02/2013 22:13


GStreamer

command line
h3. simple theora encoding stream over udp

Sender : 
 gst-launch-0.10 -v v4l2src device=/dev/video0 ! \
 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \
 theoraenc ! udpsink host=10.20.0.62 port=1234

Receiver :
gst-launch-0.10 -v udpsrc port=1234 \
 caps="video/x-theora, width=640, height=480, framerate=30/1, pixel-aspect-ratio=1/1" ! \
 theoradec ! xvimagesink 

stats on i7-2620M

 ps -eo psr,pid,tid,class,rtprio,ni,pri,pcpu,stat,wchan:14,comm | grep [g]st
  3 23360 23360 TS       -   0  19  8.6 Sl+  poll_schedule_ gst-launch-0.10
  2 23363 23363 TS       -   0  19 47.8 Sl+  poll_schedule_ gst-launch-0.10


nécessite de lancer le receiver avant le sender... reprise possible du flux d'émission apres l'initialisation des 2 pipelines (sender/receive)
ne marche pas sous windows.

rtp

le serveur envoie ses caps toute les 5 secondes via config-interval=5
marche sous windows \o/ :)


sender: 

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

receiver : 

gst-launch-0.10 -v udpsrc port=1234 caps="application/x-rtp" ! rtptheoradepay ! theoradec ! xvimagesink

Processing

/**
 * Ripped from
 * Camera capture pipelines. 
 * By Andres Colubri
 * 
 * 
 */

import codeanticode.gsvideo.*;

GSPipeline pipeline;

void setup() {
  size(640, 480);
  frameRate(30);
  pipeline = new GSPipeline(this, "udpsrc port=1234 caps=\"video/x-theora, width=640, height=480, framerate=30/1, pixel-aspect-ratio=1/1\" ! theoradec ");  
  pipeline.play();
}

void draw() {
  // When the GSPipeline.available() method returns true, 
  // it means that a new frame is ready to be read.
  if (pipeline.available()) {
    pipeline.read();
    image(pipeline, 0, 0);
  }
}

Liens

*http://gsvideo.sourceforge.net/
*http://wiki.oz9aec.net/index.php/Gstreamer_cheat_sheet
*http://lists.freedesktop.org/archives/gstreamer-devel/2011-July/032234.html