Bonjour à tous,

Voilà, je travaille actuellement sous Ubuntu 12.04 LTS.

Je peux actuellement streamer via VLC ma webcam en RTP comme suit :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
VLC INFOS :
 
Adresse : 10.101.4.255 (pour broadcaster)
Base port : 5004
Encoding : ASF
J'arrive, sous VLC, à ouvrir le flux comme suit et donc à visualiser depuis n'importe quel pc ma webcam :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
NETWORK PROTOCOL
rtp://10.101.4.255:5004
Ceci est valable depuis les n pc disponibles.

Ma question si situe avec Python...
Cela fait maintenant 48h qu'on essaie d'ouvrir ce flux via Python et OpenCV.
Ce que nous aimerions c'est avoir un snapshot du flux vidéo.

En gros : prendre une photo à l'instant t du flux vidéo (une capture de la vidéo).

Nous nous sommes arraché les cheveux avec la doc OpenCV Absolument pas claire.
Pour le moment, et après avoir un peu tout essayé, la commande suivante nous semblait la plus pertinente :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
import cv2
 
fileName = cv2.VideoCapture('rtp://10.101.4.255:5004')
Malheureusement cette commande semble lire le flux en continu (et par définition ce stream provenant d'une webcam est un flux infini ...) et donc tombe dans une boucle "infinie" comme suit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
user@user-HP-Z400-Workstation:~/Desktop/Python/Code$ python stream.py 
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Et plus rien ne se passe ... (cela dit je m'interroge sur cette "network initialisation").

Si quelqu'un a déjà été confronté à ce problème, ou a une idée de comment le résoudre nous sommes grands preneurs !

Merci à tous d'avoir pris la peine de me lire et bonne journée !