
Recherche avancée
Autres articles (20)
-
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...) -
Creating farms of unique websites
13 avril 2011, parMediaSPIP 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" (...) -
Contribute to documentation
13 avril 2011Documentation is vital to the development of improved technical capabilities.
MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
To contribute, register to the project users’ mailing (...)
Sur d’autres sites (6434)
-
C# FFMPEG Process and Multiple files
3 novembre 2016, par wesmanI am working on a C# Form tool that will help me convert all of my phone and DSLR video to HEVC, currently, i have a program that uploads the photos and videos to different directories in my home server each time i connect to the WiFi. Once a month or so, i manually convert all the videos, but thought I would automate the process.. I have the Form working perfectly for processing 1 file. but get into trouble when processing a Directory (with possible sub-directories) all at once..
Sorry, this is long, just want to be thorough. here is the button calls
private void processFile_Click(object sender, EventArgs e)
{
OpenFileDialog file = new OpenFileDialog();
file.InitialDirectory = baseMediaDirectory;
if (file.ShowDialog() == DialogResult.OK)
{
ProcessSinlgeFile(file.FileName);
}
}(above)for one file and (below) for a directory
private void processDirectory_Click(object sender, EventArgs e)
{
FolderBrowserDialog file = new FolderBrowserDialog();
file.SelectedPath = baseMediaDirectory;
if(file.ShowDialog() == DialogResult.OK)
{
ProcessDirectoryOfFiles(file.SelectedPath);
}
}
private void ProcessDirectoryOfFiles(string selectedPath)
{
List<string> listOfFiles = GetAllFiles(selectedPath);
foreach (string s in listOfFiles)
{
ProcessSinlgeFile(s);
}
}
</string>both ultimately call this method, to do some checks and setup
private void ProcessSinlgeFile(string fileName)
{
if (IsAcceptableMediaFile(fileName))
{
outputWindow.AppendText("File to Process: " + fileName);
processMediaFile =
new MediaFileWrapper(this.outputWindow, new MediaFile(fileName), new NReco.VideoInfo.FFProbe());
if (processMediaFile.OkToProcess)
{
int initialCRFValue = 15;
//ultrafast superfast veryfast faster fast medium slow slower veryslow placebo
string intialSpeed = "veryfast";
try {
ConvertToMPEG(processMediaFile.getFFMPEGCommand(initialCRFValue, intialSpeed), processMediaFile);
}
catch
{
// at somepoint, we'll catch a bad file size (or compression)
// then change the CRF value and/or compression speed
}
}
}
}ultimately I get to this Method and run into trouble.
private async void ConvertToMPEG(string arguments, MediaFileWrapper processMediaFile)
{
startTime = DateTime.Now;
watch = new Stopwatch();
watch.Start();
progressBar1.Minimum = 0;
progressBar1.Maximum = processMediaFile.GetTotalMilliseconds();
// Start the child process.
p = new Process();
//Setup filename and arguments
outputWindow.AppendText("ffmpeg " + arguments);
p.StartInfo.Arguments = arguments;
p.StartInfo.FileName = "ffmpeg.exe";
p.StartInfo.UseShellExecute = false;
// Redirect the output stream of the child process.
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
// capture the date for stdout and std error
// note FFMPEG uses Stderr exclusively
p.ErrorDataReceived += new DataReceivedEventHandler(ErrorDataReceived);
p.OutputDataReceived += new DataReceivedEventHandler(OutputDataReceived);
// Hide Console Window
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.Start();
p.BeginErrorReadLine();
p.BeginOutputReadLine();
await p.WaitForExitAsync();
}and WaitForExitAsync is in another class because in can not be in here with a Form
public static Task WaitForExitAsync(this Process process,
CancellationToken cancellationToken = default(CancellationToken))
{
var tcs = new TaskCompletionSource();
process.EnableRaisingEvents = true;
process.Exited += (sender, args) => tcs.TrySetResult(null);
if (cancellationToken != default(CancellationToken))
cancellationToken.Register(tcs.SetCanceled);
return tcs.Task;
}however, single files work fine, when I call a directory through, it continuously starts processes for each file, trying to run them all at the same time. You can see I tried implementing this
process.WaitForExit() asynchronously
with no luck. -
C# FFMPEG Process and Multiple files
23 novembre 2023, par wesmanI am working on a C# Form tool that will help me convert all of my phone and DSLR video to HEVC, currently, i have a program that uploads the photos and videos to different directories in my home server each time i connect to the WiFi. Once a month or so, i manually convert all the videos, but thought I would automate the process.. I have the Form working perfectly for processing 1 file. but get into trouble when processing a Directory (with possible sub-directories) all at once..



