Recherche avancée

Médias (0)

Mot : - Tags -/optimisation

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

Autres articles (16)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

  • Prérequis à l’installation

    31 janvier 2010, par

    Préambule
    Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
    Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
    Il (...)

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

Sur d’autres sites (3418)

  • FFMPEG MP4 conversion takes so long its not practical

    30 avril 2018, par Chrisco420365

    I want to start out by saying that I’m not just stating the fact that FFMPEG to MP4 conversion is so slow, but I’m hoping someone here can help me with this as I’ve searched around and haven’t really found out what to do in order to fix my problem.

    So I found a script that seems to do the job for me, it inputs several video file formats and will in turn convert to MP4 which I will later allow the web user to watch online.

    Two main things are done in this script by FFMPEG, a still image is captured in .jpg format and the video is converted to MP4. After some tweaking the script seems to work but at first I thought that it wasn’t working, that it was simply halting my server.

    Let me back up for a minute... I am using FFMPEG on my development server, which is really just my crappy laptop with XAMPP installed on Windows 10 and only 2GB of RAM. Once I have the site working perfectly I will move from my crappy laptop development environment to probably a entry level dedicated server hosting plan from Godaddy or other, since at first I expect the traffic to my website to be very low.

    The problem I am having is I am testing out the script that I will show you, and even with a 10MB video, it takes over 2 minutes to finish. Meanwhile the upload progress bar shows 100% since the upload is in fact complete, but no message for the user to know that something is going on behind the scenes. Obviously that I can figure out how to fix myself, maybe even just put a message letting them know that it will be a few minutes. When I tried a video that is 120MB, it took over 5 minutes which means I had to not only modify my php.ini file to allow for such script execution times, but it also makes it so that I can do nothing on the website while this is happening.

    Not only can I not even so much as scroll the page up or down, but if I try to open another tab and load my website it just sits there with a blank screen as if its trying to access my site. Obviously it’s because FFMPEG is using up all system resources during its conversion of the video file. If I open file explorer and click once on the video file that is being created, and continue clicking once on it I’ll see the file size of this file slowly get larger and larger, which is obvious since the file is being filled. This problem of course is with no users on it other than myself since its in its development stage, so I wonder what it will be like on a dedicated server with users online. Will the other users not be able to do anything for however many minutes until whoever is uploading a video has their video finished ?

    Should it be necessary for me to increase the max execution time in the php.ini file to more than 5 minutes for a 120MB file ? What will happen if a user tries to upload a file larger than 120MB ? Should I cut them off at 500MB perhaps ?

    I love the fact that my users will be able to upload videos and I can get thumbnails and even convert to MP4 to display using HTML5 but not thrilled if noone, including the user uploading the video, can use the site as the system resources are pegged. The last time I uploaded a video on YouTube I think I remember a message saying that it would take several minutes to finish but I don’t remember the website just completely stopping for several minutes. Perhaps this is because I’m running on my insignificant laptop ?

    While searching for answers to this I did come across some people complaining about it being slow but didn’t find any solutions and in fact don’t think I saw people saying it completely locked up the website until finished. As I said, I’d hate for others not to be able to get to my website or be kicked off simply because someone is uploading a video.

    Perhaps this is a common issue that can be resolved with a powerful enough dedicated server once I move to production ? I would greatly appreciate any and all suggestions on how to resolve this so the user may at least continue using other areas of our website, while the conversion is taking place. I can send them an alert once the conversion is finished. If there are any suggestions as to a minimum dedicated server specs that would help alleviate this from happening, I am all ears ! :) Thanks !

    Here is the script that I’m currently using :

    <?php
    include_once($_SERVER['DOCUMENT_ROOT'].'/includes/dbc.php');
    // size input prevents buffer overrun exploits.
      function sizeinput($input, $len){
           (int)$len;
        (string)$input;
        $n = substr($input, 0,$len);
        $ret = trim($n);
        $out = htmlentities($ret, ENT_QUOTES);
        return $out;
    }

    //Check the file is of correct format.  
    function checkfile($input){
       $ext = array('mpg', 'wma', 'mov', 'flv', 'mp4', 'avi', 'qt', 'wmv', 'rm');
       $extfile = substr($input['name'],-4);
       $extfile = explode('.',$extfile);
       $good = array();
       $extfile = $extfile[1];
       if(in_array($extfile, $ext)){
             $good['safe'] = true;
            $good['ext'] = $extfile;
       }else{
             $good['safe'] = false;
      }
        return $good;
    }

    $user_id = $_SESSION['user_id'];
    // if the form was submitted process request if there is a file for uploading
    if($_POST && array_key_exists("vid_file", $_FILES)){
                              //$uploaddir is for videos before conversion
                             $uploaddir = 'temp/';
                              //$live_dir is for videos after converted to flv
           $live_dir = 'library/';
                               //$live_img is for the first frame thumbs.
           $live_img = 'thumbs/';      
                              $seed = time();      
           $upload = $seed;
           $uploadfile = 'temp/'.$upload.'.mp4';        
           $vid_title = sizeinput($_POST['vidTitle'], 50);
           $vid_title = sanitizeString($vid_title);
           $vid_desc = sizeinput($_POST['vidDesc'], 2000);
           $vid_desc = sanitizeString($vid_desc);
           $vid_cat = (int)$_POST['vidCat'];
           $safe_file = checkfile($_FILES['vid_file']);
           if($safe_file['safe'] == 1){
               if (move_uploaded_file($_FILES['vid_file']['tmp_name'], 'temp/'.$upload.'.mp4')) {
                      echo "File was successfully uploaded.<br />";
                       //$base = basename($uploadfile, $safe_file['ext']);
                       $new_file = $seed.'.mp4';
                       $new_image = $seed.'.jpg';
                       $new_image_path = "thumbs/".$seed.'.jpg';
                       $new_flv = "library/".$new_file;
                       //exec('ffmpeg -i '.$uploadfile.' -an -ss 00:00:01-r 1 -vframes 1 -f mjpeg -y '.$new_image_path);
                       exec('ffmpeg  -i '.$uploadfile.' -f mjpeg -vframes 1 -s 300x300 -an '.$new_image_path.'');
                       //ececute ffmpeg generate flv
                         exec('ffmpeg -i '.$uploadfile.' -f mp4 '.$new_flv);
                          //execute ffmpeg and create thumb


               echo 'Thank You For Your Video!<br />';
                          //create query to store video

           $sql = "INSERT INTO videos (`user_id`, `title`,`desc`, `file`, `thumb`) VALUES('".$user_id."','".$vid_title."','".$vid_desc."','".$new_file."','".$new_image."')";


                       echo '<img src="http://stackoverflow.com/feeds/tag/&#039;.$new_image_path.&#039;" style='max-width: 300px; max-height: 300px' /><br />
                             <h3>'.$vid_title.'</h3>';
                       mysqli_query($link, $sql) or die(mysqli_error($mysql));
                } else {
                       echo "Possible file upload attack!\n";
                       print_r($_FILES);
                }

           }else{

                echo 'Invalid File Type Please Try Again. You file must be of type
                .mpg, .wma, .mov, .flv, .mp4, .avi, .qt, .wmv, .rm';

           }
    }
    ?>
  • Stream Live Video and relay audio only to icecast2 server

    28 avril 2019, par BadAddy

    I have a working nginx server which allows me to stream live video from our mobile production system. We also have a radio station on a separate server and would like to stream to both. But I cannot make it work, nor can I get any logs or error information to explain why. I have tried nginx config and FFMPEG to try and resolve this.

    I have tried various attempts using what I think I understand from other pages online :

    exec_push FFREPORT=file=ffreport.log:level=48 ffmpeg -i $basename.flv -vn -acodec mp3 rtmp://source:********!!@xxx.xxx.xxx.180:8000/live;

    Also tried using the simple restream in the nginx conf :

    application restream {
                       live on;
                       exec_push ffmpeg -i $basename.flv -vn -acodec mp3 rtmp://source:***********@xxx.xxx.xxx.180:8000/live;
                       # push server2:1935
               }

    I have used the same information on Mixxx Live Broadcast Connection to get the details, thinking I am asking the same thing on the icecast2 server. Just the source is the nginx server.

    This is the full conf on nginx

    rtmp {

       server {
               listen 1935;
               chunk_size 4000;

               application live {
                       live on;
                       allow publish 127.0.0.1;
                       allow publish all;
                       allow play all;
                       record all;
                       record_path /usr/local/nginx/flv-streams;
                       record_unique on;
                       exec_record_done ffmpeg -i $basename.flv /usr/local/nginx/html/streams/$basename.mp4;
                       hls on;
                       hls_nested on;
                       hls_path /mnt/hls;
                       hls_fragment 1s;
                       hls_sync 1ms;
                       #exec_push FFREPORT=file=ffreport.log:level=48 ffmpeg -i $basename.flv -vn -acodec mp3 rtmp://source:*************@xxx.xxx.xxx.xxx:8000/live;
               }
               # Video on Demand
               application streams {
                       play /usr/local/nginx/html/streams/;
               }

               # Restream
               application restream {
                       live on;
                       exec_push ffmpeg -i $basename.flv -vn -acodec mp3 rtmp://source***************@xxx.xxx.xxx:8000/live;
                       # push server2:1935
               }

       }

    I would like those that can watch any broadcast with video, but if they can only listen, like a radio, I want them to listen via our radio player. They are two different streams, on different servers.

    At the moment I am using software to stream to both and would like to prevent this.

    Not found, by my own wording perhaps, any idea on how to do this.

    UPDATE

    With the help from TBR I have managed to get the stream from the Nginx Server going to a new server hosting icecast2. However, not in the way expected. It does this 32x faster, so not a stream as such.

    ffmpeg -i fcpr-1554651146.flv -vn -c:a mp3 icecast://source:password@10.0.0.0:8000/fcprlive.mp3

    However, I wonder if I have been thinking of this the wrong way. In my liquidsoap file I have this code :

    #!/usr/bin/liquidsoap
    # Log dir set("log.file.path","/tmp/basic-radio.log")
    # Music
    myplaylist = mksafe(playlist("/home/offlineftp/playlist"))

    #Live Source
    set("harbor.bind_addr","0.0.0.0")
    live = input.http("http://localhost:8000/fcprlive")
    radio = fallback(track_sensitive=false, [live,plist])

    # Stream it out
    output.icecast(%mp3, host = "localhost", port = 8000,
    password = "pass", mount = "/fcpr")

    Should I look at using LiquidSoap to pull the stream from Nginx, when live, and if no signal than go to the fallback ?

  • ffmpeg DASH encoding : always getting bitrate as 200k for vp9 codec

    29 novembre 2019, par Saurabh

    I am using following command, earlier put here : to generate DASH files :

    ffmpeg -y -nostdin -loglevel error -i "$1" \
           -map 0:v:0  -map 0:v:0 -map 0:v:0  -map 0:v:0  -map 0:v:0  -map 0:v:0 -map 0:a\?:0  \
           -maxrate:v:0 350k -bufsize:v:0 700k -c:v:0 libx264 -filter:v:0 "scale=320:-2"  \
           -maxrate:v:1 1000k -bufsize:v:1 2000k -c:v:1 libx264 -filter:v:1 "scale=640:-2"  \
           -maxrate:v:2 3000k -bufsize:v:2 6000k -c:v:2 libx264 -filter:v:2 "scale=1280:-2" \
           -maxrate:v:3 300k -minrate:v:3 100k -bufsize:v:3 600k -c:v:3 libvpx-vp9 -filter:v:3 "scale=320:-2"  \
           -maxrate:v:4 1088k -minrate:v:4 200k -bufsize:v:4 2176k -c:v:4 libvpx-vp9 -filter:v:4 "scale=640:-2"  \
           -maxrate:v:5 1500k -minrate:v:5 300k -bufsize:v:5 3000k -c:v:5 libvpx-vp9 -filter:v:5 "scale=1280:-2"  \
           -use_timeline 1  -use_template 1 -adaptation_sets "id=0,streams=0,1,2 id=1,streams=3,4,5 id=2,streams=a" \
           -threads 8 -crf 3 -seg_duration 5 -hls_init_time 1 -hls_time 5 -hls_playlist true -f dash "$2"

    The issue is, in the output, I always get bandwidth as 200k for vp9 codec(see output below), while for same video bandwidth for h264 codec varies as par resolution and quite less, I expected vp9 to be even less as it compresses more. I have tested using multiple different options like : -b:v, -deadline, -cpu-used -crf, etc, but not working expected with different values of these, What am I missing ?

    Sample output mpd file :

    &lt;?xml version="1.0" encoding="utf-8"?>
    <mpd xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediapresentationduration="PT25.4S" minbuffertime="PT15.0S">
       <programinformation>
       </programinformation>
       <period start="PT0.0S">
           <adaptationset contenttype="video" segmentalignment="true" bitstreamswitching="true" lang="und">
               <representation mimetype="video/mp4" codecs="avc1.64000c" bandwidth="104972" width="320" height="180" framerate="24000/1001">
                   <segmenttemplate timescale="24000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startnumber="1">
                       <segmenttimeline>
                           <s t="0" d="130130"></s>
                           <s d="250250"></s>
                           <s d="176176"></s>
                           <s d="54054"></s>
                       </segmenttimeline>
                   </segmenttemplate>
               </representation>
               <representation mimetype="video/mp4" codecs="avc1.64001e" bandwidth="227233" width="640" height="360" framerate="24000/1001">
                   <segmenttemplate timescale="24000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startnumber="1">
                       <segmenttimeline>
                           <s t="0" d="130130"></s>
                           <s d="250250"></s>
                           <s d="180180"></s>
                           <s d="50050"></s>
                       </segmenttimeline>
                   </segmenttemplate>
               </representation>
               <representation mimetype="video/mp4" codecs="avc1.64001f" bandwidth="616878" width="1280" height="720" framerate="24000/1001">
                   <segmenttemplate timescale="24000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startnumber="1">
                       <segmenttimeline>
                           <s t="0" d="130130"></s>
                           <s d="250250"></s>
                           <s d="180180"></s>
                           <s d="50050"></s>
                       </segmenttimeline>
                   </segmenttemplate>
               </representation>
           </adaptationset>
           <adaptationset contenttype="video" segmentalignment="true" bitstreamswitching="true" lang="und">
               <representation mimetype="video/mp4" codecs="vp09.00.11.08" bandwidth="200000" width="320" height="180" framerate="24000/1001">
                   <segmenttemplate timescale="24000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startnumber="1">
                       <segmenttimeline>
                           <s t="0" d="128128" r="3"></s>
                           <s d="98098"></s>
                       </segmenttimeline>
                   </segmenttemplate>
               </representation>
               <representation mimetype="video/mp4" codecs="vp09.00.21.08" bandwidth="200000" width="640" height="360" framerate="24000/1001">
                   <segmenttemplate timescale="24000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startnumber="1">
                       <segmenttimeline>
                           <s t="0" d="128128" r="3"></s>
                           <s d="98098"></s>
                       </segmenttimeline>
                   </segmenttemplate>
               </representation>
               <representation mimetype="video/mp4" codecs="vp09.00.31.08" bandwidth="200000" width="1280" height="720" framerate="24000/1001">
                   <segmenttemplate timescale="24000" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startnumber="1">
                       <segmenttimeline>
                           <s t="0" d="128128" r="3"></s>
                           <s d="98098"></s>
                       </segmenttimeline>
                   </segmenttemplate>
               </representation>
           </adaptationset>
           <adaptationset contenttype="audio" segmentalignment="true" bitstreamswitching="true" lang="eng">
               <representation mimetype="audio/mp4" codecs="mp4a.40.2" bandwidth="128000" audiosamplingrate="44100">
                   <audiochannelconfiguration schemeiduri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></audiochannelconfiguration>
                   <segmenttemplate timescale="44100" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startnumber="1">
                       <segmenttimeline>
                           <s t="0" d="235520" r="3"></s>
                           <s d="180224"></s>
                       </segmenttimeline>
                   </segmenttemplate>
               </representation>
           </adaptationset>
       </period>
    </mpd>

    I am using this video, but it is coming same for all 30 sec video I have tried.