Recherche avancée

Médias (1)

Mot : - Tags -/vidéo

Autres articles (45)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • MediaSPIP Player : les contrôles

    26 mai 2010, par

    Les contrôles à la souris du lecteur
    En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)

Sur d’autres sites (6846)

  • Transcoding video server. FFMPEG. Queues

    2 janvier 2018, par kostia7alania

    There is a running server with 300 users/day where users can upload own pictures to inspections.
    Now need to add video share service with sharing pictures.

    Now we use :
    1) IIS 10 (yes, WINDOWS server !) ;
    2) MS SQL 2017 ;
    3) PHP 7.0.
    and : asp.net,xlt 1,C#.

    It is desirable that we use the technologies we already use.

    Now I buy one new server and want to use it for transcoding and streaming.

    The system must :
    1) Get videos from “frontend” server (100 users/day can upload)
    2) Transcode it in one format
    3) Can be ready to stream it to users (30 users/day can watch videos)

    See my little review about possible solutions —>> https://vk.com/topic-125614288_363361445

    IMAGE => Video uploading, transcoding and keeping system

    p.s. I found FFMPEG, but don’t know how it works in parallel mode.
    Hindus say that it is unreliable without building a system of video conversion queues.

    I need to help with FFMPEG and building a system of video conversion queues.

    UPD : HERE IS MY EXAMPLE CODE :

       

       
           
           
           <?php require ('dbconn.php');?>
       
           <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/js/jquery.js' type=&quot;text/javascript&quot;&gt;&lt;/script&gt;

    &lt;script src='http://stackoverflow.com/feeds/tag/js/bootstrap.js' type=&quot;text/javascript&quot;&gt;&lt;/script&gt;



    < ?php if(isset($_FILES[’file’])) $name = $_FILES[’file’][’name’] ; $extension = explode(’.’, $name) ; $extension = end($extension) ; $type = $_FILES[’file’][’type’] ; $size = $_FILES[’file’][’size’] /1024/1024 ; $random_name = rand() ; $tmp = $_FILES[’file’][’tmp_name’] ; if (empty($_POST["descript"])) $descript = "" ; else $descript = ($_POST["descript"]) ;

    if ((strtolower($type) != "video/mpg") &&
    (strtolower($type) != "video/wma") &&
    (strtolower($type) != "video/mov") &&
    (strtolower($type) != "video/flv") &&
    (strtolower($type) != "video/mp4") &&
    (strtolower($type) != "video/avi") &&
    (strtolower($type) != "video/qt") &&
    (strtolower($type) != "video/wmv") &&
    (strtolower($type) != "video/wmv") )

    $message="Video Format Not Supported !" ;
    else
    $message="Video uploaded successively !" ;
    move_uploaded_file($tmp, ’./upload/’.$random_name.’.’.$extension) ;
    //$conn->query("INSERT INTO [dbo].[videos] VALUES(’$name’,’$random_name.$extension’,’descript !’)") ;

    $SQL2 = "INSERT INTO [dbo].[videos] VALUES(’$name’,’$random_name.$extension’,’$descript’)" ;
    $RES2 = @odbc_exec( $DB, $SQL2 ) ;

     ?>
    < ?php
    echo "&lt;script type='text/javascript'&gt;alert('$descript\\n\\n$message\\n\\nUpload: $name\\nSize: $size\\nType: $type\\nStored in: uploads/$name');&lt;/script&gt;" ;
     ?>

    < ?php

     ?>

    Select a Video :



    &nbsp ;&nbsp ;&nbsp ;&nbsp ;


    List of Videos :

      < ?php //$query = $conn->query("SELECT * FROM videos") ; $SQL = "SELECT * FROM [dbo].[videos]" ; $RES = @odbc_exec( $DB, $SQL ) ; //while($row = $RES->fetch()) while($row = odbc_fetch_array($RES)) $video_id = $row[’video_id’] ;  ?>

      Click to Watch --->

      < ?php
      echo $row[’title’] ;
       ?>


      < ?php include (’video_modal.php’) ; ?>
      < ?php

       ?>

    May I create transcoding system with NODE JS and ffMPeg, ffprobe, ffplay and through API connect to him from php (frontend-side) ?

  • Non-blocking realtime read from multiple shell subprocesses (Python)

    8 février 2018, par Norman Edance

    I’m building real time multiple videostream monitoring using ffmpeg and subrocess.
    I currently have the following code, inspired by "Async and await with subprocesses" post.

    The problem is that after a certain period of time the output stops printing and the processes go into zombie mode. I guess that this problem is related to the overload of PIPE or deadlock. Help needed.

    """Async and await example using subprocesses

    Note:
       Requires Python 3.6.
    """

    import os
    import sys
    import time
    import platform
    import asyncio

    async def run_command_shell(command):
       """Run command in subprocess (shell)

       Note:
           This can be used if you wish to execute e.g. "copy"
           on Windows, which can only be executed in the shell.
       """
       # Create subprocess
       process = await asyncio.create_subprocess_shell(
           command,
           stderr=asyncio.subprocess.PIPE)

       # Status
       print('Started:', command, '(pid = ' + str(process.pid) + ')')

       # Wait for the subprocess to finish
       stdout, stderr = await process.communicate()

       # Progress
       if process.returncode == 0:
           print('Done:', command, '(pid = ' + str(process.pid) + ')')
       else:
           print('Failed:', command, '(pid = ' + str(process.pid) + ')')

       # Result
       result = stderr.decode().strip()

       # Real time print
       print(result)

       # Return stdout
       return result


    def make_chunks(l, n):
       """Yield successive n-sized chunks from l.

       Note:
           Taken from https://stackoverflow.com/a/312464
       """
       if sys.version_info.major == 2:
           for i in xrange(0, len(l), n):
               yield l[i:i + n]
       else:
           # Assume Python 3
           for i in range(0, len(l), n):
               yield l[i:i + n]


    def run_asyncio_commands(tasks, max_concurrent_tasks=0):
       """Run tasks asynchronously using asyncio and return results

       If max_concurrent_tasks are set to 0, no limit is applied.

       Note:
           By default, Windows uses SelectorEventLoop, which does not support
           subprocesses. Therefore ProactorEventLoop is used on Windows.
           https://docs.python.org/3/library/asyncio-eventloops.html#windows
       """

       all_results = []

       if max_concurrent_tasks == 0:
           chunks = [tasks]
       else:
           chunks = make_chunks(l=tasks, n=max_concurrent_tasks)

       for tasks_in_chunk in chunks:
           if platform.system() == 'Windows':
               loop = asyncio.ProactorEventLoop()
               asyncio.set_event_loop(loop)
           else:
               loop = asyncio.get_event_loop()

           commands = asyncio.gather(*tasks_in_chunk)  # Unpack list using *
           results = loop.run_until_complete(commands)
           all_results += results
           loop.close()
       return all_results


    if __name__ == '__main__':

       start = time.time()

       if platform.system() == 'Windows':
           # Commands to be executed on Windows
           commands = [
               ['hostname']
           ]
       else:
           # Commands to be executed on Unix
           commands = [
               ['du', '-sh', '/var/tmp'],
               ['hostname'],
           ]
       cmds = [["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx  -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx  -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx  -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx  -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx  -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx  -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"],
               ["ffmpeg -y -i udp://xxx.xx.xx.xxx:xxxx -f null -"]]

       tasks = []
       for command in cmds:
           tasks.append(run_command_shell(*command))


       # # Shell execution example
       # tasks = [run_command_shell('copy c:/somefile d:/new_file')]

       # # List comprehension example
       # tasks = [
       #     run_command(*command, get_project_path(project))
       #     for project in accessible_projects(all_projects)
       # ]

       results = run_asyncio_commands(tasks, max_concurrent_tasks=20)  # At most 20 parallel tasks
       print('Results:', results)

       end = time.time()
       rounded_end = ('{0:.4f}'.format(round(end-start,4)))
       print('Script ran in about', str(rounded_end), 'seconds')

    Related : Non-blocking read from multiple subprocesses (Python)

  • Fast WAV audio decoding with FFMPEG : speeding up avformat_open_input / avformat_find_stream_info

    5 août 2020, par Vadim Kantorov

    I'm implementing an audio reading backend for a machine learning system. This means that decoding should be fast. Potential formats are .wav, .gsm, .opus.

    &#xA;

    I've implemented audio decoding in FFMPEG : https://github.com/vadimkantorov/readaudio/blob/master/decode_audio_ffmpeg.c

    &#xA;

    Currently using scipy.io.wavfile.read on a 5-second 8khz .wav file (typical file for my workload ; in practice I'm loading and processing around 1K such files in parallel) takes about 0.02 milliseconds (averaged over reading the same file 100 times). This is reasonable, because .wav format is quite simple.

    &#xA;

    In my FFMPEG code, only calling doing avformat_open_input and avformat_find_stream_info() takes about 0.45 milliseconds (with fmt_ctx->streams[0]-probe_packets=1) and is 20x slower than scipy.io.wavfile.read.

    &#xA;

    So far soundfile.read is 5x slower than scipy.io.wavfile.read, ffmpeg is 4x slower than soundfile.read. So in total ffmpeg is 20x slower than scipy.io.wavfile.read.

    &#xA;

    Does anyone know how to avoid taking this latency hit ? It still seems that avformat_open_input and avformat_find_stream_info() do too much work.

    &#xA;

    I optimized probing by setting probe_packets=1 and used AVIO to control buffered reading. I think IO is now okay optimized...

    &#xA;

    Log after optimizations :

    &#xA;

    [wav @ 0x55f151175240] Format wav probed with size=2048 and score=99&#xA;decode_audio_BEFORE: 0.55 msec&#xA;[wav @ 0x55f151175240] Before avformat_find_stream_info() pos: 78 bytes read:65614 seeks:1 nb_streams:1&#xA;[wav @ 0x55f151175240] probing stream 0 pp:1&#xA;[wav @ 0x55f151175240] Probe with size=4096, packets=2500 detected mp3 with score=1&#xA;[wav @ 0x55f151175240] probed stream 0&#xA;[wav @ 0x55f151175240] parser not found for codec pcm_s16le, packets or times may be invalid.&#xA;[wav @ 0x55f151175240] After avformat_find_stream_info() pos: 80078 bytes read:145614 seeks:1 frames:20&#xA;

    &#xA;

    Log before optimizations :

    &#xA;

    decode_audio_BEFORE: 0.61 msec&#xA;[wav @ 0x563667d57b60] Before avformat_find_stream_info() pos: 78 bytes read:65614 seeks:1 nb_streams:1&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:32&#xA;[wav @ 0x563667d57b60] Probe with size=4096, packets=2469 detected mp3 with score=1&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:31&#xA;[wav @ 0x563667d57b60] Probe with size=8192, packets=2470 detected mp3 with score=1&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:30&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:29&#xA;[wav @ 0x563667d57b60] Probe with size=16384, packets=2472 detected mp3 with score=1&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:28&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:27&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:26&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:25&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:24&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:23&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:22&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:21&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:20&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:19&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:18&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:17&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:16&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:15&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:14&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:13&#xA;[wav @ 0x563667d57b60] probing stream 0 pp:12&#xA;[wav @ 0x563667d57b60] probed stream 0&#xA;[wav @ 0x563667d57b60] parser not found for codec pcm_s16le, packets or times may be invalid.&#xA;[wav @ 0x563667d57b60] After avformat_find_stream_info() pos: 80078 bytes read:145614 seeks:1 frames:20&#xA;decode_audio_AFTER: 7.90 msec&#xA;

    &#xA;

    This problem is well-known, but I couldn't find a workaround so far :

    &#xA;

    &#xA;