
Recherche avancée
Médias (2)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (47)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (5962)
-
PHP Create video thumbnail with FFMPEG - returns error code 1
27 février 2013, par LightI 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="\"left\"">Cmd line : <br /><span style=""font-size:120%"">" . nl2br(htmlspecialchars($cmd)) . "</span></div>";
$ERROR .= "<br /><br /><div align="\"left\"">The ffmpeg program said:<br /><span style=""font-size:120%"">";
$ERROR .= nl2br(htmlspecialchars($output));
$ERROR .= "</span></div>";
}
echo $ERROR;
@unlink($dest_file);
return false;
}
$return = $dest_file;
//@chmod($return, octdec($CONFIG['default_file_mode'])); //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 salgarjiI'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 returnscan 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 toServer.js
:




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

 
 

 



<script>&#xA;function initApp() { &#xA;shaka.polyfill.installAll(); &#xA;if (shaka.Player.isBrowserSupported()) { &#xA; initPlayer(); &#xA; } else { &#xA; console.error(&#x27;Browser not supported!&#x27;);&#xA; }}&#xA;&#xA;function initPlayer() { &#xA;var video = document.getElementById( &#x27;video&#x27; );&#xA;var player = new shaka.Player( video );&#xA; window.player = player; &#xA;player.addEventListener(&#x27;error&#x27;, onErrorEvent); &#xA;player.load(path).then(function (){&#xA; console.log(&#x27;Video loaded correctly&#x27;);&#xA; }).catch(onError);&#xA;&#xA;function onErrorEvent(event) {&#xA; onError(event.detail); &#xA; }&#xA;function onError(error) {&#xA; console.error(&#x27;Codigo de error: &#x27;, error.code, &#x27; en &#x27;, error);&#xA; }&#xA;}&#xA;</script>


<script>&#xA;var path=&#x27;dash_segmentos/video.mpd&#x27;;&#xA;//var path=&#x27;https://dash.akamaized.net/dash264/TestCases/2c/qualcomm/1/MultiResMPEG2.mpd&#x27;;&#xA;//the URL above is working! but it won&#x27;t read my local mpd&#xA;&#xA;document.addEventListener(&#x27;DOMContentLoaded&#x27;, initApp);&#xA;&#xA; </script>

 




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



My fluent-ffmpeg command which generates the video is :



var ffmpeg = require('fluent-ffmpeg');

var grabacion = new ffmpeg();

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




The mpd manifest file is :



<?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="PT26.7S" maxsegmentduration="PT4.0S" minbuffertime="PT13.2S">
 <programinformation>
 </programinformation>
 <servicedescription>
 </servicedescription>
 <period start="PT0.0S">
 <adaptationset contenttype="video" startwithsap="1" segmentalignment="true" bitstreamswitching="true" framerate="30000/1001" maxwidth="1280" maxheight="720" par="16:9">
 <representation mimetype="video/mp4" codecs="avc1.7a001f" bandwidth="1000000" width="1280" height="720" sar="1:1">
 <segmenttemplate timescale="1000000" duration="4000000" initialization="video0-$RepresentationID$-$Number$.mp4" media="video0-$RepresentationID$-$Number$.mp4" startnumber="1">
 </segmenttemplate>
 </representation>
 </adaptationset>
 </period>
</mpd>




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 !



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.



Thank you in advance !!


-
Additional : Add Brazillian PIS/NIS number validation method (#2204)
21 août 2018, par cleitonmendoncaAdditional : Add Brazillian PIS/NIS number validation method (#2204)