Sorry, this is long, just want to be thorough. here is the button calls



private void processFile_Click(object sender, EventArgs e)
 {
 OpenFileDialog file = new OpenFileDialog();
 file.InitialDirectory = baseMediaDirectory;
 if (file.ShowDialog() == DialogResult.OK)
 {
 ProcessSinlgeFile(file.FileName);
 }
 }




(above)for one file and (below) for a directory



private void processDirectory_Click(object sender, EventArgs e)
{
 FolderBrowserDialog file = new FolderBrowserDialog();
 file.SelectedPath = baseMediaDirectory;
 if(file.ShowDialog() == DialogResult.OK)
 {
 ProcessDirectoryOfFiles(file.SelectedPath);
 }
}

private void ProcessDirectoryOfFiles(string selectedPath)
 {
 List<string> listOfFiles = GetAllFiles(selectedPath);
 foreach (string s in listOfFiles)
 {
 ProcessSinlgeFile(s);
 }
 }
</string>



both ultimately call this method, to do some checks and setup



private void ProcessSinlgeFile(string fileName)
 {

 if (IsAcceptableMediaFile(fileName))
 {
 outputWindow.AppendText("File to Process: " + fileName);
 processMediaFile = 
 new MediaFileWrapper(this.outputWindow, new MediaFile(fileName), new NReco.VideoInfo.FFProbe());
 if (processMediaFile.OkToProcess)
 {
 int initialCRFValue = 15;
 //ultrafast superfast veryfast faster fast medium slow slower veryslow placebo
 string intialSpeed = "veryfast";
 try {

 ConvertToMPEG(processMediaFile.getFFMPEGCommand(initialCRFValue, intialSpeed), processMediaFile);
 }
 catch
 {
 // at somepoint, we'll catch a bad file size (or compression)
 // then change the CRF value and/or compression speed
 }
 }
 }
 }




ultimately I get to this Method and run into trouble.



private async void ConvertToMPEG(string arguments, MediaFileWrapper processMediaFile)
 {
 startTime = DateTime.Now;
 watch = new Stopwatch();
 watch.Start();
 progressBar1.Minimum = 0;
 progressBar1.Maximum = processMediaFile.GetTotalMilliseconds();

 // Start the child process.
 p = new Process();

 //Setup filename and arguments
 outputWindow.AppendText("ffmpeg " + arguments);
 p.StartInfo.Arguments = arguments;
 p.StartInfo.FileName = "ffmpeg.exe";
 p.StartInfo.UseShellExecute = false;

 // Redirect the output stream of the child process.
 p.StartInfo.RedirectStandardOutput = true;
 p.StartInfo.RedirectStandardError = true;
 p.StartInfo.RedirectStandardInput = true;

 // capture the date for stdout and std error
 // note FFMPEG uses Stderr exclusively
 p.ErrorDataReceived += new DataReceivedEventHandler(ErrorDataReceived);
 p.OutputDataReceived += new DataReceivedEventHandler(OutputDataReceived);

 // Hide Console Window
 p.StartInfo.CreateNoWindow = true;
 p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

 p.Start();
 p.BeginErrorReadLine();
 p.BeginOutputReadLine();
 await p.WaitForExitAsync();
 }




