Recherche avancée

Médias (91)

Autres articles (82)

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (5230)

  • Python vlc stream from outside NAT

    7 octobre 2020, par xKedar

    I'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 think it is not working because I can not reach PC2 but I really can not figure out how to fix that because I was expecting that the first part, where I reach PC1 from PC2 was enough in order to establish a connection

    


  • How do I stop ffmpeg from spamming itself when I auto restart ?

    15 décembre 2019, par billy61300
    const fs = require("fs");
    const express = require("express");
    const app = express();
    const path = require("path");
    const ffmpeg = require("fluent-ffmpeg");
    const md5 = require("md5");
    const readline = require("readline");
    const formidable = require("formidable");

    const dir = "Custom/Dir";
    const thumb = __dirname + "/thumb";
    const ph = __dirname + "/placeholder";

    app.use("/serve", express.static(dir));
    app.use("/thumb", express.static(thumb));
    app.use("/ph", express.static(ph));

    const list = [];
    const listThumb = [];

    process.on("uncaughtException", (err) => {
       console.log("Caught Exception: " + err);
    });

    let passwords = fs.readFileSync("passwords.txt").toString().split("\n");

    app.get("/", (req, res) => {
       res.sendFile(__dirname + "/index.html")
    });

    app.get("/upload", (req, res) => {
       res.sendFile(__dirname + "/upload.html");
    });

    app.post("/uploadFile", (req, res) => {
       let form = new formidable.IncomingForm();
       form.parse(req, (err, fields, files) => {
           if (passwords.includes(md5(fields.password))) {
               fs.readFile(files.filetoupload.path, (err, data) => {
                   let newPath = dir + "/" + files.filetoupload.name;
                   if (!fs.existsSync(newPath)) {
                       fs.writeFile(newPath, data, (err) => {
                           res.writeHead(200, {"Content-Type": "text/html"});
                           res.write("<h1>File Uploaded</h1>");
                           res.end();
                       });
                   } else {
                       res.writeHead(200, {"Content-Type": "text/html"});
                       res.write("<h1>File already exists. Upload with a different name please.</h1>");
                       res.end();
                   }
               });
           }
       });
    });

    fs.readdir(dir, (err, files) => {
       if (err) {
           throw err;
       } else {
           let i = 0;
           files.forEach((file) => {
               list[i] = path.basename(file);
               if (!fs.existsSync(__dirname + "\\thumb\\" + list[i] + ".png")) {
                   console.log("Generating: " + list[i] + ".png");
                   let proc = new ffmpeg({source: dir + "/" + file, nolog: true});
                   proc.setFfmpegPath(__dirname + "\\ffmpeg.exe");
                   proc.screenshots({
                       timestamps: [0.0],
                       filename: list[i] + ".png",
                       folder: __dirname + "\\thumb\\",
                       size: "100x100"
                   });
               }
               i++;
           });
           let serveDoc = "";
           for (let j = 0; j &lt; list.length; j++) {
               if (path.extname(list[j]).toLowerCase() !== ".jpg" &amp;&amp; path.extname(list[j]).toLowerCase() !== ".jpeg" &amp;&amp; path.extname(list[j]).toLowerCase() !== ".png") {
                   if (path.extname(list[j]).toLowerCase() == ".mp3" || path.extname(list[j]).toLowerCase() == ".wav") {
                       serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address" />" + "</a> ";;
                   }/* else if (path.extname(list[j]).toLowerCase() == ".webm") {
                       serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address" />" + "</a> ";;
                   }*/ else {
                       serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;.png" />" + "</a> ";
                   }
               } else {
                   serveDoc += "<a href="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;">" + "<img width='100' height='100' src="http://stackoverflow.com/feeds/tag/address&#034; + list[j] + &#034;" />" + "</a> ";
               }
           }
           serveDoc += "";
           fs.writeFile("index.html", serveDoc, (err) => {
               if (err) throw err;
           });
       }
    });

    setTimeout(() => {
       process.exit(0);
    }, 1000 * 60 * 30);

    app.listen(80, (err) => {
       if (err) {
           throw err;
       } else {
           console.log("Listening on port 80.");
       }
    });

    Issue is that the program needs to be restarted every X minutes so that the list of media will update on it’s own. However, upon a restart, ffmpeg goes crazy and starts to spam a batch window under it’s name repeatedly over and over again without stopping. The only way out of it is to restart my computer.

    I’ve tried to use PM2, Forever, Supervisor. Nodemon afaik won’t auto restart.

  • avcodec/mips/h264chroma_mmi : Version 2 of the optimizations for loongson mmi

    17 mai 2016, par ZhouXiaoyong
    avcodec/mips/h264chroma_mmi : Version 2 of the optimizations for loongson mmi
    

    1. no longer use the register names directly and optimized code format
    2. to be compatible with O32, specify type of address variable with mips_reg and handle the address variable with PTR_ operator
    3. use uld and mtc1 to workaround cpu 3A2000 gslwlc1 bug (gslwlc1 instruction extension bug in O32 ABI)

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavcodec/mips/h264chroma_mmi.c