
Recherche avancée
Autres articles (45)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
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 (...) -
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 (...)
Sur d’autres sites (10308)
-
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();
} -
C# How do I set the volume of sound bytes[]
23 juillet 2016, par McLucarioIm trying to change the volume of sound bytes[] in C#. Im reading a sound file with FFMPEG and and wanna change the volume on the fly. I found some examples and but I didnt understand them.
public void SendAudio(string pathOrUrl)
{
cancelVid = false;
isPlaying = true;
mProcess = Process.Start(new ProcessStartInfo
{ // FFmpeg requireqs us to spawn a process and hook into its stdout, so we will create a Process
FileName = "ffmpeg",
Arguments = "-i " + (char)34 + pathOrUrl + (char)34 + // Here we provide a list of arguments to feed into FFmpeg. -i means the location of the file/URL it will read from
" -f s16le -ar 48000 -ac 2 pipe:1", // Next, we tell it to output 16-bit 48000Hz PCM, over 2 channels, to stdout.
UseShellExecute = false,
RedirectStandardOutput = true, // Capture the stdout of the process
Verb = "runas"
});
while (!isRunning(mProcess)) { Task.Delay(1000); }
int blockSize = 3840; // The size of bytes to read per frame; 1920 for mono
byte[] buffer = new byte[blockSize];
byte[] gainBuffer = new byte[blockSize];
int byteCount;
while (true && !cancelVid) // Loop forever, so data will always be read
{
byteCount = mProcess.StandardOutput.BaseStream // Access the underlying MemoryStream from the stdout of FFmpeg
.Read(buffer, 0, blockSize); // Read stdout into the buffer
if (byteCount == 0) // FFmpeg did not output anything
break; // Break out of the while(true) loop, since there was nothing to read.
if (cancelVid)
break;
disAudioClient.Send(buffer, 0, byteCount); // Send our data to Discord
}
disAudioClient.Wait(); // Wait for the Voice Client to finish sending data, as ffMPEG may have already finished buffering out a song, and it is unsafe to return now.
isPlaying = false;
Console.Clear();
Console.WriteLine("Done Playing!"); -
Jupyter Notebook JSONDecodeError to open file
25 février 2021, par potterykidExpected behavior :
open a mp3 with no error


Actual behavior :
I used the script below,


from pydub
import AudioSegment


song = AudioSegment.from_mp3("audio.mp3")


and there is a JSONDecodeError


JSONDecodeError : Expecting value : line 1 column 1 (char 0)


JSONDecodeError Traceback (most recent call last)
 in <module>
 6 dst = "research.wav"
 7 
----> 8 sound = AudioSegment.from_mp3(src)
 9 sound.export(dst, format = "wav")

~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_mp3(cls, file, parameters)
 736 @classmethod
 737 def from_mp3(cls, file, parameters=None):
--> 738 return cls.from_file(file, 'mp3', parameters=parameters)
 739 
 740 @classmethod

~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)
 683 info = None
 684 else:
--> 685 info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
 686 if info:
 687 audio_streams = [x for x in info['streams']

~/opt/anaconda3/lib/python3.8/site-packages/pydub/utils.py in mediainfo_json(filepath, read_ahead_limit)
 277 stderr = stderr.decode("utf-8", 'ignore')
 278 
--> 279 info = json.loads(output)
 280 
 281 if not info:

~/opt/anaconda3/lib/python3.8/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
 355 parse_int is None and parse_float is None and
 356 parse_constant is None and object_pairs_hook is None and not kw):
--> 357 return _default_decoder.decode(s)
 358 if cls is None:
 359 cls = JSONDecoder

~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w)
 335 
 336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
 338 end = _w(s, end).end()
 339 if end != len(s):

~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)
 353 obj, end = self.scan_once(s, idx)
 354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
 356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
</module>