Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (56)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (7656)

  • 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 :

    



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


    



    My Server.js file :

    



    var http = require('http');
var fs = require('fs');

console.log(__dirname);

var path='dash_segmentos/video.mpd';
fs.access(path, fs.constants.R_OK | fs.constants.W_OK, (err) => {
    if (err) {
        console.log("%s doesn't exist", path);
    } else {
        console.log('can read/write %s', path);
    }
});

const PORT=8080; 

fs.readFile('./player.html', function (err, html) {

    if (err) throw err;    

    http.createServer(function(request, response) {  
        response.setHeader("Access-Control-Allow-Headers", "authorization, content-type");
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
        response.writeHeader(200, {"Content-Type": "text/html"}); 
        response.write(html);  
        response.end();
    }).listen(PORT);
});


    



    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.

    



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

    



    &#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;

  • 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 :

    &lt;?php

           //thumb path should be added in the below code
           //test for thumb
           $dir_img=&#39;uploads/&#39;;
           $mediapath=&#39;thumb.jpg&#39;;
           $file_thumb=create_movie_thumb(&#39;test.mp4&#39;,$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[&#39;ffmpeg_path&#39;] = &#39;/usr/bin/&#39;; // Change the path according to your server.
               $dir_img=&#39;uploads/&#39;;
               $CONFIG[&#39;fullpath&#39;] = $dir_img."thumbs/";

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

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

               $output = array();

               if (eregi("win",$_ENV[&#39;OS&#39;])) {
                   // Command to create video thumb
                   $cmd = "\"".str_replace("\\","/", $CONFIG[&#39;ffmpeg_path&#39;])."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[&#39;ffmpeg_path&#39;]}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[&#39;debug_mode&#39;]) {
                       // 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>&amp;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;
           }
    ?>
  • FFMPEG : sws_scale returns error : Slice parameters 0, 2160 are invalid

    21 janvier 2020, par Matthew Czarnek

    I’m trying to follow a tutorial to display ffmpeg AVFrame output in SDL. The tutorial(and all examples I’m seeing online) are still using ’sws_getContext’, which has been deprecated and removed from the newest version of ffmpeg. Trying to change current pixel format from whatever it currently is to PIX_FMT_YUV420P, so I can display it. I believe I need the sws_scale function to accomplish this.

    However, sws_scale is the function that causes a command line error of :
    Slice parameters 0, 2160 are invalid

    Here is all my code associate with swsContext :

    struct SwsContext* av_sws_ctx = NULL;
    av_sws_ctx = sws_alloc_context();

    sws_init_context(av_sws_ctx, NULL, NULL);

    sws_scale(av_sws_ctx, (uint8_t const* const*)av_frame->data,
                           av_frame->linesize, 0, av_codec_context->height,
                           av_frame->data, av_frame->linesize);

    Further complicating the matter, SwsContext is only defined internal to ffmpeg, externally I can’t set/get any variables or even view them in the debugger.

    int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[] )

    The vales of other parameters, other than av_sws_ctx :

    srcSlice: av_frame->data =
        8 arrays, first is filled with "\x10\x10\x10\x10\x10..."
        second and third are "€€€€€€€€€€€€€€€€€..."
        rest are NULL
    linesize(av_frame->linesize) is an array:
       3840,1920,1920,0,0,0,0,0
    srcSliceY:0
    srcSliceH:2160
    dest: same as second parameter (av_frame->data)
    dstStride: av_frame->linesize again

    If I drill into sws_scale source code, I find that this error is thrown by this chunk of code :

    if ((srcSliceY &amp; (macro_height-1)) ||
           ((srcSliceH&amp; (macro_height-1)) &amp;&amp; srcSliceY + srcSliceH != c->srcH) ||
           srcSliceY + srcSliceH > c->srcH) {
           av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);
           return AVERROR(EINVAL);
       }

    I assume that the issue therefore is that the height of my video is bigger than sws_context(4k video). But can’t figure out how to tell sws_context what it’s height should be using sws_alloc_context or sws_init_context or any other function.

    See something I’m missing ? Thank you.