and WaitForExitAsync is in another class because in can not be in here with a Form



public static Task WaitForExitAsync(this Process process,
 CancellationToken cancellationToken = default(CancellationToken))
 {
 var tcs = new TaskCompletionSource();
 process.EnableRaisingEvents = true;
 process.Exited += (sender, args) => tcs.TrySetResult(null);
 if (cancellationToken != default(CancellationToken))
 cancellationToken.Register(tcs.SetCanceled);

 return tcs.Task;
 }




however, single files work fine, when I call a directory through, it continuously starts processes for each file, trying to run them all at the same time. You can see I tried implementing this 
process.WaitForExit() asynchronously
with no luck.


-
Python animation ffmpeg error - ValueError : I/O operation on closed file
27 février 2018, par RobI’m trying to follow this example here to do a simple animation : https://matplotlib.org/examples/animation/basic_example_writer.html
I get this error :
ValueError Traceback (most recent call last)
/fsr/rfs07/ELEGANCE/work/code/python/s5p/animation_test.py in <module>()
25 line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l),
26 interval=50, blit=True)
---> 27 line_ani.save('lines.mp4', writer=writer)
28
29 fig2 = plt.figure()
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/matplotlib/animation.pyc in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs)
1061 # TODO: See if turning off blit is really necessary
1062 anim._draw_next_frame(d, blit=False)
-> 1063 writer.grab_frame(**savefig_kwargs)
1064
1065 # Reconnect signal for first draw if necessary
/software/local/apps/python/2.7.9/lib/python2.7/contextlib.pyc in __exit__(self, type, value, traceback)
33 value = type()
34 try:
---> 35 self.gen.throw(type, value, traceback)
36 raise RuntimeError("generator didn't stop after throw()")
37 except StopIteration, exc:
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/matplotlib/animation.pyc in saving(self, *args, **kw)
287 yield self
288 finally:
--> 289 self.finish()
290
291 def _run(self):
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/matplotlib/animation.pyc in finish(self)
307 def finish(self):
308 'Finish any processing for writing the movie.'
--> 309 self.cleanup()
310
311 def grab_frame(self, **savefig_kwargs):
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/matplotlib/animation.pyc in cleanup(self)
346 def cleanup(self):
347 'Clean-up and collect the process used to write the movie file.'
--> 348 out, err = self._proc.communicate()
349 self._frame_sink().close()
350 verbose.report('MovieWriter -- '
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/subprocess32.pyc in communicate(self, input, timeout)
925
926 try:
--> 927 stdout, stderr = self._communicate(input, endtime, timeout)
928 finally:
929 self._communication_started = True
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/subprocess32.pyc in _communicate(self, input, endtime, orig_timeout)
1711 if _has_poll:
1712 stdout, stderr = self._communicate_with_poll(input, endtime,
-> 1713 orig_timeout)
1714 else:
1715 stdout, stderr = self._communicate_with_select(input, endtime,
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/subprocess32.pyc in _communicate_with_poll(self, input, endtime, orig_timeout)
1767 select_POLLIN_POLLPRI = select.POLLIN | select.POLLPRI
1768 if self.stdout:
-> 1769 register_and_append(self.stdout, select_POLLIN_POLLPRI)
1770 stdout = self._fd2output[self.stdout.fileno()]
1771 if self.stderr:
/software/local/apps/python/2.7.9/lib/python2.7/site-packages/subprocess32.pyc in register_and_append(file_obj, eventmask)
1746 poller = select.poll()
1747 def register_and_append(file_obj, eventmask):
-> 1748 poller.register(file_obj.fileno(), eventmask)
1749 self._fd2file[file_obj.fileno()] = file_obj
1750
ValueError: I/O operation on closed file
</module>ffmpeg on it’s own outside of python seems to work ok so I’m not really sure how to get this working ?
I’ve tried using imagemagick as an alternative
e.g.
line_ani.save(’lines.gif’, writer=’imagemagick’)but this results in the gif jumping around between frames