
Recherche avancée
Autres articles (60)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
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" ;
Sur d’autres sites (7601)
-
Capturing Screen with FFMPEG on RTP protocol
23 septembre 2020, par mertakkartalI 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 streaming UDP
2 octobre 2020, par xKedarI'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


-
vlc python stream from other NAT
7 octobre 2020, par xKedarI'm trying to stream, using FFmpeg, my webcam and audio from PC1 to PC2 in another LAN.


PC1 : Public IP address with port forwarding so I can reach it


PC2 : In a different NAT from PC1


I basically run a server on PC1 in order to acquire IP and port from PC2 and reply on the same address


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 the same port number both for the server(localPort) and the 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(PC2) 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()



Where I basically try to reach the server both to send my IP:Port and to punch a hole in the NAT in order to be able to get the packages sent from PC1 despite being behind a NAT.


I guess this is not working because I can not get the stream to work but I really can not figure out how to fix that