
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (79)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Le plugin : Gestion de la mutualisation
2 mars 2010, parLe plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
Installation basique
On installe les fichiers de SPIP sur le serveur.
On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
< ?php (...)
Sur d’autres sites (7713)
-
Revision 7249 : Résoudre le ticket http://www.mediaspip.net/ticket/gestion-des-spam En ...
12 décembre 2012, par kent1 — LogRésoudre le ticket http://www.mediaspip.net/ticket/gestion-des-spam
En gros, si pas de statut dans l’url, on passe le statut pour tous les message qui équivaut à un array de prop et publie.
On est obligé de surcharger boutons-filtre-statut-forum pour gérer correctement les liens
Passage en 1.1.4 -
Revision 4220 : La gestion des champs extras fonctionne (au moins pour les articles ... à ...
25 octobre 2010, par kent1 — LogLa gestion des champs extras fonctionne (au moins pour les articles ... à tester pour le reste)
-
How to get state of the streaming source in GStreamer-Python ?
17 février 2023, par doruk.sonmezI'm trying to analyze and take actions depending on the current state of the streaming source in gstreamer. I have a basic script to create pipeline elements, linking them and eventually see the live IP camera stream on my screen. However, most of the IP cameras seems to stop streaming the video at some point. The camera IP is accessible but RTSP drops the connection or displaying an all-black screen. I want to detect when the stream gets dropped and create a controlling interval to reconnect to the stream again. I'm already listening some bus messages at runtime but it doesn't seem like any of them is providing what I need.


It would be great to have some ideas on how to check the state of the stream at any given time.


Here is a basic blocks from my code :


def on_src_pad_added(src, new_pad, depayer):
 sink_pad = depayer.get_static_pad("sink")

 if(sink_pad.is_linked()):
 print("We are already linked. Ignoring.")
 return

 # check the new pad's type
 new_pad_caps = new_pad.get_current_caps()
 new_pad_struct = new_pad_caps.get_structure(0)
 new_pad_type = new_pad_struct.get_name()

 ret = new_pad.link(sink_pad)
 return

def gst_to_opencv(sample):
 buf = sample.get_buffer()
 caps = sample.get_caps()

 arr = np.ndarray(
 (caps.get_structure(0).get_value('height'),
 caps.get_structure(0).get_value('width'),
 3),
 buffer=buf.extract_dup(0, buf.get_size()),
 dtype=np.uint8)
 return arr

def new_buffer(sink, data):
 global image_arr
 sample = sink.emit("pull-sample")
 arr = gst_to_opencv(sample)
 image_arr = arr
 return Gst.FlowReturn.OK



After these callbacks I'm constructing my pipeline :


def main():
 # Standard GStreamer initialization
 GObject.threads_init()
 Gst.init(None)

 # Create gstreamer elements
 # Create Pipeline element that will form a connection of other elements
 print("Creating Pipeline \n ")
 pipeline = Gst.Pipeline()

 if not pipeline:
 sys.stderr.write(" Unable to create Pipeline \n")

 # Source element for reading from the file
 print("Creating Source \n ")
 source = Gst.ElementFactory.make("rtspsrc", "rtsp-cam-source")
 if not source:
 sys.stderr.write(" Unable to create Source \n")

 depay = Gst.ElementFactory.make("rtph264depay", "rtp-depay")
 if not depay:
 sys.stderr.write(" Unable to create videoconvert \n")

 parser = Gst.ElementFactory.make("h264parse", "h264-parser")
 if not parser:
 sys.stderr.write(" Unable to create videoconvert \n")

 decoder = Gst.ElementFactory.make("avdec_h264", "h264-decoder")
 if not decoder:
 sys.stderr.write(" Unable to create videoconvert \n")
...

Set plugin properties...
Add plugins to the pipeline...
Link plugins...
...




Lastly, my live streaming and message listening block is as follows :


...
# start play back and listen to events
 print("Starting pipeline \n")
 ret = pipeline.set_state(Gst.State.PLAYING)
 if ret == Gst.StateChangeReturn.FAILURE:
 print("Unable to set the pipeline to the playing state.")
 exit(-1)

 # create an event loop and feed gstreamer bus mesages to it
 bus = pipeline.get_bus()
 bus.add_signal_watch()
 
 # Parse message
 while True:
 pipe_state = pipeline.get_state(Gst.CLOCK_TIME_NONE)
 print(pipe_state.state)

 message = bus.timed_pop_filtered(10000, Gst.MessageType.ANY)
 if image_arr is not None: 
 cv2.imshow("Receive Image from Pipeline Buffer", image_arr)
 if cv2.waitKey(1) == ord('q'):
 break
 if message:
 if message.type == Gst.MessageType.ERROR:
 err, debug = message.parse_error()
 print(("Error received from element %s: %s" % (
 message.src.get_name(), err)))
 print(("Debugging information: %s" % debug))
 break
 elif message.type == Gst.MessageType.EOS:
 print("End-Of-Stream reached.")
 break
 elif message.type == Gst.MessageType.STATE_CHANGED:
 if isinstance(message.src, Gst.Pipeline):
 old_state, new_state, pending_state = message.parse_state_changed()
 print(("Pipeline state changed from %s to %s." %
 (old_state.value_nick, new_state.value_nick)))
 else:
 # print(message.type)
 continue

 # cleanup
 pipeline.set_state(Gst.State.NULL)
 pipeline.send_event(Gst.Event.new_eos())