
Recherche avancée
Autres articles (94)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Les sons
15 mai 2013, par -
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation"
Sur d’autres sites (5986)
-
Error (ERR_STREAM_DESTROYED) : Cannot call write after a stream was destroyed
3 avril 2021, par TTT Tobi Triple TalkI'm getting this error when I run my discord bot on my raspberry pi. It worked everytime when I run it on my windows machine. I installed FFmpeg with sudo apt-get install ffmpeg. I don't know if I need to install something else for ffmpeg on my raspberry pi
This is the error I'm getting


events.js:291
 throw er; // Unhandled 'error' event
 ^

Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
 at doWrite (_stream_writable.js:399:19)
 at writeOrBuffer (_stream_writable.js:387:5)
 at Socket.Writable.write (_stream_writable.js:318:11)
 at PassThrough.ondata (_stream_readable.js:718:22)
 at PassThrough.emit (events.js:314:20)
 at addChunk (_stream_readable.js:297:12)
 at readableAddChunk (_stream_readable.js:272:9)
 at PassThrough.Readable.push (_stream_readable.js:213:10)
 at PassThrough.Transform.push (_stream_transform.js:152:32)
 at PassThrough.afterTransform (_stream_transform.js:96:10)
Emitted 'error' event on FFmpeg instance at:
 at errorOrDestroy (internal/streams/destroy.js:108:12)
 at FFmpeg.onerror (_stream_readable.js:754:7)
 at FFmpeg.emit (events.js:314:20)
 at Socket.processError (node_modules/prism-media/src/core/FFmpeg.js:64:40)
 at Socket.emit (events.js:314:20)
 at errorOrDestroy (internal/streams/destroy.js:108:12)
 at onwriteError (_stream_writable.js:418:5)
 at onwrite (_stream_writable.js:445:5)
 at doWrite (_stream_writable.js:399:11)
 at writeOrBuffer (_stream_writable.js:387:5) {
 code: 'ERR_STREAM_DESTROYED'
}



Normally it should play an audio stream to a discord channel.
I don't think my code is wrong, because it's working on my other computer.
My code :


let stream;
//Meme.url is just a youtube link, like https://www.youtube.com/watch?v=dQw4w9WgXcQ
stream = ytdl(meme.url, {
 filter: "audioonly",
 opusEncoded: true,
 encoderArgs: ['-af', "dynaudnorm=f=150"]
}).on("error", (err) => {
 console.log(err);
});
 try {
 song_queue.connection.play(stream, { type: "opus" })
 .on('finish', () => {
 
 });
 } catch (err) {
 console.log(err);
 message.channel.send("Error while the meme song");
 }



-
Catching ffmpeg errors in Tensorflow
12 avril 2018, par lollercoasterCurrently I make extensive use of tensorflow’s ffmpeg interface :
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
from tensorflow.python.ops import io_ops
from tensorflow.contrib import ffmpeg
def load(mp3_path):
with tf.name_scope("loading") as scope:
audio_binary = tf.read_file(mp3_path)
waveform = tf.reshape(ffmpeg.decode_audio(
audio_binary, file_format='mp3',
samples_per_second=44100, channel_count=1), [-1])
return waveformThis is wonderful, but sometimes (well, a lot) I get errors like this when looping through a bunch of files to create TFRecord files :
[mp3 @ 0xdd4400] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3 @ 0xf2e440] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3 @ 0x202bf40] invalid new backstep -1
[mp3 @ 0x15c5440] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3 @ 0x1752460] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3 @ 0x1f10160] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3 @ 0x1a16dc0] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3 @ 0x9f2c80] Header missing
Error while decoding stream #0:0: Invalid data found when processing inputwhich shows up in stdout while running this Python script.
I’d like to catch these somehow ! And prevent the rest of my loop from continuing if the data I’m reading is invalid.
Currently, these errors just happen and the script happily keeps running, which is probably not the way it should work.
I’m not making use of the Dataset API for this, so these direct
session.run(waveform_op)
calls should throw and Exception or something when parsing fails !Anyone know how I can do this ?
-
ffmpeg unbale to initialize threading in some cases
16 octobre 2020, par Sudipta RoyI am posting this again since the earlier question I posted has been closed


I have a JAVA service running in wildfly which is calling an external ffmpeg binary to convert .au files to .wav files. The actual command that is being executed is as follows :


ffmpeg -y -i INPUT.au OUTPUT.wav



It is running smoothly, except every once in a while it is creating an empty .wav file becasue of the following error :


Error: ffmpeg version c6710aa Copyright (c) 2000-2017 the FFmpeg 
developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/tmp/ffmpeg-static/target --pkg-config-flags=- 
-static --extra-cflags=-I/tmp/ffmpeg-static/target/include --extra- 
ldflags=-L/tmp/ffmpeg-static/target/lib --extra-ldexeflags=-static -- 
bindir=/tmp/ffmpeg-static/bin --enable-pic --enable-ffplay --enable- 
ffserver --enable-fontconfig --enable-frei0r --enable-gpl --enable- 
version3 --enable-libass --enable-libfribidi --enable-libfdk-aac -- 
enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb -- 
enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus -- 
enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora - 
-enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis -- 
enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 -- 
enable-libxvid --enable-libzimg --enable-nonfree --enable-openssl
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100

Input #0, ogg, from 'INPUT.au'
Duration: 00:00:34.08, start: 0.01500, bitrate: 15kb/s
Stream: #0.0: Audio: speex, 8000Hz, mono, s16, 15kb/s

[AVFilterGraph @ 0x43ec6e0] Error initializing threading.
[AVFilterGraph @ 0x43ec6e0] Error creating filter 'anull'



