Recherche avancée

Médias (1)

Mot : - Tags -/publier

Autres articles (67)

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • 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 (8867)

  • How to stop perl buffering ffmpeg output

    4 février 2017, par Sebastian King

    I am trying to have a Perl program process the output of an ffmpeg encode, however my test program only seems to receive the output of ffmpeg in periodic chunks, thus I am assuming there is some sort of buffering going on. How can I make it process it in real-time ?

    My test program (the tr command is there because I thought maybe ffmpeg’s carriage returns were causing perl to see one big long line or something) :

    #!/usr/bin/perl

    $i = "test.mkv"; # big file, long encode time
    $o = "test.mp4";

    open(F, "-|", "ffmpeg -y -i '$i' '$o' 2>&1 | tr '\r' '\n'")
           or die "oh no";

    while(<f>) {
           print "A12345: $_"; # some random text so i know the output was processed in perl
    }
    </f>

    Everything works fine when I replace the ffmpeg command with this script :

    #!/bin/bash

    echo "hello";

    for i in `seq 1 10`; do
           sleep 1;
           echo "hello $i";
    done

    echo "bye";

    When using the above script I see the output each second as it happens. With ffmpeg it is some 5-10 seconds or so until it outputs and will output sometimes 100 lines each output.

    I have tried using the program unbuffer ahead of ffmpeg in the command call but it seems to have no effect. Is it perhaps the 2>&amp;1 that might be buffering ?
    Any help is much appreciated.

    If you are unfamiliar with ffmpeg’s output, it outputs a bunch of file information and stuff to STDOUT and then during encoding it outputs lines like

    frame=  332 fps= 93 q=28.0 size=     528kB time=00:00:13.33 bitrate= 324.2kbits/s speed=3.75x

    which begin with carriage returns instead of new lines (hence tr) on STDERR (hence 2>&amp;1).

  • Python stream H.264 data over socket

    9 janvier 2017, par Ezra Knobloch

    I am creating a H.264 encoded stream on my Raspberry using the tool ’raspivid’ and sending that stream to stdout.
    What i want is sending that stream to another computer and feed it to ffmpeg which in turn feeds it to MPlayer.

    When i do this using netcat and pipes it does work really good, i have a clean stream without any graphic bugs.

    I try to get the raspivid stdout over the subprocess module, see code below. Im more or less sure the problem lies somewhere there cause i did something similar a while back and it worked without many problems, and the only thing i did different now is using subprocess.

    My question is : does someone see what causes my problems ?

    Some Notes :

    • Using streamObj.get_data(pcktSize) did never work until now (MPlayer and ffmpeg cant open the stream)

    • process.stdout.readline() seems to be a bit faster than just read()

    • this code seems to be slower than just piping and netcat, how would i make it faster ? (while still using python)

    i need to write this sentence cause the code formatting below would be corrupted if i would not.

    import subprocess, socket, sys, time
    from thread import start_new_thread

    class streamObject:
       def __init__(self):
           global data
           data = ""

       def start_stream(self, rot, t, w, h, fps):
           global data

           process = subprocess.Popen(['/usr/bin/raspivid', '-rot', str(rot), '-t', str(t), '-w', str(w), '-h', str(h), '-fps', str(fps), '-o', '-'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

           nodata_counter = 0

           while 1:
               if process.poll() is None:
                   data += process.stdout.readline()
                   #data += process.stdout.read(256)

                   sys.stdout.write("buffered %i bytes.     \r" % len(data))
                   sys.stdout.flush()
               elif nodata_counter &lt; 200:
                   nodata_counter += 1

                   time.sleep(0.1)
               else:
                   break

       def get_alldata(self):
           global data

           return data

       def get_data(self, data_len):
           global data

           if len(data) > data_len:
               temp = data[0:data_len]
               data = data[data_len:len(data)]

               return temp
           else:
               return None

       def clear_cache(self):
           global data

           data = ""

       def poll(self):
           global data

           try:
               if len(data) != 0:
                   return None
               else:
                   return 0
           except:
               return 0

    def socket_connect(ip, port):
       s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       s.connect((ip, port))

       return s

    def socket_listen(ip, port):
       s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       s.bind((ip, port))
       s.listen(1)

       conn, addr = s.accept()

       return conn

    def socket_close(sock):
       sock.close()

    def send_stream(sock, streamObj, pcktSize):
       timeout = 0

       while 1:
           if streamObj.poll() is None:
               #data = streamObj.get_data(pcktSize)

               data = streamObj.get_alldata()
               streamObj.clear_cache()

               if data is not None:
                   sock.send(data)
           elif timeout &lt; 200:
               timeout += 1

               time.sleep(0.1)
           else:
               break

    stream = streamObject()

    start_new_thread(stream.start_stream, (180, 0, 1280, 720, 20))

    sock = socket_connect("xxxx.xxxx.xxxx.xxxx", 7777)

    send_stream(sock, stream, 256)

    Here is a short video of the graphic bugs i encounter.

    I am doing this over a direct ethernet connection at this time.

  • Ubuntu Server 16.10 - run ffmpeg on startup in background

    12 février 2017, par Greg

    i’m trying to find information about starting a background script that should run ffmpeg streaming in the background.

    I need to have this script started as soon as everything else in Ubuntu Server has started but i find that i should use /etc/rc.local which is not present in my newly installed system.

    Can you give me a hint here ?

    The script i want to run (and keep running as long as the server is working) is as follows :

    #! /bin/bash

    USTREAM_URL="rtmp://xxxx.xxx.xxx"

    SOURCE="rtsp://xxx.xxx.xxx"
    KEY="mykey"

    while :
    do

    ffmpeg \
       -v 16 -i "$SOURCE" \
       -an -pix_fmt yuv420p \
       -threads 2 -qmax 15 \
       -f flv "$USTREAM_URL/$KEY flashver=FMLE/3.0\20(compatible;\20FMSc/1.0) live=true"

    sleep 5
    done