Recherche avancée

Médias (0)

Mot : - Tags -/interaction

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (93)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie 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 (...)

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le 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 (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

Sur d’autres sites (10948)

  • Inside WebM Technology : VP8 Intra and Inter Prediction

    20 juillet 2010, par noreply@blogger.com (Lou Quillio)
    Continuing our series on WebM technology, I will discuss the use of prediction methods in the VP8 video codec, with special attention to the TM_PRED and SPLITMV modes, which are unique to VP8.

    First, some background. To encode a video frame, block-based codecs such as VP8 first divide the frame into smaller segments called macroblocks. Within each macroblock, the encoder can predict redundant motion and color information based on previously processed blocks. The redundant data can be subtracted from the block, resulting in more efficient compression.

    Image by Fido Factor, licensed under Creative Commons Attribution License.
    Based on a work at www.flickr.com

    A VP8 encoder uses two classes of prediction :
    • Intra prediction uses data within a single video frame
    • Inter prediction uses data from previously encoded frames
    The residual signal data is then encoded using other techniques, such as transform coding.

    VP8 Intra Prediction Modes
    VP8 intra prediction modes are used with three types of macroblocks :
    • 4x4 luma
    • 16x16 luma
    • 8x8 chroma
    Four common intra prediction modes are shared by these macroblocks :
    • H_PRED (horizontal prediction). Fills each column of the block with a copy of the left column, L.
    • V_PRED (vertical prediction). Fills each row of the block with a copy of the above row, A.
    • DC_PRED (DC prediction). Fills the block with a single value using the average of the pixels in the row above A and the column to the left of L.
    • TM_PRED (TrueMotion prediction). A mode that gets its name from a compression technique developed by On2 Technologies. In addition to the row A and column L, TM_PRED uses the pixel P above and to the left of the block. Horizontal differences between pixels in A (starting from P) are propagated using the pixels from L to start each row.
    For 4x4 luma blocks, there are six additional intra modes similar to V_PRED and H_PRED, but correspond to predicting pixels in different directions. These modes are outside the scope of this post, but if you want to learn more see the VP8 Bitstream Guide.

    As mentioned above, the TM_PRED mode is unique to VP8. The following figure uses an example 4x4 block of pixels to illustrate how the TM_PRED mode works :
    Where C, As and Ls represent reconstructed pixel values from previously coded blocks, and X00 through X33 represent predicted values for the current block. TM_PRED uses the following equation to calculate Xij :

    Xij = Li + Aj - C (i, j=0, 1, 2, 3)

    Although the above example uses a 4x4 block, the TM_PRED mode for 8x8 and 16x16 blocks works in the same fashion.
    TM_PRED is one of the more frequently used intra prediction modes in VP8, and for common video sequences it is typically used by 20% to 45% of all blocks that are intra coded. Overall, together with other intra prediction modes, TM_PRED helps VP8 to achieve very good compression efficiency, especially for key frames, which can only use intra modes (key frames by their very nature cannot refer to previously encoded frames).

    VP8 Inter Prediction Modes

    In VP8, inter prediction modes are used only on inter frames (non-key frames). For any VP8 inter frame, there are typically three previously coded reference frames that can be used for prediction. A typical inter prediction block is constructed using a motion vector to copy a block from one of the three frames. The motion vector points to the location of a pixel block to be copied. In most video compression schemes, a good portion of the bits are spent on encoding motion vectors ; the portion can be especially large for video encoded at lower datarates.

    Like previous VPx codecs, VP8 encodes motion vectors very efficiently by reusing vectors from neighboring macroblocks (a macroblock includes one 16x16 luma block and two 8x8 chroma blocks). VP8 uses a similar strategy in the overall design of inter prediction modes. For example, the prediction modes "NEAREST" and "NEAR" make use of last and second-to-last, non-zero motion vectors from neighboring macroblocks. These inter prediction modes can be used in combination with any of the three different reference frames.

    In addition, VP8 has a very sophisticated, flexible inter prediction mode called SPLITMV. This mode was designed to enable flexible partitioning of a macroblock into sub-blocks to achieve better inter prediction. SPLITMV is very useful when objects within a macroblock have different motion characteristics. Within a macroblock coded using SPLITMV mode, each sub-block can have its own motion vector. Similar to the strategy of reusing motion vectors at the macroblock level, a sub-block can also use motion vectors from neighboring sub-blocks above or left to the current block. This strategy is very flexible and can effectively encode any shape of sub-macroblock partitioning, and does so efficiently. Here is an example of a macroblock with 16x16 luma pixels that is partitioned to 16 4x4 blocks :


    where New represents a 4x4 bock coded with a new motion vector, and Left and Above represent a 4x4 block coded using the motion vector from the left and above, respectively. This example effectively partitions the 16x16 macroblock into 3 different segments with 3 different motion vectors (represented below by 1, 2 and 3) :


    Through effective use of intra and inter prediction modes, WebM encoder implementations can achieve great compression quality on a wide range of source material. If you want to delve further into VP8 prediction modes, read the VP8 Bitstream Guide or examine the reconintra.c and rdopt.c files in the VP8 source tree.

    Yaowu Xu, Ph.D. is a codec engineer at Google.

  • FFMPEG Issue : Video breaks a lot hence the real time video gets distorted and gets a little delayed while streaming on a webpage from drone

    26 mars 2022, par ashiyaa nunhuck

    ****I am trying to detect a face from my drone camera in real time.The video streams successfully but it is delayed and breaks a lot. Is there any solution to this problem ? How can i have a smooth video streaming with little delay and no video breaking in order to succeed in detecting a face ? Your help will be much appreciated.&#xA;Also, this is printed while my code is running: :

    &#xA;

    &#xA;

    INFO:werkzeug:127.0.0.1 - - [27/May/2021 15:16:14] "GET&#xA;/video/streaming HTTP/1.1" 200 -&#xA;INFO:drone_face_recognition_and_tracking.controllers.server :'action' :&#xA;'command', 'cmd' : 'takeOff'&#xA;INFO:drone_face_recognition_and_tracking.models.manage_drone :'action' :&#xA;'send_command', 'command' : 'takeoff' [h264 @ 0x55aa924a2e40] error&#xA;while decoding MB 45 38, bytestream -6 [h264 @ 0x55aa924a2e40]&#xA;concealing 424 DC, 424 AC, 424 MV errors in I frame [h264 @&#xA;0x55aa922a9a00] concealing 687 DC, 687 AC, 687 MV errors in P frame&#xA;[h264 @ 0x55aa923f79c0] left block unavailable for requested intra&#xA;mode [h264 @ 0x55aa923f79c0] error while decoding MB 0 34, bytestream&#xA;1347 [h264 @ 0x55aa923f79c0] concealing 709 DC, 709 AC, 709 MV errors&#xA;in P frame INFO:werkzeug:127.0.0.1 - - [27/May/2021 15:16:17] "POST&#xA;/api/command/ HTTP/1.1" 200 - pipe:0 : corrupt decoded frame in stream&#xA;0&#xA;Last message repeated 2 times [h264 @ 0x55aa922a9a00] error while decoding MB 49 30, bytestream -6 [h264 @ 0x55aa922a9a00] concealing&#xA;900 DC, 900 AC, 900 MV errors in P frame pipe:0 : corrupt decoded frame&#xA;in stream 0&#xA;INFO:drone_face_recognition_and_tracking.models.manage_drone :'action' :&#xA;'receive_response', 'response' : b'ok'&#xA;INFO:drone_face_recognition_and_tracking.controllers.server :'action' :&#xA;'command', 'cmd' : 'faceDetectAndTrack' INFO:werkzeug:127.0.0.1 - -&#xA;[27/May/2021 15:16:21] "POST /api/command/ HTTP/1.1" 200 - [h264 @&#xA;0x55aa924a2e40] left block unavailable for requested intra4x4 mode -1&#xA;[h264 @ 0x55aa924a2e40] error while decoding MB 0 30, bytestream 1624&#xA;[h264 @ 0x55aa924a2e40] concealing 949 DC, 949 AC, 949 MV errors in I&#xA;frame pipe:0 : corrupt decoded frame in stream 0 [h264 @&#xA;0x55aa9244d400] left block unavailable for requested intra mode [h264&#xA;@ 0x55aa9244d400] error while decoding MB 0 12, bytestream 2936 [h264&#xA;@ 0x55aa9244d400] concealing 2029 DC, 2029 AC, 2029 MV errors in I&#xA;frame pipe:0 : corrupt decoded frame in stream 0 [h264 @&#xA;0x55aa924bf700] concealing 1632 DC, 1632 AC, 1632 MV errors in P frame&#xA;pipe:0 : corrupt decoded frame in stream 0 [h264 @ 0x55aa92414280]&#xA;concealing 1571 DC, 1571 AC, 1571 MV errors in P frame

    &#xA;

    &#xA;

    Here is my code :****

    &#xA;

    import logging&#xA;import contextlib&#xA;import os&#xA;import socket&#xA;import subprocess&#xA;import threading&#xA;import time&#xA;import cv2 as cv&#xA;import numpy as np&#xA;&#xA;from drone_face_recognition_and_tracking.models.base import Singleton&#xA;&#xA;logger = logging.getLogger(__name__)&#xA;&#xA;DEFAULT_DISTANCE = 0.30&#xA;DEFAULT_SPEED = 10&#xA;DEFAULT_DEGREE = 10&#xA;&#xA;FRAME_X = int(320)  # try 640&#xA;FRAME_Y = int(240)  # try 480&#xA;FRAME_AREA = FRAME_X * FRAME_Y&#xA;&#xA;FRAME_SIZE = FRAME_AREA * 3&#xA;FRAME_CENTER_X = FRAME_X / 2&#xA;FRAME_CENTER_Y = FRAME_Y / 2&#xA;&#xA;CMD_FFMPEG = (f&#x27;ffmpeg -probesize 32 -hwaccel auto -hwaccel_device opencl -i pipe:0 &#x27;&#xA;              f&#x27;-pix_fmt bgr24 -s {FRAME_X}x{FRAME_Y} -f rawvideo pipe:1&#x27;)&#xA;&#xA;FACE_DETECT_XML_FILE = &#x27;./drone_face_recognition_and_tracking/models/haarcascade_frontalface_default.xml&#x27;&#xA;&#xA;&#xA;def receive_video(stop_event, pipe_in, host_ip, video_port):&#xA;    with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock_video:&#xA;        sock_video.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)&#xA;        sock_video.settimeout(.5)&#xA;        sock_video.bind((host_ip, video_port))&#xA;        data = bytearray(2048)&#xA;        while not stop_event.is_set():&#xA;            try:&#xA;                size, addr = sock_video.recvfrom_into(data)&#xA;                # logger.info({&#x27;action&#x27;: &#x27;receive_video&#x27;, &#x27;data&#x27;: data})&#xA;            except socket.timeout as ex:&#xA;                logger.warning({&#x27;action&#x27;: &#x27;receive_video&#x27;, &#x27;ex&#x27;: ex})&#xA;                time.sleep(0.5)&#xA;                continue&#xA;            except socket.error as ex:&#xA;                logger.error({&#x27;action&#x27;: &#x27;receive_video&#x27;, &#x27;ex&#x27;: ex})&#xA;                break&#xA;&#xA;            try:&#xA;                pipe_in.write(data[:size])&#xA;                pipe_in.flush()&#xA;            except Exception as ex:&#xA;                logger.error({&#x27;action&#x27;: &#x27;receive_video&#x27;, &#x27;ex&#x27;: ex})&#xA;                break&#xA;&#xA;&#xA;class Tello_Drone(metaclass=Singleton):&#xA;    def __init__(self, host_ip=&#x27;192.168.10.2&#x27;, host_port=8889,&#xA;                 drone_ip=&#x27;192.168.10.1&#x27;, drone_port=8889,&#xA;                 is_imperial=False, speed=DEFAULT_SPEED):&#xA;        self.host_ip = host_ip&#xA;        self.host_port = host_port&#xA;        self.drone_ip = drone_ip&#xA;        self.drone_port = drone_port&#xA;        self.drone_address = (drone_ip, drone_port)&#xA;        self.is_imperial = is_imperial&#xA;        self.speed = speed&#xA;        self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)&#xA;        self.socket.bind((self.host_ip, self.host_port))&#xA;&#xA;        self.response = None&#xA;        self.stop_event = threading.Event()&#xA;        self._response_thread = threading.Thread(target=self.receive_response, args=(self.stop_event, ))&#xA;        self._response_thread.start()&#xA;&#xA;        self.proc = subprocess.Popen(CMD_FFMPEG.split(&#x27; &#x27;),&#xA;                                     stdin=subprocess.PIPE,&#xA;                                     stdout=subprocess.PIPE)&#xA;        self.proc_stdin = self.proc.stdin&#xA;        self.proc_stdout = self.proc.stdout&#xA;&#xA;        self.video_port = 11111&#xA;&#xA;        self._receive_video_thread = threading.Thread(&#xA;            target=receive_video,&#xA;            args=(self.stop_event, self.proc_stdin,&#xA;                  self.host_ip, self.video_port,))&#xA;        self._receive_video_thread.start()&#xA;&#xA;        self.face_cascade = cv.CascadeClassifier(FACE_DETECT_XML_FILE)&#xA;        self._is_enable_face_detect = False&#xA;&#xA;        self.send_command(&#x27;command&#x27;)&#xA;        self.send_command(&#x27;streamon&#x27;)&#xA;        self.set_speed(self.speed)&#xA;&#xA;    def receive_response(self, stop_event):&#xA;        while not stop_event.is_set():&#xA;            try:&#xA;                self.response, ip = self.socket.recvfrom(3000)&#xA;                logger.info({&#x27;action&#x27;: &#x27;receive_response&#x27;,&#xA;                             &#x27;response&#x27;: self.response})&#xA;            except socket.error as ex:&#xA;                logger.error({&#x27;action&#x27;: &#x27;receive_response&#x27;,&#xA;                             &#x27;ex&#x27;: ex})&#xA;                break&#xA;&#xA;    def __dell__(self):&#xA;        self.stop()&#xA;&#xA;    def stop(self):&#xA;        self.stop_event.set()&#xA;        retry = 0&#xA;        while self._response_thread.is_alive():&#xA;            time.sleep(0.3)&#xA;            if retry > 30:&#xA;                break&#xA;            retry &#x2B;= 1&#xA;        self.socket.close()&#xA;        os.kill(self.proc.pid, 9)&#xA;&#xA;    def send_command(self, command):&#xA;        logger.info({&#x27;action&#x27;: &#x27;send_command&#x27;, &#x27;command&#x27;: command})&#xA;        self.socket.sendto(command.encode(&#x27;utf-8&#x27;), self.drone_address)&#xA;&#xA;        retry = 0&#xA;        while self.response is None:&#xA;            time.sleep(0.3)&#xA;            if retry > 3:&#xA;                break&#xA;            retry &#x2B;= 1&#xA;&#xA;        if self.response is None:&#xA;            response = None&#xA;        else:&#xA;            response = self.response.decode(&#x27;utf-8&#x27;)&#xA;        self.response = None&#xA;        return response&#xA;&#xA;    def takeoff(self):&#xA;        return self.send_command(&#x27;takeoff&#x27;)&#xA;&#xA;    def land(self):&#xA;        return self.send_command(&#x27;land&#x27;)&#xA;&#xA;    def move(self, direction, distance):&#xA;        distance = float(distance)&#xA;        if self.is_imperial:&#xA;            distance = int(round(distance * 30.48))&#xA;        else:&#xA;            distance = int(round(distance * 100))&#xA;        return self.send_command(f&#x27;{direction} {distance}&#x27;)&#xA;&#xA;    def up(self, distance=DEFAULT_DISTANCE):&#xA;        return self.move(&#x27;up&#x27;, distance)&#xA;&#xA;    def down(self, distance=DEFAULT_DISTANCE):&#xA;        return self.move(&#x27;down&#x27;, distance)&#xA;&#xA;    def left(self, distance=DEFAULT_DISTANCE):&#xA;        return self.move(&#x27;left&#x27;, distance)&#xA;&#xA;    def right(self, distance=DEFAULT_DISTANCE):&#xA;        return self.move(&#x27;right&#x27;, distance)&#xA;&#xA;    def forward(self, distance=DEFAULT_DISTANCE):&#xA;        return self.move(&#x27;forward&#x27;, distance)&#xA;&#xA;    def back(self, distance=DEFAULT_DISTANCE):&#xA;        return self.move(&#x27;back&#x27;, distance)&#xA;&#xA;    def set_speed(self, speed):&#xA;        return self.send_command(f&#x27;speed {speed}&#x27;)&#xA;&#xA;    def clockwise(self, degree=DEFAULT_DEGREE):&#xA;        return self.send_command(f&#x27;cw {degree}&#x27;)&#xA;&#xA;    def counter_clockwise(self, degree=DEFAULT_DEGREE):&#xA;        return self.send_command(f&#x27;ccw {degree}&#x27;)&#xA;&#xA;    def video_binary_generator(self):&#xA;        while True:&#xA;            try:&#xA;                frame = self.proc_stdout.read(FRAME_SIZE)&#xA;            except Exception as ex:&#xA;                logger.error({&#x27;action&#x27;: &#x27;video_binary_generator&#x27;, &#x27;ex&#x27;: ex})&#xA;                continue&#xA;&#xA;            if not frame:&#xA;                continue&#xA;&#xA;            frame = np.fromstring(frame, np.uint8).reshape(FRAME_Y, FRAME_X, 3)&#xA;            yield frame&#xA;&#xA;    def enable_face_detect(self):&#xA;        self._is_enable_face_detect = True&#xA;&#xA;    def disable_face_detect(self):&#xA;        self._is_enable_face_detect = False&#xA;&#xA;    def video_jpeg_generator(self):&#xA;        for frame in self.video_binary_generator():&#xA;            if self._is_enable_face_detect:&#xA;                gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)&#xA;                faces = self.face_cascade.detectMultiScale(gray, 1.2, 4)&#xA;                for (x, y, w, h) in faces:&#xA;                    cv.rectangle(frame, (x, y), (x&#x2B;w, y&#x2B;h), (0, 0, 255), 2)&#xA;                    break&#xA;&#xA;            _, jpeg = cv.imencode(&#x27;.jpg&#x27;, frame)&#xA;            jpeg_binary = jpeg.tobytes()&#xA;            yield jpeg_binary&#xA;

    &#xA;

  • Revision 29747 : On incrémente la version du plugin

    8 juillet 2009, par kent1@… — Log

    On incrémente la version du plugin