Recherche avancée

Médias (0)

Mot : - Tags -/alertes

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

Autres articles (26)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (4994)

  • How to add a token verification in url with Laravel when playing HLS videos ?

    31 mars 2022, par Philip

    I have been playing with Laravel and FFMPEG for few weeks but got stuck. Hope someone could help here. Thank you in advanced.

    


    Background

    


    I have a video website build with Laravel 9. I use FFMPEG to convert uploaded MP4 to HLS with laravel-ffmpeg package. AES encryption is applied. Then I store the converted m3u8 playlist, key and ts file in Storage path with symlinks created to public folder. I stored the path in database and call it in view file. I use plyr + hls.js to play the video. Everything is working fine.

    


    However, I would like to further protect my videos from being played by other website. I blocked the cross domain access in Nginx but seem it only check the referrer which could be faked. I can see many video websites that their m3u8 path contains a token parameter :

    


    https://some-domain.com/videos/index.m3u8?token=abc123456


    


    I am trying to do the same but stuck.

    


    These are my Laravel files

    


    VideoController

    


    This will convert mp4 to m3u8 , key, ts files and save to database

    


    FFMpeg::fromDisk('videos')
    ->open($queue->path)
    ->exportForHLS()
    ->withRotatingEncryptionKey(function($filename,$content) use($queue){
        Storage::disk('videos')->put('m3u8/'.$queue->video->slug.'/'.$filename, $content);
    })
    ->setSegmentLength(10) // optional
    ->setKeyFrameInterval(48) // optional
    ->onProgress(function ($percentage, $remaining, $rate) use($queue){
        $queue->update([
            'is_processing'=>true,
            'percentage'=>$percentage,
            'remaining'=>$remaining,
            'rate'=>$rate,
        ]);
    })
    ->addFormat($resolution_720)
    ->save($m3u8_path);


    


    blade file

    


    This will show the m3u8 playlist path and pass to js file

    


    @if (isset($video->play_url)  &amp;&amp; $video->play_url != &#x27;&#x27;)&#xA;    <div class="col-12 mb-3 single-video">&#xA;        <video playsinline="playsinline" controls="controls" muted="muted">&#xA;&#xA;        </video>&#xA;        <code class="echappe-js">&lt;script&gt; &amp;#xA;            var m3u8 = &quot;{{ $video-&gt;play_url }}&quot; &amp;#xA;            var token = &amp;#x27;token_xxxxxxxx&amp;#x27;&amp;#xA;        &lt;/script&gt;&#xA;    

    &#xA;@endif&#xA;

    &#xA;

    js file

    &#xA;

    This will play the video (with plyr player)

    &#xA;

    const player = new Plyr(&#x27;#player&#x27;);&#xA;if(typeof(m3u8) != "undefined" &amp;&amp; m3u8 !== null){&#xA;    m3u8 =  m3u8 &#x2B; &#x27;?token=&#x27; &#x2B; token&#xA;    console.log(m3u8,token)&#xA;    var video = document.getElementById(&#x27;player&#x27;);&#xA;    if(Hls.isSupported()) {&#xA;        var hls = new Hls();&#xA;        hls.loadSource(m3u8);&#xA;        hls.attachMedia(video);&#xA;&#xA;    }else if (video.canPlayType(&#x27;application/vnd.apple.mpegurl&#x27;)) {&#xA;        video.src = m3u8;&#xA;&#xA;    }&#xA;&#xA;}&#xA;

    &#xA;

    If I remove "token" from the above code. The video plays fine. But now I could like to check if the token valid before returning the file. I remove the symlink to prevent direct access to the file.

    &#xA;

    public_path(&#x27;m3u8&#x27;) => storage_path(&#x27;app/videos/m3u8&#x27;),&#xA;

    &#xA;

    Route

    &#xA;

    in web.php, I added few routes to check the token

    &#xA;

        Route::get(&#x27;/m3u8/{slug}/{filename}.m3u8&#x27;, [VideoController::class, &#x27;get_m3u8&#x27;])->name(&#x27;video.m3u8&#x27;);&#xA;    Route::get(&#x27;/m3u8/{slug}/{filename}.ts&#x27;, [VideoController::class, &#x27;get_ts&#x27;])->name(&#x27;video.ts&#x27;);&#xA;    Route::get(&#x27;/m3u8/{slug}/{filename}.key&#x27;, [VideoController::class, &#x27;get_key&#x27;])->name(&#x27;video.key&#x27;);&#xA;

    &#xA;

    Then in VideoController

    &#xA;

    public function get_m3u8(Request $request ,$slug ,$filename)&#xA;{&#xA;        if($request->token == 123){&#xA;            return response()->file(storage_path(&#x27;app/videos/m3u8/&#x27;.$slug.&#x27;/&#x27;.$filename .&#x27;.m3u8&#x27;),[&#xA;                &#x27;Content-Type&#x27; => &#x27;application/x-mpegURL&#x27;,&#xA;            ]);&#xA;        }else{&#xA;            return abort(&#x27;403&#x27;);&#xA;        }&#xA;}&#xA;

    &#xA;

    But the video cannot be played. Because when loading index.m3u8, it loads index_0_1200.m3u8 next and then load the rest of ts files which all do not contain the token. But I cannot add to token duration the conversion from mp4 to hls because in actually case the token will be dynamic such as adding timestamp.

    &#xA;

    Please advise. Thank you. My final aim is to prevent other from using the m3u8 playlist and key files to play my ts files. It will consume a lot of bandwidth.

    &#xA;

  • php shell_exec() command pop out error and permission denied ffmpeg

    3 juin 2023, par user3711175

    This is the main index.php file where I run my code to generate a video thumbnail with ffmpeg but it has no lucks at all I have been searching online for a lot of solution but nothing comes out i will be very appreciate if you guys can help me out. The shell_exec() keep giving me error

    &#xA;&#xA;

    &#xA;&#xA;&#xA;&#xA;<form action="index.php" method="POST" enctype="multipart/form-data">&#xA;<input type="file" /><input type="submit" value="upload" />&#xA;&#xA;</form>&#xA;&#xA;&lt;?php&#xA;&#xA;if(isset($_POST[&#x27;submit&#x27;])){&#xA;&#xA;&#xA;$ffmpeg = "/Users/mac/Documents/ffmpeg/3.1.4/bin/ffmpeg";&#xA;$videoFile = $_FILES["file"]["tmp_name"];&#xA;$imageFile = "1.jpg";&#xA;$size = "320x240";&#xA;$getFromSecond = 5;&#xA;$cmd = "$ffmpeg -i $videoFile -an -ss $getFromSecond -s $size $imageFile 2>&amp;1";&#xA;&#xA;    echo shell_exec($cmd);&#xA;&#xA;&#xA;echo shell_exec(&#x27;whoami&#x27;);&#xA;if(!shell_exec($cmd)){&#xA;&#xA;&#xA;    echo "thumbnail created";&#xA;}else{&#xA;    echo "error creating thumbnail";&#xA;}&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;}&#xA;&#xA;?>&#xA;&#xA;&#xA;&#xA;

    &#xA;

  • php shell_exec() command pop out error and permission denied ffmpeg

    19 octobre 2016, par user3711175

    This is the main index.php file where I run my code to generate a video thumbnail with ffmpeg but it has no lucks at all I have been searching online for a lot of solution but nothing comes out i will be very appreciate if you guys can help me out. The shell_exec() keep giving me error

    <form action="index.php" method="POST" enctype="multipart/form-data">
    <input type="file" /><input type="submit" value="upload" />

    </form>

    &lt;?php

    if(isset($_POST['submit'])){


    $ffmpeg = "/Users/mac/Documents/ffmpeg/3.1.4/bin/ffmpeg";
    $videoFile = $_FILES["file"]["tmp_name"];
    $imageFile = "1.jpg";
    $size = "320x240";
    $getFromSecond = 5;
    $cmd = "$ffmpeg -i $videoFile -an -ss $getFromSecond -s $size $imageFile 2>&amp;1";

       echo shell_exec($cmd);


    echo shell_exec('whoami');
    if(!shell_exec($cmd)){


       echo "thumbnail created";
    }else{
       echo "error creating thumbnail";
    }






    }

    ?>
  • Boussole SPIP

    SPIP.net-La documentation officielle et téléchargement de (...) SPIP Code-La documentation du code de SPIP Programmer SPIP-La documentation pour développer avec (...) Traduire SPIP-Espace de traduction de SPIP et de ses (...) Plugins SPIP-L'annuaire des plugins SPIP SPIP-Contrib-L'espace des contributions à SPIP Forge SPIP-L'espace de développement de SPIP et de ses (...) Discuter sur SPIP-Les nouveaux forums de la communauté (...) SPIP Party-L'agenda des apéros et autres rencontres (...) Médias SPIP-La médiathèque de SPIP SPIP Syntaxe-Tester l'édition de texte dans SPIP