
Recherche avancée
Autres articles (58)
-
MediaSPIP : Modification des droits de création d’objets et de publication définitive
11 novembre 2010, parPar défaut, MediaSPIP permet de créer 5 types d’objets.
Toujours par défaut les droits de création et de publication définitive de ces objets sont réservés aux administrateurs, mais ils sont bien entendu configurables par les webmestres.
Ces droits sont ainsi bloqués pour plusieurs raisons : parce que le fait d’autoriser à publier doit être la volonté du webmestre pas de l’ensemble de la plateforme et donc ne pas être un choix par défaut ; parce qu’avoir un compte peut servir à autre choses également, (...) -
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 -
Déploiements possibles
31 janvier 2010, parDeux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
Version mono serveur
La version mono serveur consiste à n’utiliser qu’une (...)
Sur d’autres sites (6486)
-
Get bitmap / thumbnail from a streaming video with format like .mp4, .3gp in Android ?
12 janvier 2016, par AndrozrI am working on ListView which on item click redirecting to a video link.
I explain my problem :I have three types of videos :
- Youtube
- Dailymotion
- Other formats from streaming video like this one : Video Link
I am trying to get thumbnail to get it in my ImageView from my item of my ListView. I encoutered a problem, I get Youtube thumbnail, Dailymotion thumbnail but I couldn’t get thumbnail for other formats.
I tried to use MediaMetaDataRetriever class but nothing happens.
Here is the line where I tried to get my bitmap :
We are in my VideoAdapter class in the getView method.
holder
is my ViewHolder class andthumbVideo
is my ImageView.Here is differents lines I tried :
holder.thumbVideo.setImageBitmap(createVideoThumbnail(m_Context, Uri.parse(m_Video.getM_Preview())));
m_Video
is my Video class and the methodgetM_Preview()
is getting the link of video thumbnail.Here is my
createVideoThumbnail(Context context, Uri uri)
method :public Bitmap createVideoThumbnail(Context context, Uri uri) {
Bitmap bitmap = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(context, uri);
bitmap = retriever.getFrameAtTime(-1);
} catch (RuntimeException ex) {
} finally {
try {
retriever.release();
} catch (RuntimeException ex) {
}
}
return bitmap;
}I am looking an answer for 4 days. If anybody know how I can do, it’ll be helpful
-
Revision 33048 : Un flv n’a pas forcément de vidéo associée ... on écrit les metadatas ...
18 novembre 2009, par kent1@… — LogUn flv n’a pas forcément de vidéo associée ... on écrit les metadatas avant pour être sûr
-
I want to use FFmpeg in the spring boot
12 novembre 2024, par user25686647While creating the function to concatenate audio files with the Java Sound API, I found FFmpeg, which has already implemented the function beautifully with the library.
I want to make it possible to automatically install ffmpeg if I build it in the spring boot, and make it available in the spring boot.
But somehow it's installing, but I can't seem to read the route. I've been thinking about it for hours, but I can't figure out where the problem is. I need help


I tried both the absolute path and the relative path


package com.oreo.finalproject_5re5_be.audio;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import java.util.zip.ZipInputStream;

public class FFmpegBuildTest {
 @Test
 public void setFFmpeg() {
 String os = System.getProperty("os.name").toLowerCase();
 System.out.println("os = " + os);

 try {
 installFFmpeg();
 } catch (IOException e) {
 e.printStackTrace();
 }

 try {
 String ffmpegPath;
 if (os.contains("win")) {
 ffmpegPath = "C:/Users/user/Desktop/oreo/FinalProject_5RE5_BE/ffmpeg/ffmpeg-7.1-essentials_build/bin"; // Windows
 } else if (os.contains("mac")) {
 ffmpegPath = "ffmpeg/ffmpeg"; // Mac
 } else if (os.contains("nix") || os.contains("nux")) {
 ffmpegPath = "ffmpeg/ffmpeg"; // Linux
 } else {
 throw new UnsupportedOperationException("Unsupported OS: " + os);
 }

 ProcessBuilder processBuilder = new ProcessBuilder(ffmpegPath, "-version");
 Process process = processBuilder.start();

 BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
 String line;
 StringBuilder output = new StringBuilder();
 while ((line = reader.readLine()) != null) {
 output.append(line).append("\n");
 }

 int exitCode = process.waitFor();
 if (exitCode == 0) {
 System.out.println("FFmpeg is installed. Version info:");
 System.out.println(output);
 } else {
 System.out.println("FFmpeg is not installed or not found in PATH.");
 }
 } catch (IOException | InterruptedException e) {
 System.out.println("FFmpeg is not installed or not found in PATH.");
 }
 }

