
Recherche avancée
Médias (1)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (77)
-
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (6621)
-
How to send written frames in real time/synchronized with FFmpeg and UDP ?
20 juin 2018, par potu1304I wanted to nearly live stream my Unit game with FFmpeg to a simple client. I have one Unity game in which each frame is saved as an jpg image. These images are wrapped in ffmpeg and send over udp to a simple c# client where I use ffplay to play the stream. The problem is, that FFmpeg is wrapping the images way faster than the unity app can write them. So ffmpeg quits but Unity is still writing frames. Is there a way to set ffmpeg in a loop to wait for the next image or can I somehow make a for loop without call every time ffmpeg ?
Here is my function from my capturing script in Unity :
Process process;
//BinaryWriter _stdin;
public void encodeFrame()
{
ProcessStartInfo startInfo = new ProcessStartInfo();
var basePath = Application.streamingAssetsPath + "/FFmpegOut/Windows/ffmpeg.exe";
info.Arguments = "-re -i screen_%d.jpg -vcodec libx264 -r 24 -f mpegts udp://127.0.0.1:1100";
info.RedirectStandardOutput = true;
info.RedirectStandardInput = true;
info.RedirectStandardError = true;
info.CreateNoWindow = true;
info.UseShellExecute = false;
info.RedirectStandardError = true;
UnityEngine.Debug.Log(string.Format(
"Executing \"{0}\" with arguments \"{1}\".\r\n",
info.FileName,
info.Arguments));
process = Process.Start(info);
//_stdin = new BinaryWriter(process.StandardInput.BaseStream);
process.WaitForExit();
var outputReader = process.StandardError;
string Error = outputReader.ReadToEnd();
UnityEngine.Debug.Log(Error);
}And here the function from my cs file from my simple windowsform application :
private void xxxFFplay()
{
text = "start";
byte[] send_buffer = Encoding.ASCII.GetBytes(text);
sock.SendTo(send_buffer, endPoint);
ffplay.StartInfo.FileName = "ffplay.exe";
ffplay.StartInfo.Arguments = "udp://127.0.0.1:1100";
ffplay.StartInfo.CreateNoWindow = true;
ffplay.StartInfo.RedirectStandardOutput = true;
ffplay.StartInfo.UseShellExecute = false;
ffplay.EnableRaisingEvents = true;
ffplay.OutputDataReceived += (o, e) => Debug.WriteLine(e.Data ?? "NULL", "ffplay");
ffplay.ErrorDataReceived += (o, e) => Debug.WriteLine(e.Data ?? "NULL", "ffplay");
ffplay.Exited += (o, e) => Debug.WriteLine("Exited", "ffplay");
ffplay.Start();
Thread.Sleep(500); // you need to wait/check the process started, then...
// child, new parent
// make 'this' the parent of ffmpeg (presuming you are in scope of a Form or Control)
//SetParent(ffplay.MainWindowHandle, this.panel1.Handle);
// window, x, y, width, height, repaint
// move the ffplayer window to the top-left corner and set the size to 320x280
//MoveWindow(ffplay.MainWindowHandle, -5, -300, 320, 280, true);
}Does have somebody some ideas ? I am really stuck at this to create a somehow "live" stream.
Best regards
-
How to configure proc_open "pipes" for ffmpeg stdin/stderr on Windows ?
10 septembre 2018, par GDPFirstly, I’ve spent the week googling and trying variations of dozens and dozens of answers for Unix, but it’s been a complete bust, I need an answer for Windows, so this is not a duplicate question of the Unix equivalents.
We’re trying to create a scheduled task that will process a queue of tasks in PHP, and maintain an array of up to 10 ffmpeg instances at a time. I’ve tried
exec
,shell_exec
andproc_open
, coupled with/withoutstart /B
without any "complete" luck.
I’m also quite certain that it has to do with setting up the descriptorspec and pipes (which I’m completely unfamiliar with), and here’s why :Per https://trac.ffmpeg.org/wiki/PHP,
The part that says ">/dev/null" will redirect the standard OUTPUT
(stdout) of the ffmpeg instance to /dev/null (effectively ignoring the
output) and "2>/dev/null" will redirect the standard ERROR (stderr) to
/dev/null (effectively ignoring any error log messages). These two can
be combined into a shorter representation : ">/dev/null 2>&1". If you
like, you can ?read more about I/O Redirection.An important note should be mentioned here. The ffmpeg command-line
tool uses stderr for output of error log messages and stdout is
reserved for possible use of pipes (to redirect the output media
stream generated from ffmpeg to some other command line tool). That
being said, if you run your ffmpeg in the background, you’ll most
probably want to redirect the stderr to a log file, to be able to
check it later.One more thing to take care about is the standard INPUT (stdin).
Command-line ffmpeg tool is designed as an interactive utility that
accepts user’s input (usually from keyboard) and reports the error log
on the user’s current screen/terminal. When we run ffmpeg in the
background, we want to tell ffmpeg that no input should be accepted
(nor waited for) from the stdin. We can tell this to ffmpeg, using I/O
redirection again "echo "Starting ffmpeg...\n\n";
echo shell_exec("ffmpeg -y -i input.avi output.avi null >/dev/null 2>/var/log/ffmpeg.log &");
echo "Done.\n";This example actually uses
shell_exec
, though we want to use proc_open so that we can use a loop to check if the process has completed or not.Here’s a basic sample loop of what I’ve tried. The problem in executing this is that the actual ffmpeg processing completes, but the process is hung "waiting for something". When I use debugging, and step out of the loop and terminate the process after a few minutes, the ffmpeg output is written and the script carries on. (From the command line, ffmpeg takes less than a minute to complete)
$descriptorspec = array(
array('pipe', 'r'),
array('pipe', 'w'),
array('pipe', 'w'),
);
$pipes = null;
$cwd = null;
$env = null;
$process = proc_open('start /B ffmpeg.exe -i input.mov output.mp4 -nostdin', $descriptorspec, $pipes, $cwd, $env);
$status = proc_get_status($process);
while($status['running']) {
sleep (60);
$status = proc_get_status($process);
}
proc_terminate($process);Also, as documented at ffmpeg Main-options :
Enable interaction on standard input. On by default unless standard
input is used as an input. To explicitly disable interaction you need
to specify-nostdin
.The
-nostdin
option seems to indicate that it addresses my problem, but it has no apparent affect. In all solutions for Unix that I’ve found, it appears to still require some form of this this unix added :null
or2>&1
.So, with that somewhat exhaustive prologue, can someone explain how to properly configure the
proc_open
function to satisfy howffmpeg.exe
interacts with I/O ? If there is a better or more appropriate approach, I’m happy to do that, but the important thing is to be able to loop thru an array of processes to check if they’re complete, so that other faster processes can complete in the meantime.UPDATE
After exhaustive R&D, it seems that the I/O is not the issue in making this happen (the -nostdin
option seems to work as advertised). The premise of my design was to useproc_get_status()
to determine whenffmpeg
was finished. The flaw in that approach is that apparently that does NOT return the actual PID of the ffmpeg process...it returns the parent PID. So, whenproc_get_status()
returned that the video conversion was complete, it was in fact still running, not hung. This was further complicated by testing on larger video files. The larger the video, the longer the "residual" time was that it took to actually finish — the I/O wasn’t the issue - watching the Parent PID instead of the child PID was the problem. So, without getting into much lower level system internals with Windows, this doesn’t appear to be possible with PHP directly. I’ve decided to abandon this approach, but hopefully this discovery will save someone else some time and trouble. -
Process not taking arguments
11 septembre 2018, par Wahid MasudI am trying to run ffmpeg.exe as a process and give it some arguments. The process actually runs I can see the ffmpeg window opens but then nothing happens. I also tried using
@ffmpeg
in the args but no luck. So I guess the arguments are not passing to it. I have manually run the ffmpeg.exe from cmd and used those args and it worked perfectly. Here is the code,public void ConvertVideo()
{
var dir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\FFMpeg";
var ffmpeg = dir + "\\ffmpeg.exe";
var args = "ffmpeg -i 20180906194502.mp4 -ar 44100 -ac 2 -c:a aac -strict -2 -b:a 128k -c:v libx264 -preset veryslow -crf 20 output.mp4";
var process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = ffmpeg;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.WorkingDirectory = dir;
process.EnableRaisingEvents = true;
process.StartInfo.RedirectStandardInput = true;
process.Start();
process.StandardInput.WriteLine(args);
process.StandardInput.Flush();
process.StandardInput.Close();
process.WaitForExit();
}So bottom line is, if I run this code I just see this window and then nothing happens.