
Recherche avancée
Médias (1)
-
DJ Dolores - Oslodum 2004 (includes (cc) sample of “Oslodum” by Gilberto Gil)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (85)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (12261)
-
Revision 3538 : gestion de la balise audio
7 juin 2010, par kent1 — Loggestion de la balise audio
-
Revision 3508 : un début de gestion des notifications
1er juin 2010, par kent1 — Logun début de gestion des notifications
-
Calling ffmpeg from command line does not wait until file was fully written do hard drive
10 octobre 2020, par Stefan FalkI am currently working on a service to allower conversion of audio files. I am using
ffmpeg
under the hood and use theRuntime
in order to make the call.

After the call I read the converted file and upload it to a cloud storage.


The problem :


The problem is, that reading the file back from the drive gives me only a few bytes. After investigating, it actually has like 5 MB on the drive but
readFileToByArray()
reads only a few kb. I assume this is because the file was not completely persisted at the point where I want to read it back.

Is there any way I can make sure that
ffmpeg
is done writing to the hard drive ? It seems that the main process thatffmpeg
was running in finishes before a parallel process that is responsible for writing. Maybe ?

Below is the relevant code that converts an arbitrary file to AAC-format :


File tempFile = File.createTempFile("input-", ".tmp", new File("/tmp"));
OutputStream outStream = new FileOutputStream(tempFile);
outStream.write(bytes);

String convertedFilePath = String.format("/tmp/output-%s.aac", UUID.randomUUID().toString());

String command = String.format(
 "ffmpeg -i %s -c:a aac -b:a 256k %s",
 tempFile.getAbsolutePath(),
 convertedFilePath
);

LOGGER.debug(String.format("Converting file to AAC; Running %s", command));

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(command);
try {
 process.waitFor(200, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
 throw new RuntimeException("Time out");
}

File convertedFile = new File(convertedFilePath);
byte[] result = FileUtils.readFileToByteArray(convertedFile);

// Upload "result" to cloud storage ..