Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (100)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • 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

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

Sur d’autres sites (9054)

  • How to install ffmpeg

    9 mars 2016, par user5913892

    I want to make a "mini" editor video. My goal is, cut some part of the video and then save it and also create an undo button. Now , I was looking for the best solution (This operation have to be done in a website) and I found that I have to use ffmpeg. I didn’t know if ffmpeg was already installed on my server and I use this php script to discover it :

    <?php

    /**
    * Test script for FFmpeg
    *
    * @author Andycoder /wdevblog.net.ru/>
    */

    ini_set('display_errors',1);
    error_reporting(E_ALL);

    $is_windows = strpos( php_uname(), "Windows" ) !== false;
    $ffmpeg_path = !empty( $_POST['ffmpeg_path'] ) && strpos( $_POST['ffmpeg_path'], 'ffmpeg' ) !== false ? trim( $_POST['ffmpeg_path'] ) : '';
    if( !$ffmpeg_path && !$is_windows ){
       $ffmpeg_path = trim( shell_exec( 'which ffmpeg' ) );
    }

    function getCodecs( $ffmpeg_path = '' ) {

       $lines = array();
       $encoders = array();
       exec( "{$ffmpeg_path} -codecs", $lines);

       foreach ($lines as $line) {

           if (preg_match('/^\s+([A-Z .]+)\s+(\w{2,})\s+(.*)$/', $line, $m)) {
               $type = trim($m[1]);
               if (strpos($type, 'E') !== false) {
                   $encoder = trim($m[2]);
                   if (strpos($encoder, ',') !== false) {
                       foreach (split(',', $encoder) as $e) {
                           $encoders[] = $e;
                       }
                   } else {
                       $encoders[] = $encoder;
                   }
               }
           }
       }
       sort($encoders);

       return $encoders;
    }

    function getPHPPath(){

       $is_windows = strpos( strtolower(php_uname()), 'windows' ) !== false;

       if( $is_windows ){
           $output = dirname(ini_get('extension_dir')) . "/php.exe";
       }else{
           $output = trim(shell_exec("which php"));
       }

       return $output;
    }

    $info = array();

    $info['php_version'] = array( 'name' => 'PHP version', 'value' => phpversion() );
    $info['php_path'] = array( 'name' => 'PHP path', 'value' =>  getPHPPath() );
    $info['web_server'] = array( 'name' => 'Web server', 'value' => $_SERVER['SERVER_SOFTWARE'] );
    $info['ffmpeg_path'] = array( 'name' => 'FFMPEG path', 'value' =>  $ffmpeg_path );

    $info['ffmpeg_version'] = array( 'name' => 'FFMPEG version', 'value' => '' );
    if( $ffmpeg_path ){
       $ffmpeg_ver = shell_exec( "{$ffmpeg_path} -version" );
       preg_match( '/.+version.+/', $ffmpeg_ver, $matches );
       if( !empty( $matches ) ){
           $info['ffmpeg_version']['value'] = $matches[0];
       }
    }
    $info['yamdi_path'] = array( 'name' => 'Yamdi path', 'value' => !$is_windows ? trim(shell_exec('which yamdi')) : '' );
    $info['mp4box_path'] = array( 'name' => 'MP4Box (GPAC) path', 'value' => !$is_windows ? trim(shell_exec('which MP4Box')) : '' );
    $info['qtfaststart_path'] = array( 'name' => 'qt-faststart path', 'value' => !$is_windows ? trim(shell_exec('which qt-faststart')) : '' );
    $info['flvtool2_path'] = array( 'name' => 'flvtool2 path', 'value' => !$is_windows ? trim(shell_exec('which flvtool2')) : '' );

    $info['ffmpeg_codecs'] = array( 'name' => 'FFMPEG codecs', 'value' => array() );
    if( $ffmpeg_path ) {
       $info['ffmpeg_codecs']['value'] = getCodecs( $ffmpeg_path );
    }

    if( empty( $info['ffmpeg_codecs']['value'] ) ){
       $info['ffmpeg_path']['value'] = '';
    }

    ksort($info);

    ?>



       



    <code class="echappe-js">&lt;script type=&quot;text/javascript&quot;&gt;<br />
       function expandCollapse( id ){<br />
           if( document.getElementById(id).style.display == 'none' ){<br />
               document.getElementById(id).style.display = 'block';<br />
           }else{<br />
               document.getElementById(id).style.display = 'none';<br />
           }<br />
       }<br />
    &lt;/script&gt;


    < ?php foreach( $info as $key => $opt ) : ?>

    < ?php endforeach ; ?>

    Property Value
    < ?php echo $opt[’name’] ; ?> :

    < ?php if( !empty( $opt[’value’] ) ) : ?>

    < ?php
    if( !is_array( $opt[’value’] ) ) :
    echo $opt[’value’] ;
    else : ?>

    [Expand/Collapse]

    < ?php foreach( $opt[’value’] as $val ) : ?>

    < ?php echo $val ; ?>

    < ?php endforeach ; ?>

    < ?php endif ; ?>

    < ?php else : ?>
    [Not found]
    < ?php endif ; ?>

    that return me this :

    enter image description here

    So, I have not ffmpeg installed on that server. The server should be Linux, I say this because I use one of the many website in Internet to discover it.
    enter image description here

    I know that the website say that the Webserver is Engine-x, but my company has told that is Apache (as the php script already told me). Now , I found this link http://www.mysql-apache-php.com/ffmpeg-install.htm (in Stackoverflow and many other parts) that say how to install ffmpeg in Linux, but Where should I execute these commands ? Should I use Putty ? or What ?

  • Mimic Audacity amplification with Pydub

    16 août 2022, par Unisionzz

    For my music library I have used Audacity for recent years to amplify the music to similar levels of loudness ; technically speaking this is not completely true, but for me it is sufficient. However, as it is tedious to do this all by hand, I decided to write a Python code to automate this process for me. The code after the imported package(s) and defined functions will run in a loop in which the filename changes depending on which song is processed.

    &#xA;

    The difficult part is that I have not yet been able to find a consistent way to amplify different songs so that when the output files are put through Audacity, it will not want to change the amplitude by more than 0.1 dB(FS).

    &#xA;

    Below are two attempts which seem to have come closest to the desirable output ; other methods that I have tried were either less succesfull or resulted in clipping.

    &#xA;

    The first attempt finds the maximum dBFS of the song and then applies a gain in order for the maximum dBFS to equal 0 (I have also tried this method with sound.dBFS and sound.apply_gain, but results seem more mixed than the attempt below) :

    &#xA;

    from pydub import AudioSegment&#xA;&#xA;def change_amplitude(sound, target_dBFS):&#xA;    change_in_dBFS = target_dBFS - sound.max_dBFS&#xA;    return sound.apply_gain_stereo(change_in_dBFS)&#xA;&#xA;# Audio is gathered from a hard coded path&#xA;s = AudioSegment.from_file(Dir&#x2B;filename&#x2B;".mp3", "mp3")&#xA;amp_s = change_amplitude(s, 0)&#xA;amp_s.export(Dir&#x2B;filename&#x2B;".mp3", format = "mp3")&#xA;

    &#xA;

    The second attempt finds the amplitude and the maximum allowable amplitude (before clipping), recalculates both to dB and then adds the dB_diff to the sound :

    &#xA;

    import numpy as np&#xA;from pydub import AudioSegment&#xA;&#xA;s = AudioSegment.from_file(Dir&#x2B;filename&#x2B;".mp3", "mp3")&#xA;&#xA;# Get dB amplitude of song and maximum allowable value&#xA;dB_sound = 20*np.log10(s.max)&#xA;dB_max = 20*np.log10(s.max_possible_amplitude)&#xA;dB_diff = dB_max - dB_sound&#xA;&#xA;amp_sound = s &#x2B; dB_diff&#xA;

    &#xA;

    Summarizing, I would like to import a music file, amplify it similar to Audacity amplification and then export the file again.

    &#xA;

  • ffmpeg delay in decoding h264

    19 mai 2020, par Mateen Ulhaq

    NOTE : Still looking for an answer !

    &#xA;&#xA;

    I am taking raw RGB frames, encoding them to h264, then decoding them back to raw RGB frames.

    &#xA;&#xA;

    [RGB frame] ------ encoder ------> [h264 stream] ------ decoder ------> [RGB frame]&#xA;              ^               ^                    ^               ^&#xA;        encoder_write    encoder_read        decoder_write    decoder_read&#xA;

    &#xA;&#xA;

    I would like to retrieve the decoded frames as soon as possible. However, it seems that there is always a one-frame delay no matter how long one waits.¹ In this example, I feed the encoder a frame every 2 seconds :

    &#xA;&#xA;

    $ python demo.py 2>/dev/null&#xA;time=0 frames=1 encoder_write&#xA;time=2 frames=2 encoder_write&#xA;time=2 frames=1 decoder_read   &lt;-- decoded output is delayed by extra frame&#xA;time=4 frames=3 encoder_write&#xA;time=4 frames=2 decoder_read&#xA;time=6 frames=4 encoder_write&#xA;time=6 frames=3 decoder_read&#xA;...&#xA;

    &#xA;&#xA;

    What I want instead :

    &#xA;&#xA;

    $ python demo.py 2>/dev/null&#xA;time=0 frames=1 encoder_write&#xA;time=0 frames=1 decoder_read   &lt;-- decode immediately after encode&#xA;time=2 frames=2 encoder_write&#xA;time=2 frames=2 decoder_read&#xA;time=4 frames=3 encoder_write&#xA;time=4 frames=3 decoder_read&#xA;time=6 frames=4 encoder_write&#xA;time=6 frames=4 decoder_read&#xA;...&#xA;

    &#xA;&#xA;

    The encoder and decoder ffmpeg processes are run with the following arguments :

    &#xA;&#xA;

    encoder: ffmpeg -f rawvideo -pix_fmt rgb24 -s 224x224 -i pipe: \&#xA;                -f h264 -tune zerolatency pipe:&#xA;&#xA;decoder: ffmpeg -probesize 32 -flags low_delay \&#xA;                -f h264 -i pipe: \&#xA;                -f rawvideo -pix_fmt rgb24 -s 224x224 pipe:&#xA;

    &#xA;&#xA;

    Complete reproducible example below. No external video files needed. Just copy, paste, and run python demo.py 2>/dev/null !

    &#xA;&#xA;

    import subprocess&#xA;from queue import Queue&#xA;from threading import Thread&#xA;from time import sleep, time&#xA;import numpy as np&#xA;&#xA;WIDTH = 224&#xA;HEIGHT = 224&#xA;NUM_FRAMES = 256&#xA;&#xA;def t(epoch=time()):&#xA;    return int(time() - epoch)&#xA;&#xA;def make_frames(num_frames):&#xA;    x = np.arange(WIDTH, dtype=np.uint8)&#xA;    x = np.broadcast_to(x, (num_frames, HEIGHT, WIDTH))&#xA;    x = x[..., np.newaxis].repeat(3, axis=-1)&#xA;    x[..., 1] = x[:, :, ::-1, 1]&#xA;    scale = np.arange(1, len(x) &#x2B; 1, dtype=np.uint8)&#xA;    scale = scale[:, np.newaxis, np.newaxis, np.newaxis]&#xA;    x *= scale&#xA;    return x&#xA;&#xA;def encoder_write(writer):&#xA;    """Feeds encoder frames to encode"""&#xA;    frames = make_frames(num_frames=NUM_FRAMES)&#xA;    for i, frame in enumerate(frames):&#xA;        writer.write(frame.tobytes())&#xA;        writer.flush()&#xA;        print(f"time={t()} frames={i &#x2B; 1:&lt;3} encoder_write")&#xA;        sleep(2)&#xA;    writer.close()&#xA;&#xA;def encoder_read(reader, queue):&#xA;    """Puts chunks of encoded bytes into queue"""&#xA;    while chunk := reader.read1():&#xA;        queue.put(chunk)&#xA;        # print(f"time={t()} chunk={len(chunk):&lt;4} encoder_read")&#xA;    queue.put(None)&#xA;&#xA;def decoder_write(writer, queue):&#xA;    """Feeds decoder bytes to decode"""&#xA;    while chunk := queue.get():&#xA;        writer.write(chunk)&#xA;        writer.flush()&#xA;        # print(f"time={t()} chunk={len(chunk):&lt;4} decoder_write")&#xA;    writer.close()&#xA;&#xA;def decoder_read(reader):&#xA;    """Retrieves decoded frames"""&#xA;    buffer = b""&#xA;    frame_len = HEIGHT * WIDTH * 3&#xA;    targets = make_frames(num_frames=NUM_FRAMES)&#xA;    i = 0&#xA;    while chunk := reader.read1():&#xA;        buffer &#x2B;= chunk&#xA;        while len(buffer) >= frame_len:&#xA;            frame = np.frombuffer(buffer[:frame_len], dtype=np.uint8)&#xA;            frame = frame.reshape(HEIGHT, WIDTH, 3)&#xA;            psnr = 10 * np.log10(255**2 / np.mean((frame - targets[i])**2))&#xA;            buffer = buffer[frame_len:]&#xA;            i &#x2B;= 1&#xA;            print(f"time={t()} frames={i:&lt;3} decoder_read  psnr={psnr:.1f}")&#xA;&#xA;cmd = (&#xA;    "ffmpeg "&#xA;    "-f rawvideo -pix_fmt rgb24 -s 224x224 "&#xA;    "-i pipe: "&#xA;    "-f h264 "&#xA;    "-tune zerolatency "&#xA;    "pipe:"&#xA;)&#xA;encoder_process = subprocess.Popen(&#xA;    cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE&#xA;)&#xA;&#xA;cmd = (&#xA;    "ffmpeg "&#xA;    "-probesize 32 "&#xA;    "-flags low_delay "&#xA;    "-f h264 "&#xA;    "-i pipe: "&#xA;    "-f rawvideo -pix_fmt rgb24 -s 224x224 "&#xA;    "pipe:"&#xA;)&#xA;decoder_process = subprocess.Popen(&#xA;    cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE&#xA;)&#xA;&#xA;queue = Queue()&#xA;&#xA;threads = [&#xA;    Thread(target=encoder_write, args=(encoder_process.stdin,),),&#xA;    Thread(target=encoder_read, args=(encoder_process.stdout, queue),),&#xA;    Thread(target=decoder_write, args=(decoder_process.stdin, queue),),&#xA;    Thread(target=decoder_read, args=(decoder_process.stdout,),),&#xA;]&#xA;&#xA;for thread in threads:&#xA;    thread.start()&#xA;

    &#xA;&#xA;


    &#xA;&#xA;

    ¹ I did some testing and it seems the decoder is waiting for the next frame's NAL header 00 00 00 01 41 88 (in hex) before it decodes the current frame. One would hope that the prefix 00 00 00 01 would be enough, but it also waits for the next two bytes !

    &#xA;&#xA;

    ² Prior revision of question.

    &#xA;