If I try to manually convert the file from command line, it works. A brief internet search (this) shows that it might be due to the fact that
ffmpeg
is unable to create threads for internal use. Can anyone please elaborate ?

The server where I am facing the problem have relatively high load. I have seen that wildfly is creating close to 1800 threads.


Thanks


P.s. I have managed to recreate the problem. Below is the code :


SystemCommandExecutor.java


import java.io.*;
 import java.util.List;
 public class SystemCommandExecutor {
 private List<string> commandInformation;
 private String adminPassword;
 private ThreadedStreamHandler inputStreamHandler;
 private ThreadedStreamHandler errorStreamHandler;

 public SystemCommandExecutor(final List<string> commandInformation)
 {
 if (commandInformation==null) throw new NullPointerException("The commandInformation is required.");
 this.commandInformation = commandInformation;
 this.adminPassword = null;
 }

 public int executeCommand()
 throws IOException, InterruptedException
 {
 int exitValue = -99;

 try
 {
 ProcessBuilder pb = new ProcessBuilder(commandInformation);
 Process process = pb.start();
 OutputStream stdOutput = process.getOutputStream();
 InputStream inputStream = process.getInputStream();
 InputStream errorStream = process.getErrorStream();
 inputStreamHandler = new ThreadedStreamHandler(inputStream, stdOutput, adminPassword);
 errorStreamHandler = new ThreadedStreamHandler(errorStream);
 inputStreamHandler.start();
 errorStreamHandler.start();
 exitValue = process.waitFor();
 inputStreamHandler.interrupt();
 errorStreamHandler.interrupt();
 inputStreamHandler.join();
 errorStreamHandler.join();
 }
 catch (IOException e)
 {
 throw e;
 }
 catch (InterruptedException e)
 {
 throw e;
 }
 finally
 {
 return exitValue;
 }
 }

 public StringBuilder getStandardOutputFromCommand()
 {
 return inputStreamHandler.getOutputBuffer();
 }

 public StringBuilder getStandardErrorFromCommand()
 {
 return errorStreamHandler.getOutputBuffer();
 }
}
</string></string>


ThreadedStreamHandler.java


import java.io.*;

class ThreadedStreamHandler extends Thread
{
 InputStream inputStream;
 String adminPassword;
 OutputStream outputStream;
 PrintWriter printWriter;
 StringBuilder outputBuffer = new StringBuilder();
 private boolean sudoIsRequested = false;

 
 ThreadedStreamHandler(InputStream inputStream)
 {
 this.inputStream = inputStream;
 }

 
 ThreadedStreamHandler(InputStream inputStream, OutputStream outputStream, String adminPassword)
 {
 this.inputStream = inputStream;
 this.outputStream = outputStream;
 this.printWriter = new PrintWriter(outputStream);
 this.adminPassword = adminPassword;
 this.sudoIsRequested = true;
 }

 public void run()
 {
 
 if (sudoIsRequested)
 {
 printWriter.println(adminPassword);
 printWriter.flush();
 }

 BufferedReader bufferedReader = null;
 try
 {
 bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
 String line = null;
 while ((line = bufferedReader.readLine()) != null)
 {
 outputBuffer.append(line + "\n");
 }
 }
 catch (IOException ioe)
 {
 ioe.printStackTrace();
 }
 catch (Throwable t)
 {
 t.printStackTrace();
 }
 finally
 {
 try
 {
 bufferedReader.close();
 }
 catch (IOException e)
 {
 // ignore this one
 }
 }
 }

 private void doSleep(long millis)
 {
 try
 {
 Thread.sleep(millis);
 }
 catch (InterruptedException e)
 {
 // ignore
 }
 }

 public StringBuilder getOutputBuffer()
 {
 return outputBuffer;
 }

}



FfmpegRunnable.java


import java.io.IOException;
import java.util.List;

public class FfmpegRunnable implements Runnable {
 private List<string> command;
 SystemCommandExecutor executor;

 public FfmpegRunnable(List<string> command) {
 this.command = command;
 this.executor = new SystemCommandExecutor(command);
 }

 @Override
 public void run() {
 try {
 int id = (int) Thread.currentThread().getId();
 int result = executor.executeCommand();
 if(result != 0) {
 StringBuilder err = executor.getStandardErrorFromCommand();
 System.out.println("[" + id + "]" + "[ERROR] " + err);
 } else {
 System.out.println("[" + id + "]" + "[SUCCESS]");
 }
 } catch (IOException e) {
 e.printStackTrace();
 } catch (InterruptedException e) {
 e.printStackTrace();
 }
 }
}
</string></string>


FfmpegMain.java


import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
public class FfmpegMain {
 public static void main(String[] args) {
 //boolean threading = false;
 System.out.println(args[0]);
 int nrThread = Integer.parseInt(args[0]);
 boolean threading = Boolean.parseBoolean(args[1]);
 System.out.println("nrThread : " + nrThread + ", threading : " + threading);
 if(threading) {
 System.out.println("ffmpeg threading enabled");
 } else {
 System.out.println("ffmpeg threading not enabled");
 }
 ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(nrThread);
 for(int i=0; i cmd = new ArrayList<string>();
 String dest = "/tmp/OUTPUT/output_" + (Math.random()*1000) + ".wav";
 String cmdStr = "/tmp/FFMPEG/ffmpeg" + (threading ? " -threads 1 " : " ")
 + "-y -i /tmp/input.au " + dest;
 cmd.add("/bin/sh");
 cmd.add("-c");
 cmd.add(cmdStr);

 executor.submit(new FfmpegRunnable(cmd));
 }
 executor.shutdown();
 }
}
</string>


I have created a jar with the class files and run the jar from two seperate terminal with the following command


java -jar JAR.jar 40 true



Here 40 is the number of threads, simulating varous users accessing the system. Every once in a while I get above mentioned error.