Recherche avancée

Médias (91)

Autres articles (106)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Qu’est ce qu’un masque de formulaire

    13 juin 2013, par

    Un masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
    Chaque formulaire de publication d’objet peut donc être personnalisé.
    Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
    Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...)

Sur d’autres sites (11434)

  • PHP Create video thumbnail with FFMPEG - returns error code 1

    27 février 2013, par Light

    I am trying to create a video thumbnail with FFMPEG using the following script.
    However I am getting return value of 1. What does it mean ? What is error code 1 ? I have Googled it and didn't find and answer. Thanks.
    Here is the code :

    <?php

           //thumb path should be added in the below code
           //test for thumb
           $dir_img='uploads/';
           $mediapath='thumb.jpg';
           $file_thumb=create_movie_thumb('test.mp4',$mediapath,$mediaid);

           $name_file=explode(".",$mediapath);
           $imgname="thumb_".$name_file[0].".jpg";    

           /*
             Function to create video thumbnail using ffmpeg
           */
           function create_movie_thumb($src_file,$mediapath,$mediaid)
           {

               global $CONFIG, $ERROR;

               $CONFIG['ffmpeg_path'] = '/usr/bin/'; // Change the path according to your server.
               $dir_img='uploads/';
               $CONFIG['fullpath'] = $dir_img."thumbs/";

               $src_file = $src_file;
               $name_file=explode(".",$mediapath);
               $imgname="thumb_".$name_file[0].".jpg";
               $dest_file = $CONFIG['fullpath'].$imgname;

               if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) {
                   // get the basedir, remove '/include'
                   $cur_dir = substr(dirname(__FILE__), 0, -8);
                   $src_file = '"' . $cur_dir . '\\' . strtr($src_file, '/', '\\') . '"';
                   $ff_dest_file = '"' . $cur_dir . '\\' . strtr($dest_file, '/', '\\') . '"';
               } else {
                   $src_file = escapeshellarg($src_file);
                   $ff_dest_file = escapeshellarg($dest_file);
               }

               $output = array();

               if (eregi("win",$_ENV['OS'])) {
                   // Command to create video thumb
                   $cmd = "\"".str_replace("\\","/", $CONFIG['ffmpeg_path'])."ffmpeg\" -i ".str_replace("\\","/" ,$src_file )." -an -ss 00:00:05 -r 1 -vframes 1 -y ".str_replace("\\","/" ,$ff_dest_file);
                   exec ("\"$cmd\"", $output, $retval);
                   echo "exec1";

               } else {
                   // Command to create video thumb
                   $cmd = "{$CONFIG['ffmpeg_path']}ffmpeg -i $src_file -an -ss 00:00:05 -r 1 -vframes 1 -y $ff_dest_file";
                   exec ($cmd, $output, $retval);
                   echo "exec2";
               }


               if ($retval) {
                   $ERROR = "Error executing FFmpeg - Return value: $retval";
                   if ($CONFIG['debug_mode']) {
                       // Re-execute the command with the backtick operator in order to get all outputs
                       // will not work if safe mode is enabled
                       $output = `$cmd 2>&1`;
                       $ERROR .= "<br /><br /><div align="\&quot;left\&quot;">Cmd line : <br /><span style="&quot;font-size:120%&quot;">" . nl2br(htmlspecialchars($cmd)) . "</span></div>";
                       $ERROR .= "<br /><br /><div align="\&quot;left\&quot;">The ffmpeg program said:<br /><span style="&quot;font-size:120%&quot;">";
                       $ERROR .= nl2br(htmlspecialchars($output));
                       $ERROR .= "</span></div>";
                   }
                   echo $ERROR;
                   @unlink($dest_file);
                   return false;
               }

               $return = $dest_file;
               //@chmod($return, octdec($CONFIG[&#39;default_file_mode&#39;])); //silence the output in case chmod is disabled
               return $return;
           }
    ?>
  • Shaka Player returns 4001 error - Node.js local web server playing MPEG-DASH

    27 mai 2020, par salgarji

    I've used Chrome inspection tool to access 'Console' and analyze what is happening. Complete error information :

    &#xA;&#xA;

    D {severity: 2, category: 4, code: 4001, data: Array(1), handled: false}&#xA;category: 4&#xA;code: 4001&#xA;data: Array(1)&#xA;0: "http://localhost:8080/dash_segmentos/video.mpd"&#xA;length: 1&#xA;__proto__: Array(0)&#xA;handled: false&#xA;severity: 2&#xA;__proto__: Object&#xA;

    &#xA;&#xA;

    My Server.js file :

    &#xA;&#xA;

    var http = require(&#x27;http&#x27;);&#xA;var fs = require(&#x27;fs&#x27;);&#xA;&#xA;console.log(__dirname);&#xA;&#xA;var path=&#x27;dash_segmentos/video.mpd&#x27;;&#xA;fs.access(path, fs.constants.R_OK | fs.constants.W_OK, (err) => {&#xA;    if (err) {&#xA;        console.log("%s doesn&#x27;t exist", path);&#xA;    } else {&#xA;        console.log(&#x27;can read/write %s&#x27;, path);&#xA;    }&#xA;});&#xA;&#xA;const PORT=8080; &#xA;&#xA;fs.readFile(&#x27;./player.html&#x27;, function (err, html) {&#xA;&#xA;    if (err) throw err;    &#xA;&#xA;    http.createServer(function(request, response) {  &#xA;        response.setHeader("Access-Control-Allow-Headers", "authorization, content-type");&#xA;        response.setHeader("Access-Control-Allow-Origin", "*");&#xA;        response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");&#xA;        response.writeHeader(200, {"Content-Type": "text/html"}); &#xA;        response.write(html);  &#xA;        response.end();&#xA;    }).listen(PORT);&#xA;});&#xA;

    &#xA;&#xA;

    As you can see I've added CORS (I guess it's correct) and a console.log to see if it's in the proper location. Furthermore, I've verified that file is accessible with fs.access and it returns can read/write dash_segmentos/video.mpd For this reason, I'm sure I am in the correct path and referencing the right file.

    &#xA;&#xA;

    The HTML code (player.html) provided to Server.js :

    &#xA;&#xA;

    &#xA;&#xA; &#xA; <code class="echappe-js">&lt;script type=&quot;text/javascript&quot;&amp;#xA;src=&quot;https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.5.11/shaka-player.compiled.js&quot;&gt;&lt;/script&gt;&#xA; &#xA; &#xA; 
    &#xA; &#xA;

    &#xA;&#xA; &lt;script&gt;&amp;#xA;function initApp() { &amp;#xA;shaka.polyfill.installAll(); &amp;#xA;if (shaka.Player.isBrowserSupported()) { &amp;#xA; initPlayer(); &amp;#xA; } else { &amp;#xA; console.error(&amp;#x27;Browser not supported!&amp;#x27;);&amp;#xA; }}&amp;#xA;&amp;#xA;function initPlayer() { &amp;#xA;var video = document.getElementById( &amp;#x27;video&amp;#x27; );&amp;#xA;var player = new shaka.Player( video );&amp;#xA; window.player = player; &amp;#xA;player.addEventListener(&amp;#x27;error&amp;#x27;, onErrorEvent); &amp;#xA;player.load(path).then(function (){&amp;#xA;    console.log(&amp;#x27;Video loaded correctly&amp;#x27;);&amp;#xA; }).catch(onError);&amp;#xA;&amp;#xA;function onErrorEvent(event) {&amp;#xA; onError(event.detail); &amp;#xA; }&amp;#xA;function onError(error) {&amp;#xA; console.error(&amp;#x27;Codigo de error: &amp;#x27;, error.code, &amp;#x27; en &amp;#x27;, error);&amp;#xA; }&amp;#xA;}&amp;#xA;&lt;/script&gt;&#xA;&#xA;&lt;script&gt;&amp;#xA;var path=&amp;#x27;dash_segmentos/video.mpd&amp;#x27;;&amp;#xA;//var path=&amp;#x27;https://dash.akamaized.net/dash264/TestCases/2c/qualcomm/1/MultiResMPEG2.mpd&amp;#x27;;&amp;#xA;//the URL above is working! but it won&amp;#x27;t read my local mpd&amp;#xA;&amp;#xA;document.addEventListener(&amp;#x27;DOMContentLoaded&amp;#x27;, initApp);&amp;#xA;&amp;#xA; &lt;/script&gt;&#xA; &#xA;&#xA;

    &#xA;&#xA;

    I've tried changing the URL to an online resource and the player is properly working.

    &#xA;&#xA;

    My fluent-ffmpeg command which generates the video is :

    &#xA;&#xA;

    var ffmpeg = require(&#x27;fluent-ffmpeg&#x27;);&#xA;&#xA;var grabacion = new ffmpeg();&#xA;&#xA;grabacion.addInput(&#x27;0&#x27;)&#xA;.inputOptions([&#x27;-y -nostdin&#x27;, &#x27;-f avfoundation&#x27;, &#x27;-video_size 1280x720&#x27;, &#x27;-framerate 30&#x27;])&#xA;.outputOptions([&#x27;-vcodec libx264&#x27;, &#x27;-keyint_min 0&#x27;, &#x27;-g 100&#x27;, &#x27;-map 0:v&#x27;, &#x27;-b:v 1000k&#x27;, &#x27;-f dash&#x27;,&#xA; &#x27;-use_template 1&#x27;, &#x27;-use_timeline 0&#x27;, &#x27;-init_seg_name video0-$RepresentationID$-$Number$.mp4&#x27;,&#xA; &#x27;-media_seg_name video0-$RepresentationID$-$Number$.mp4&#x27;,&#x27;-single_file 0&#x27;, &#x27;-remove_at_exit 0&#x27;, &#x27;-window_size 20&#x27;, &#x27;-seg_duration 4&#x27;])&#xA;.output(&#x27;/path/to/files/dash_segmentos/video.mpd&#x27;)&#xA;.run();&#xA;

    &#xA;&#xA;

    The mpd manifest file is :

    &#xA;&#xA;

    &lt;?xml version="1.0" encoding="utf-8"?>&#xA;<mpd xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediapresentationduration="PT26.7S" maxsegmentduration="PT4.0S" minbuffertime="PT13.2S">&#xA;    <programinformation>&#xA;    </programinformation>&#xA;    <servicedescription>&#xA;    </servicedescription>&#xA;    <period start="PT0.0S">&#xA;        <adaptationset contenttype="video" startwithsap="1" segmentalignment="true" bitstreamswitching="true" framerate="30000/1001" maxwidth="1280" maxheight="720" par="16:9">&#xA;            <representation mimetype="video/mp4" codecs="avc1.7a001f" bandwidth="1000000" width="1280" height="720" sar="1:1">&#xA;                <segmenttemplate timescale="1000000" duration="4000000" initialization="video0-$RepresentationID$-$Number$.mp4" media="video0-$RepresentationID$-$Number$.mp4" startnumber="1">&#xA;                </segmenttemplate>&#xA;            </representation>&#xA;        </adaptationset>&#xA;    </period>&#xA;</mpd>&#xA;

    &#xA;&#xA;

    Is something about ffmpeg ? Permissions ? Pixel format ? Encoding ? I've tried with other mpd file provided by my Raspberry Pi using video4linux (v4l) and it returns the same error !

    &#xA;&#xA;

    I know that's a lot of code, but maybe you find it quicker than me. I guess it's a Shaka Player thing with the XML, but I can't explain how ffmpeg is wrongly creating XML code.

    &#xA;&#xA;

    Thank you in advance !!

    &#xA;

  • Streaming to YouTube using FFmpeg Problems

    9 mai 2016, par jason

    I am trying to stream to a live event I have created inside of YouTube. I am trying to stream a already created video. The command I am using is noted below.

    The problem I have is that YouTube is showing the Streaming status as good (picture attached) and it seems to be receiving the data. But there is no sound and no picture in the live event. I’m not sure what the issue could be.

    ffmpeg -re -y -i input.mp4 -vcodec libx264 -b:v 600k -r 25 -s 640x360 -filter:v yadif -ab 64k -ac 1 -ar 44100 -f flv "rtmp://a.rtmp.youtube.com/live2/KEY"

    Image showing YouTube streaming status :

    Image showing youtube streaming status

    Console output :

    ffmpeg version N-60321-g4d7d9a5 Copyright (c) 2000-2014 the FFmpeg developers
     built on Feb  2 2014 22:01:03 with gcc 4.8.2 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
    e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
    ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
    ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
    eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
    cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
    ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
     libavutil      52. 63.100 / 52. 63.100
     libavcodec     55. 49.101 / 55. 49.101
     libavformat    55. 29.101 / 55. 29.101
     libavdevice    55.  7.100 / 55.  7.100
     libavfilter     4.  1.102 /  4.  1.102
     libswscale      2.  5.101 /  2.  5.101
     libswresample   0. 17.104 /  0. 17.104
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: isommp42
       creation_time   : 2013-10-24 05:44:23
     Duration: 00:41:52.93, start: 0.000000, bitrate: 187 kb/s
       Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yu
    v420p, 480x360, 89 kb/s, 15 fps, 15 tbr, 30 tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96
    kb/s (default)
       Metadata:
         creation_time   : 2013-10-24 05:44:39
         handler_name    : IsoMedia File Produced by Google, 5-11-2011
    [libx264 @ 040fdc40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2
    FMA3 LZCNT BMI2
    [libx264 @ 040fdc40] profile High, level 3.0
    [libx264 @ 040fdc40] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec - Cop
    yleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
    lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
    e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
    ma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
    interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
    b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=75 keyint_min=38 scenec
    ut=0 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=1200 ratetol=1.0 qc
    omp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/keyname':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: isommp42
       encoder         : Lavf55.29.101
       Stream #0:0(und): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 85
    4x480, q=-1--1, 1200 kb/s, 1k tbn, 25 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz,
    mono, fltp, 64 kb/s (default)
       Metadata:
         creation_time   : 2013-10-24 05:44:39
         handler_name    : IsoMedia File Produced by Google, 5-11-2011
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 -> libx264)
     Stream #0:1 -> #0:1 (aac -> libmp3lame)
    Press [q] to stop, [?] for help
    frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:00.39 bitrate=   9.2kbits/s
    ...
    frame=  463 fps=7.8 q=0.0 size=    1534kB time=00:00:31.66 bitrate= 396.8kbits/s
    [flv @ 040fd6e0] Failed to update header with correct duration.
    [flv @ 040fd6e0] Failed to update header with correct filesize.
    frame=  463 fps=6.8 q=-1.0 Lsize=    2055kB time=00:00:31.79 bitrate= 529.6kbits
    /s
    video:1778kB audio:249kB subtitle:0 data:0 global headers:0kB muxing overhead 1.
    405947%
    [libx264 @ 040fdc40] frame I:7     Avg QP: 2.24  size: 44703
    [libx264 @ 040fdc40] frame P:153   Avg QP: 0.65  size:  8418
    [libx264 @ 040fdc40] frame B:303   Avg QP: 5.74  size:   724
    [libx264 @ 040fdc40] consecutive B-frames: 11.9%  2.6%  0.0% 85.5%
    [libx264 @ 040fdc40] mb I  I16..4: 66.0% 12.4% 21.6%
    [libx264 @ 040fdc40] mb P  I16..4:  4.7%  0.8%  1.5%  P16..4:  6.6%  1.1%  1.1%
    0.0%  0.0%    skip:84.2%
    [libx264 @ 040fdc40] mb B  I16..4:  0.2%  0.0%  0.1%  B16..8:  3.0%  0.2%  0.1%
    direct: 0.6%  skip:95.8%  L0:47.7% L1:49.2% BI: 3.0%
    [libx264 @ 040fdc40] final ratefactor: -9.42
    [libx264 @ 040fdc40] 8x8 transform intra:11.8% inter:35.4%
    [libx264 @ 040fdc40] coded y,uvDC,uvAC intra: 33.7% 11.2% 11.1% inter: 2.6% 1.6%
    1.6%
    [libx264 @ 040fdc40] i16 v,h,dc,p: 13% 86%  0%  0%
    [libx264 @ 040fdc40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9% 74% 11%  0%  1%  1%  1%
    1%  2%
    [libx264 @ 040fdc40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 61%  6%  1%  3%  2%  4%
    2%  4%
    [libx264 @ 040fdc40] i8c dc,h,v,p: 88% 10%  2%  0%
    [libx264 @ 040fdc40] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 040fdc40] ref P L0: 81.7%  9.4%  8.0%  0.9%
    [libx264 @ 040fdc40] ref B L0: 78.9% 20.9%  0.2%
    [libx264 @ 040fdc40] ref B L1: 99.1%  0.9%
    [libx264 @ 040fdc40] kb/s:471.59
    Received signal 2: terminating.

    Edit -

    I have now tested the following codes but I still dotn get any picture or sound.. but the health status in youtube still shows good

    I ran this command first

    ffmpeg -i input.mp4 -vcodec libx264 -preset medium -maxrate 3000k -bufsize 6000k -vf "scale=1280:-1,format=yuv420p" -g 50 -acodec libmp3lame -b:a 128k -ac 2 -ar 44100 file.flv

    and then I ran this

    ffmpeg -re -i file.flv -codec copy -f flv rtmp://a.rtmp.youtube.com/live2/<key>
    </key>

    I still didnt get any picture

    I also tried the full command in 1

    ffmpeg -re -i input.mp4 -vcodec libx264 -preset veryfast -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmp://a.rtmp.youtube.com/live2/<key>  
    </key>

    still no joy