Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (12)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce 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" ;

  • Déploiements possibles

    31 janvier 2010, par

    Deux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
    L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
    Version mono serveur
    La version mono serveur consiste à n’utiliser qu’une (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (3546)

  • FFmpeg streaming UDP

    2 octobre 2020, par xKedar

    I'm trying to stream, using FFmpeg, my webcam and audio to a PC in another LAN that connects to mine.

    


    I basically wait for incoming connection in order to acquire IP and port of the other side

    


        import socket

    localPort   = 1234
    bufferSize  = 1024

    UDPServerSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
    UDPServerSocket.bind(("", localPort)) # Bind to address and port

    while(True):
        bytesAddressPair = UDPServerSocket.recvfrom(bufferSize)
        message = bytesAddressPair[0].decode("utf-8")
        address = bytesAddressPair[1]
        # Sending a reply to client
        UDPServerSocket.sendto(str.encode("Hello"), address)
        break

    UDPServerSocket.close()


    


    Then I try to send the stream with FFmpeg using the same port number both for server(localPort) and client(the one I acquired from address)

    


        import re
    from threading import Thread
    from subprocess import Popen, PIPE

    def detect_devices():
            list_cmd = 'ffmpeg -list_devices true -f dshow -i dummy'.split()
            p = Popen(list_cmd, stderr=PIPE)
            flagcam = flagmic = False
            for line in iter(p.stderr.readline,''):
                if flagcam:
                    cam = re.search('".*"',line.decode(encoding='UTF-8')).group(0)
                    cam = cam if cam else ''
                    flagcam = False
                if flagmic:
                    mic = re.search('".*"',line.decode(encoding='UTF-8')).group(0)
                    mic = mic if mic else ''
                    flagmic = False
                elif 'DirectShow video devices'.encode(encoding='UTF-8') in line:
                    flagcam = True
                elif 'DirectShow audio devices'.encode(encoding='UTF-8') in line:
                    flagmic = True
                elif 'Immediate exit requested'.encode(encoding='UTF-8') in line:
                    break
            return cam, mic   


    class ffmpegThread (Thread):
        def __init__(self, address):
            Thread.__init__(self)
            self.address = address

        def run(self):
            cam, mic = detect_devices()
            command = 'ffmpeg -f dshow -i video='+cam+':audio='+mic+' -profile:v high -pix_fmt yuvj420p -level:v 4.1 -preset ultrafast -tune zerolatency -vcodec libx264 -r 10 -b:v 512k -s 240x160 -acodec aac -ac 2 -ab 32k -ar 44100 -f mpegts -flush_packets 0 -t 40 udp://'+self.address+'?pkt_size=1316?localport='+str(localPort)
            p = Popen(command , stderr=PIPE)
            for line in iter(p.stderr.readline,''):
                if len(line) <5: break
            p.terminate()

    thread1 = ffmpegThread(address[0]+":"+str(address[1]))
    thread1.start()


    


    While on the other side I have :

    


        from threading import Thread
    import tkinter as tk
    import vlc

    class myframe(tk.Frame):
        def __init__(self, width=240, height=160):
            self.root = tk.Tk()
            super(myframe, self).__init__(self.root)
            self.root.geometry("%dx%d" % (width, height))
            self.root.wm_attributes("-topmost", 1)
            self.grid()
            self.frame = tk.Frame(self, width=240, height=160)
            self.frame.configure(bg="black")
            self.frame.grid(row=0, column=0, columnspan=2)
            self.play()
            self.root.mainloop()

        def play(self):
            self.player = vlc.Instance().media_player_new()
            self.player.set_mrl('udp://@0.0.0.0:5000')
            self.player.set_hwnd(self.frame.winfo_id())
            self.player.play()

    class guiThread (Thread):
        def __init__(self, nome):
            Thread.__init__(self)
            self.nome = nome

        def run(self):
            app = myframe()


    


    and :

    


        import socket

    msgFromClient       = "Hello UDP Server"
    bytesToSend         = str.encode(msgFromClient)
    serverAddressPort   = ("MYglobal_IPaddress", 1234)
    bufferSize          = 1024
    localPort   = 5000

    # Create a UDP socket at client side
    UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) 
    UDPClientSocket.bind(("", localPort))

    UDPClientSocket.sendto(bytesToSend, serverAddressPort)

    msgFromServer = UDPClientSocket.recvfrom(bufferSize)
    msg = msgFromServer[0].decode("utf-8")
    print(msg)
    UDPClientSocket.close()
    gui = guiThread("ThreadGUI")
    gui.start()


    


    I'm not able to reach the client with the stream. I tested everything else so the problem should be in the way I try to reach the client

    


  • Capturing Screen with FFMPEG on RTP protocol

    23 septembre 2020, par mertakkartal

    I am struggling about capturing the screen of remote computer on the same network with ffmpeg on RTP protocol.

    


    On the remote computer I run these two parameter blocks in different bash scripts for making the server catches the stream.

    


    For video :

    


    ffmpeg -f x11grab -framerate 25 -video_size uhd2160 -i :0.0 -c:video h264_nvenc -preset fast -pix_fmt bgr0 -b:v 6M -g 25 -an -f rtp_mpegts rtp://multicastaddress:videoPort

    


    For Audio :

    


    ffmpeg -f alsa -i hw:0,0 -c:audio aac -b:a 48K -f rtp_mpegts rtp://multicastaddress:audioPort

    


    Then , I run my ffmpeg capturing screen parameter block from the server as root privilege like as below :

    


    ffmpeg -y -buffer_size 425984 -thread_queue_size 32 -i rtp://@multicastaddress:videoPort -buffer_size 5000 -thread_queue_size 32 -i rtp://@multicastaddress:audioPort -map 0:0 -map 1:0 -c:v copy -c:a copy output.mp4

    


    When I run it , it outputs those errors as below ,

    


    [rtp @ 0x2329380] RTP: missed 284 packets