 public static void installFFmpeg() throws IOException {
 String downloadUrl;
 String ffmpegPath;

 String os = System.getProperty("os.name").toLowerCase();
 if (os.contains("win")) {
 downloadUrl = "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip";
 ffmpegPath = "ffmpeg/bin/ffmpeg.exe";
 } else if (os.contains("mac")) {
 downloadUrl = "https://www.osxexperts.net/ffmpeg71arm.zip";
 ffmpegPath = "ffmpeg/ffmpeg";
 } else if (os.contains("nix") || os.contains("nux")) {
 downloadUrl = "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-i686-static.tar.xz";
 ffmpegPath = "ffmpeg/ffmpeg";
 } else {
 throw new UnsupportedOperationException("Unsupported OS: " + os);
 }

 System.out.println("Downloading FFmpeg from " + downloadUrl);
 try (InputStream in = new URL(downloadUrl).openStream()) {
 Files.copy(in, Paths.get("ffmpeg_download.zip"), StandardCopyOption.REPLACE_EXISTING);
 }

 System.out.println("Extracting FFmpeg...");
 if (os.contains("win") || os.contains("mac")) {
 unzip("ffmpeg_download.zip", "ffmpeg");
 } else {
 untar("ffmpeg_download.tar.xz", "ffmpeg");
 }

 File ffmpegFile = new File(ffmpegPath);
 if (ffmpegFile.exists()) {
 System.out.println("FFmpeg installed successfully at " + ffmpegFile.getAbsolutePath());
 
 addFFmpegToPath(ffmpegFile.getParent());
 } else {
 System.out.println("Failed to install FFmpeg. Please check the download and extraction.");
 }
 }

 private static void addFFmpegToPath(String ffmpegDir) {
 Map env = System.getenv();
 String path = env.get("PATH");
 path = ffmpegDir + File.pathSeparator + path;
 System.setProperty("java.library.path", path);
 System.out.println("FFmpeg path added to PATH environment variable.");
 }

 private static void unzip(String zipFilePath, String destDir) throws IOException {
 File dir = new File(destDir);
 if (!dir.exists()) dir.mkdirs();

 byte[] buffer = new byte[1024];
 try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFilePath))) {
 var zipEntry = zis.getNextEntry();
 while (zipEntry != null) {
 if (zipEntry.getName().startsWith("__MACOSX") || zipEntry.isDirectory()) {
 zipEntry = zis.getNextEntry();
 continue;
 }
 File newFile = new File(destDir, zipEntry.getName());
 if (zipEntry.isDirectory()) {
 newFile.mkdirs();
 } else {
 File parent = newFile.getParentFile();
 if (!parent.exists()) parent.mkdirs();
 try (FileOutputStream fos = new FileOutputStream(newFile)) {
 int len;
 while ((len = zis.read(buffer)) > 0) {
 fos.write(buffer, 0, len);
 }
 }
 }
 zipEntry = zis.getNextEntry();
 }
 zis.closeEntry();
 }
 }
 
 private static void untar(String tarFilePath, String destDir) throws IOException {
 
 ProcessBuilder pb = new ProcessBuilder("tar", "-xJf", tarFilePath, "-C", destDir);
 Process process = pb.start();
 try {
 int exitCode = process.waitFor();
 if (exitCode != 0) {
 throw new IOException("Failed to extract tar.xz file. Exit code: " + exitCode);
 }
 } catch (InterruptedException e) {
 Thread.currentThread().interrupt();
 throw new IOException("Interrupted during tar extraction", e);
 }
 }
}