
Recherche avancée
Autres articles (52)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
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 (...)
Sur d’autres sites (11350)
-
Unrecognized option from ffmpeg converting to html 5 video on upload
19 avril 2015, par peterbw321I am gradually getting the hang of video conversion with ffmpeg but am stuck. I am on shared hosting. I can convert with simple code like -
ffmpeg -i out.avi -acodec copy -vcodec copy output.mp4
I need to convert to html5 video formats but whenever i use code like this, I always get the same type of error ’Unrecognized option c:v’ or ’Unrecognized option b’. Is my version of ffmpeg too old ? Please help.
exec("/usr/bin/ffmpeg -i input -c:v libx264 -preset slow -crf 18 -vf yadif -strict -2 output.mp4");
array(31) { [0]=> string(67) "FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers"
[1]=> string(74) " built on Jan 29 2012 23:55:02 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)"
[2]=> string(649) " configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
--mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
-mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdirac --enable-libfaac
--enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc
--enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab"
[3]=> string(35) " libavutil 50.15. 1 / 50.15. 1" [4]=> string(35) " libavcodec 52.72. 2 / 52.72. 2"
[5]=> string(35) " libavformat 52.64. 2 / 52.64. 2" [6]=> string(35) " libavdevice 52. 2. 0 / 52. 2. 0"
[7]=> string(35) " libavfilter 1.19. 0 / 1.19. 0" [8]=> string(35) " libswscale 0.11. 0 / 0.11. 0"
[9]=> string(35) " libpostproc 51. 2. 0 / 51. 2. 0" [10]=> string(72) "[flv @ 0xb278b0]Estimating
duration from bitrate, this may be inaccurate" [11]=> string(0) "" [12]=> string(99) "Seems stream 0
codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)" [13]=> string(42)
"Input #0, flv, from 'destinationfile.flv':" [14]=> string(11) " Metadata:" [15]=> string(23) " duration :
6" [16]=> string(25) " width : 320" [17]=> string(25) " height : 240" [18]=> string(25) " videodatarate :
195" [19]=> string(24) " framerate : 25" [20]=> string(23) " videocodecid : 2" [21]=> string(24) "
audiodatarate : 31" [22]=> string(27) " audiosamplerate : 22050" [23]=> string(24) " audiosamplesize :
16" [24]=> string(27) " stereo : false" [25]=> string(23) " audiocodecid : 2" [26]=> string(28) "
filesize : 352720" [27]=> string(59) " Duration: 00:00:05.64, start: 0.000000, bitrate: 232 kb/s"
[28]=> string(79) " Stream #0.0: Video: flv, yuv420p, 320x240, 200 kb/s, 25 tbr, 1k tbn, 1k tbc"
[29]=> string(63) " Stream #0.1: Audio: mp3, 22050 Hz, 1 channels, s16, 32 kb/s" [30]=> string(25)
"Unrecognized option 'c:v'" } -
Ffmpeg hangs when -vcodec copy specified (called from Java via ProcessBuilder)
24 juin 2015, par IngloniasI’m trying to use ffmpeg to export an array of bytes to a video file, but the people I work with insist that I use
-vcodec copy
in the arguments for it. This, however, causes the code to hang, whereas if I don’t use -vcodec copy, the code will not hang. I don’t know what the problem is, and I’ve been trying to debug this code for the past two hours.Here is the relevant section of code. I’ve added comments above and below the line where the code hangs. Can anybody help me ?
// This is the tricky part. We need to build an ffmpeg process that
// takes input from stdin, and then plug Java into that.
ProcessBuilder ffmpegBuilder = new ProcessBuilder();
String[] cmd = {"ffmpeg", "-i", "-","-vcodec", "copy", directory
+ "/" + fileName};
StringBuilder combinedCmd = new StringBuilder();
for (String s : cmd) {
combinedCmd.append(s);
combinedCmd.append(" ");
}
mLogger.log(Level.INFO,"Final command is " + combinedCmd.toString());
ffmpegBuilder.command(cmd);
ffmpegBuilder.redirectErrorStream(true); // So that stdout and stderr go
// to the same stream.
byte[] dataToWrite = new byte[data.size()];
for (int i = 0; i < dataToWrite.length; i++) {
dataToWrite[i] = data.get(i); // Is there really STILL no better way
// to convert an ArrayList to an
// array?!
}
try {
Process ffmpeg = ffmpegBuilder.start();
OutputStream stdin = ffmpeg.getOutputStream();
BufferedReader stdout = new BufferedReader(new InputStreamReader(
ffmpeg.getInputStream()));
//HANGS AT THIS LINE vvvvvvvvvvvvvvvv
stdin.write(dataToWrite);
//HANGS AT THIS LINE ^^^^^^^^^^^^^^^^
String line = "I know a song that gets on everybody's nerves...";
while ((line != null) && stdout.ready()) {
line = stdout.readLine();
mLogger.log(Level.INFO, line);
}
try {
ffmpeg.waitFor(2, TimeUnit.SECONDS);
ffmpeg.destroyForcibly();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} -
proc_open hangs when trying to read from a stream
7 juillet 2015, par eithedogI’ve encountered the issue with
proc_open
on Windows, when trying to convert a wmv file (to flv), usingffmpeg
, however I suspect I’ll encounter the same scenario whenever certain conditions occur.
Basically my code is as follows :$descriptorspec = array
(
array("pipe", "r"),
array("pipe", "w"),
array("pipe", "w")
);
$pipes = array();
$procedure = proc_open('cd "C:/Program Files/ffmpeg/bin" && "ffmpeg.exe" -i "C:/wamp/www/project/Wildlife.wmv" -deinterlace -qdiff 2 -ar 22050 "C:/wamp/www/project/Wildlife.flv"', $descriptorspec, $pipes);
var_dump(stream_get_contents($pipes[1]));Now, this code will cause PHP to hang indefinitely (it doesn’t matter if instead of
stream_get_contents
I’ll usefgets
orstream_select
, the behavior is consistent).The reason for it (I suspect) is that, while STDOUT stream is open succesfully, the process doesn’t write anything to it (even though running the same command in cmd displays output) and as such, trying to read from such stream, would cause the same issue as described here, so - PHP waits for the stream to have anything in it, process doesn’t write anything to it.
However (additional fun), setting
stream_set_timeout
orstream_set_blocking
doesn’t have any effect.As such - can somebody confirm/deny on what is going on, and, if possible, show how can I cater for such situation ? I’ve looked at PHP bugs, and all
proc_open hangs
ones seem to be fixed.For time being I’ve implemented such solution :
$timeout = 60;
while (true) {
sleep(1);
$status = proc_get_status($procedure);
if (!$status['running'] || $timeout == 0) break;
$timeout--;
}However, I’d really not like to rely on something like this as :
- I will have processes that run for longer than a minute - such processes will be falsely reported to be of the above mentioned type
- I want to know when the ffmpeg has finished converting the video - currently I’ll only know that process is still running after a minute, and I can’t really do anything to check if there’s any output (as it will hang PHP).
Also, I don’t really want to wait a full minute for the process to be checked (for example - converting the given video from command line takes <10s), and I’ll have videos that take more time to be converted.
Per comment from @Sjon, here’s
stream_select
I was using, which blocks due to same issue - STDOUT not being written to :$descriptorspec = array
(
array("pipe", "r"),
array("pipe", "w"),
array("pipe", "w")
);
$pipes = array();
$procedure = proc_open('cd "C:/Program Files/ffmpeg/bin" && "ffmpeg.exe" -i "C:/wamp/www/sandbox/Wildlife.wmv" -deinterlace -qdiff 2 -ar 22050 "C:/wamp/www/sandbox/Wildlife.flv"', $descriptorspec, $pipes);
$read = array($pipes[0]);
$write = array($pipes[1], $pipes[2]);
$except = array();
while(true)
if(($num_changed_streams = stream_select($read, $write, $except, 10)) !== false)
{
foreach($write as $stream)
var_dump(stream_get_contents($stream));
exit;
}
else
break;
Per conversation with @Sjon - reading from buffered streams on Windows is broken. The solution in the end is to use stream redirection via shell, and then read the created files - as such
$descriptorspec = array
(
array("pipe", "r"),
array("pipe", "w"),
array("pipe", "w")
);
$pipes = array();
$procedure = proc_open('cd "C:/Program Files/ffmpeg/bin" && "ffmpeg.exe" -i "C:/wamp/www/sandbox/Wildlife.mp4" -deinterlace -qdiff 2 -ar 22050 "C:/wamp/www/sandbox/Wildlife.flv" > C:/stdout.log 2> C:/stderr.log', $descriptorspec, $pipes);
proc_close($procedure);
$output = file_get_contents("C:/stdout.log");
$error = file_get_contents("C:/stderr.log");
unlink("C:/stdout.log");
unlink("C:/stderr.log");As the stream is buffered, in the file we will get unbuffered output (something I was after as well). And we don’t need to check if the file changes, because the result from shell is unbuffered and synchronous.