[rtp @ 0x2329380] RTP: missed 487 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1320.4kbits/s speed=1.27x    
[rtp @ 0x2329380] RTP: missed 2204 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1308.9kbits/s speed=1.24x    
[rtp @ 0x2329380] RTP: missed 300 packets
[rtp @ 0x2329380] max delay reached. need to consume packet
[rtp @ 0x2329380] RTP: missed 468 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1155.6kbits/s speed= 1.2x    
[rtp @ 0x2329380] RTP: missed 2222 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1197.0kbits/s speed=1.19x    
[rtp @ 0x2329380] RTP: missed 278 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1156.1kbits/s speed=1.18x    
[rtp @ 0x2329380] RTP: missed 303 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1064.8kbits/s speed=1.32x    
[rtp @ 0x2329380] RTP: missed 3 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1064.8kbits/s speed=1.17x    
[rtp @ 0x2329380] RTP: missed 280 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1095.4kbits/s speed=1.16x    
[rtp @ 0x2329380] RTP: missed 1737 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1084.1kbits/s speed=1.15x    
[rtp @ 0x2329380] RTP: missed 485 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1142.9kbits/s speed=1.14x    
[rtp @ 0x2329380] RTP: missed 767 packets
[rtp @ 0x2329380] max delay reached. need to consume packet
[rtp @ 0x2329380] RTP: missed 3 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1080.6kbits/s speed=1.14x    
[rtp @ 0x2329380] RTP: missed 1562 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1063.9kbits/s speed=1.13x    
[rtp @ 0x2329380] RTP: missed 282 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1065.8kbits/s speed=1.12x    
[rtp @ 0x2329380] RTP: missed 1 packets
[rtp @ 0x2329380] max delay reached. need to consume packet
[rtp @ 0x2329380] RTP: missed 771 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1024.3kbits/s speed=1.11x    
[rtp @ 0x2329380] RTP: missed 1731 packets
[rtp @ 0x2329380] max delay reached. need to consume packet bitrate=1019.1kbits/s speed=1.11x    
[rtp @ 0x2329380] RTP: missed 298 packets

frame=  453 fps=8.9 q=-1.0 Lsize= 7397kB time=00:00:56.60 bitrate=1070.6kbits/s speed=1.11x


    


    After checking the video output with mpv player or ffplay ,I can observe that parameters from server caught the stream but mostly with lost packets so there are distortions in the video output file.

    


    I tried protocol_whitelist "file,rtp,udp" for preventing packet loss but it did not work out unfortunately.

    


    Any other parameter for solving this issue ?

    


  • ffmpeg rtmp broadcast on youtube speed below 1x

    23 septembre 2020, par usr6969

    i made an python and opencv program that produce frame per second around 8-15fps with MJPEG output format where MJPEG address served on localhost webserver (0.0.0.0:5000) and, i do attempt to broadcast its frame to rtmp server like youtube using ffmpeg so basically i do convert MJEG to flv and forward to rtmp server with following command ffmpeg -f  mjpeg -i http://0.0.0.0:5000/video_feed -f lavfi -i anullsrc -c:v libx264 -vf "scale=trunc(oh*a/2)*2:320,unsharp=lx=3:ly=3:la=1.0" -crf 24 -c:a aac -ac 1 -f flv rtmp://a.rtmp.youtube.com/live2/xxx-xxx-xxx but unfortunatelly youtube stream has too many buffering that occur every around 5 second and ffmpeg terminal tell that writing speed is only around 0.317x (expected to be sync with youtube around 0.99-1x), my question is

    


    does there a way to stream 'realtime' around 8-15fps and automatically sync with youtube rtmp server without buffering because i thought that youtube require around 30fps while my fps only 9-15fps that probably causing buffer.
do there an such like additional ffmpeg's parameter that able to speed up writing ? thank you

    


    enter image description here

    


    enter image description here