Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (26)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (7950)

  • FFmpeg to connect to RTSP in Python, but sometimes the video stream freezes, and FFmpeg throws an error

    23 décembre 2024, par Jin Hc
      

    • Here is part of my code. I use the ffmpeg-python library in Python to receive the RTSP stream and perform subsequent processing.
    • 


    


        def __init__(self, parent: QWidget = None):
        super(captureVideo_Thread, self).__init__()
        self.ffmpeg_args = {
            "rtsp_transport": "tcp",
            "fflags": "+genpts+discardcorrupt+autobsf+fastseek",
            "flags": "low_delay",
            "err_detect": "ignore_err",
            "reorder_queue_size": 10000,
            "vsync": 2,
            "probesize": 10 * 1000000,
            "analyzeduration": 10 * 1000000,
            "threads": "auto",
            "correct_ts_overflow": "1",
        }

        self.parent: Video_Widgets = parent
        self.running_FLAG = True
        self.mutex = QMutex()
        self.process = None

    def run(self) -> None:
        try:
            probe = func_timeout(2, ffmpeg.probe, (self.parent.video_source,))
        except FunctionTimedOut:
            self.captureVideoEnd_signal.emit()
            return
        except ffmpeg.Error as e:
            self.captureVideoEnd_signal.emit()
            return
        cap_info = next(x for x in probe["streams"] if x["codec_type"] == "video")
        video_width = cap_info["width"]
        video_height = cap_info["height"]
        config.video_width = video_width
        config.video_height = video_height
        up, down = str(cap_info["r_frame_rate"]).split("/")
        config.video_fps = round(eval(up) / eval(down), 2)
        self.process = (
            ffmpeg.input(self.parent.video_source, **self.ffmpeg_args)
            .output(
                "pipe:",
                format="rawvideo",
                pix_fmt="rgb24",
            )
            .overwrite_output()
            .run_async(pipe_stdout=True)
        )

        while True:
            if not config.is_openVideo:
                config.is_openVideo = True
            with config.locked(self.mutex):
                if not self.running_FLAG:
                    break

            in_bytes = self.process.stdout.read(video_width * video_height * 3)
            expected_size = video_width * video_height * 3
            if not in_bytes or len(in_bytes) != expected_size:
                continue

            in_frame = np.frombuffer(in_bytes, np.uint8).reshape([video_height, video_width, 3])


    


      

    • There are two phenomena that occur, and these do not happen at fixed times. The first phenomenon is that FFmpeg throws the following error, but the video continues playing.
    • 


    


    # client
[vist#0:0/h264 @ 000002419fad8e40] [dec:h264 @ 00000241a01046c0] corrupt decoded frame
frame=87565 fps= 50 q=-0.0 size=336245760KiB time=00:29:11.20 bitrate=1572927.9kbits/s speed=   1x  
[h264 @ 00000241a0104a00] Invalid level prefix
[h264 @ 00000241a0104a00] error while decoding MB 25 63
[vist#0:0/h264 @ 000002419fad8e40] [dec:h264 @ 00000241a01046c0] corrupt decoded frame
frame=87593 fps= 50 q=-0.0 size=336353280KiB time=00:29:11.75 bitrate=1572938.5kbits/s speed=   1x  
[h264 @ 00000241a0104a00] Invalid level prefix
[h264 @ 00000241a0104a00] error while decoding MB 24 63
[vist#0:0/h264 @ 000002419fad8e40] [dec:h264 @ 00000241a01046c0] corrupt decoded frame


    


    # server
No errors.


    


      

    • The second phenomenon is that the receiver on my side will freeze completely, and the speed displayed by FFmpeg will gradually decrease (the trigger time for this behavior is random, sometimes after 5 minutes, sometimes after 20 minutes). Additionally, the sender will display a large number of errors.
    • 


    


    # client
frame=21131 fps= 48 q=-0.0 size=81139200KiB time=00:07:10.97 bitrate=1542290.7kbits/s speed=0.984x


    


    # server
[WARN  rtsp_lib/rtsp_demo.c:1966:rtsp_sever_tx_video] client 192.168.0.102 will lost video packet
[WARN  rtsp_lib/rtsp_demo.c:1966:rtsp_sever_tx_video] client 192.168.0.102 will lost video packet
[WARN  rtsp_lib/rtsp_demo.c:1966:rtsp_sever_tx_video] client 192.168.0.102 will lost video packet
[WARN  rtsp_lib/rtsp_demo.c:1966:rtsp_sever_tx_video] client 192.168.0.102 will lost video packet
[WARN  rtsp_lib/rtsp_demo.c:1966:rtsp_sever_tx_video] client 192.168.0.102 will lost video packet
[DEBUG rtsp_lib/rtsp_msg.c:865:rtsp_msg_parse_from_array]
RTSP/1.0 501 Not Implemented


    


      

    • I am sure the issue is not with the stream source, because there are no problems when using VLC or other software.

      


    • 


    • I think the issue might be with my FFmpeg settings.???

      


    • 


    • I found that the average bitrate of VLC is 19000kb/s, but the FFmpeg in my code shows 1500000kb/s. Why is this happening ? Is there something wrong with my settings ?

      


    • 


    


  • Revision 3330 : Un élément de menu pour la configuration

    25 avril 2010, par kent1 — Log

    Un élément de menu pour la configuration

  • Revision 32858 : on vire ce .foucs() qui "force le scroll" vers l’input du formulaire au ...

    12 novembre 2009, par brunobergot@… — Log

    on vire ce .foucs() qui "force le scroll" vers l’input du formulaire au chargement de la page