
Recherche avancée
Médias (2)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (71)
-
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 ;
-
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 -
Problèmes fréquents
10 mars 2010, parPHP et safe_mode activé
Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site
Sur d’autres sites (6424)
-
Revision 34657 : lister les plugins non utilises (le glob() est pourri, qui fait mieux)
23 janvier 2010, par fil@… — Loglister les plugins non utilises (le glob() est pourri, qui fait mieux)
-
Urgent Help Needed : FFmpeg Integration in .NET MAUI for Android [closed]
15 juin 2024, par Billy VanegasI'm currently facing a significant challenge with integrating FFmpeg into my .NET MAUI project for Android. While everything works smoothly on Windows with Visual Studio 2022, I'm having a hard time replicating this on the Android platform. Despite exploring various NuGet packages like FFMpegCore, which appear to be wrappers around FFmpeg but don't include FFmpeg itself, I'm still at a loss.


I've tried following the instructions for integrating ffmpeg-kit for Android, but I keep running into issues, resulting in repeated failures and growing confusion. It feels like there is no straightforward way to seamlessly incorporate FFmpeg into a .NET MAUI project that works consistently across both iOS and Android.


The Problem :


I need to convert MP3 files to WAV format using FFmpeg on the Android platform within a .NET MAUI project. I’m using the FFMpegCore library and have downloaded the FFmpeg binaries from the official FFmpeg website.


However, when attempting to use these binaries on an Android emulator, I encounter a permission denied error in the working directory :
/data/user/0/com.companyname.projectname/files/ffmpeg


Here’s the code snippet where the issue occurs :


await FFMpegArguments
 .FromFileInput(mp3Path)
 .OutputToFile(wavPath, true, options => options
 .WithAudioCodec("pcm_s16le")
 .WithAudioSamplingRate(44100)
 .WithAudioBitrate(320000)
 )
 .ProcessAsynchronously();
 



Additional Details :


I've updated AndroidManifest.xml with permissions, but the issue persists.


I've created a method ConvertMp3ToWav to handle the conversion.
I also have a method ExtractFFmpegBinaries to manage FFmpeg binaries extraction, but it seems the permission issue might be tied to how these binaries are accessed or executed.


AndroidManifest.xml :


<?xml version="1.0" encoding="utf-8"?>
<manifest>
 <application></application>
 
 
 
 
</manifest>



Method ConvertMp3ToWav :


private async Task ConvertMp3ToWav(string mp3Path, string wavPath)
{
 try
 {
 // Check directory and create if not exists
 var directory = Path.GetDirectoryName(wavPath);
 if (!Directory.Exists(directory))
 Directory.CreateDirectory(directory!);

 // Check if WAV file exists
 if (!File.Exists(wavPath))
 Console.WriteLine($"File not found {wavPath}, creating empty file.");
 using var fs = new FileStream(wavPath, FileMode.CreateNew);

 // Check if MP3 file exists
 if (!File.Exists(mp3Path))
 Console.WriteLine($"File not found {mp3Path}");

 // Extract FFmpeg binaries
 string? ffmpegBinaryPath = await ExtractFFmpegBinaries(Platform.AppContext);

 // Configure FFmpeg options
 FFMpegCore.GlobalFFOptions.Configure(new FFOptions { BinaryFolder = Path.GetDirectoryName(ffmpegBinaryPath!)! });

 // Convert MP3 to WAV
 await FFMpegArguments
 .FromFileInput(mp3Path)
 .OutputToFile(wavPath, true, options => options
 .WithAudioCodec("pcm_s16le")
 .WithAudioSamplingRate(44100)
 .WithAudioBitrate(320000)
 )
 .ProcessAsynchronously();
 }
 catch (Exception ex)
 {
 Console.WriteLine($"An error occurred during the conversion process: {ex.Message}");
 throw;
 }
}



Method ExtractFFmpegBinaries :


private async Task<string> ExtractFFmpegBinaries(Context context)
{
 var architectureFolder = "x86"; // Adjust according to device architecture
 var ffmpegBinaryName = "ffmpeg"; 
 var ffmpegBinaryPath = Path.Combine(context.FilesDir!.AbsolutePath, ffmpegBinaryName);
 var tempFFMpegFileName = Path.Combine(FileSystem.AppDataDirectory, ffmpegBinaryName);

 if (!File.Exists(ffmpegBinaryPath))
 {
 try
 {
 var assetPath = $"Libs/{architectureFolder}/{ffmpegBinaryName}";
 using var assetStream = context.Assets!.Open(assetPath);
 
 await using var tempFFMpegFile = File.OpenWrite(tempFFMpegFileName);
 await assetStream.CopyToAsync(tempFFMpegFile);

 // Adjust permissions for FFmpeg binary
 Java.Lang.Runtime.GetRuntime()!.Exec($"chmod 755 {tempFFMpegFileName}");
 }
 catch (Exception ex)
 {
 Console.WriteLine($"An error occurred while extracting FFmpeg binaries: {ex.Message}");
 throw;
 }
 }
 else
 {
 Console.WriteLine($"FFmpeg binaries already extracted to: {ffmpegBinaryPath}");
 }

 return tempFFMpegFileName!;
}
</string>


What I Need :


I urgently need guidance on how to correctly integrate and use FFmpeg in my .NET MAUI project for Android. Specifically :


How to properly set up and configure FFmpeg binaries for use on Android within a .NET MAUI project.
How to resolve the permission denied issue when attempting to execute FFmpeg binaries.


Any advice, solutions, or workarounds would be greatly appreciated as this is a critical part of my project and I'm running out of time to resolve it.


Thank you in advance for your help !


-
Frames from Video Using OpenCV in Ubuntu with Java 17
2 août 2023, par bstrdnI've been trying to extract frames from a video using OpenCV in an Ubuntu environment with Java 17, but all my attempts have been unsuccessful so far. The main issue is that ffmpeg is not detected by the OpenCV library on ubuntu.


Here's my test code :


Main class


import org.opencv.core.Core;
import org.opencv.videoio.VideoCapture;

public class Main {
 public static String videoPath = "";
 static {
 String osName = System.getProperty("os.name").toLowerCase();
 if (osName.contains("win")) {
 System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
 videoPath = ClassLoader.getSystemResource("video.mp4").getPath();
 } else {
 videoPath = "/video.mp4";
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
 System.load("/usr/lib/opencv_java470.so");
 }
 }

 public static void main(String[] args) throws InterruptedException {
 VideoCapture videoCapture = new VideoCapture(videoPath);
 if (!videoCapture.isOpened()) {
 System.out.println("Error opening video file.");
 } else {
 System.out.println("Everything is fine.");
 }
 System.out.println(Core.getBuildInformation());
 Thread.sleep(1000000000000000000L);
 }
}



Maven :


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
 <modelversion>4.0.0</modelversion>
 <parent>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-starter-parent</artifactid>
 <version>3.0.2</version>
 <relativepath></relativepath> 
 </parent>
 <groupid>org.example</groupid>
 <artifactid>untitled</artifactid>
 <version>1.0-SNAPSHOT</version>
 <properties>
 17
 17
 UTF-8
 </properties>

<dependencies>
<dependency>
 <groupid>org.bytedeco</groupid>
 <artifactid>opencv-platform</artifactid>
 <version>4.7.0-1.5.9</version>
</dependency>

<dependency>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-starter-web</artifactid>
</dependency>
</dependencies>
<build>
<plugins>
 <plugin>
 <groupid>org.springframework.boot</groupid>
 <artifactid>spring-boot-maven-plugin</artifactid>
 </plugin>
</plugins>
</build>
</project>



Dockerfile :


FROM ubuntu:20.04
RUN apt-get update && apt-get install -y openjdk-17-jdk
RUN apt-get update && apt-get install -y pkg-config
RUN apt-get update && apt-get install -y ffmpeg libavformat-dev libavcodec-dev libswscale-dev libavresample-dev
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
COPY target/*.jar /app.jar
COPY src/main/resources/video.mp4 /
COPY opencv_java470.so /usr/lib
ENV JAVA_TOOL_OPTIONS="-Djava.library.path=/usr/lib:/lib:/usr/local/lib:/usr/local:/usr/lib/x86_64-linux-gnu"
ENV LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/local:/usr/lib/x86_64-linux-gnu
ENTRYPOINT [ "sh", "-c", "java $JAVA_TOOL_OPTIONS -jar /app.jar" ]



The application displays the following text (video is not opened) :


Error opening video file.

2023-08-02T13:30:58.448538297Z 
2023-08-02T13:30:58.448572597Z General configuration for OpenCV 4.7.0 =====================================
2023-08-02T13:30:58.448587327Z Version control: v4.7.0
2023-08-02T13:30:58.448590607Z 
2023-08-02T13:30:58.448593217Z Platform:
2023-08-02T13:30:58.448596057Z Timestamp: 2023-03-27T23:13:34Z
2023-08-02T13:30:58.448598747Z Host: Linux 5.4.0-1103-azure x86_64
2023-08-02T13:30:58.448601377Z CMake: 3.25.2
2023-08-02T13:30:58.448604277Z CMake generator: Unix Makefiles
2023-08-02T13:30:58.448606837Z CMake build tool: /usr/bin/make
2023-08-02T13:30:58.448609327Z Configuration: RELEASE
2023-08-02T13:30:58.448611867Z 
.......there is a lot of text......
2023-08-02T13:30:58.448772865Z 
2023-08-02T13:30:58.448775355Z Video I/O:
2023-08-02T13:30:58.448777845Z DC1394: NO
2023-08-02T13:30:58.448780535Z FFMPEG: NO
2023-08-02T13:30:58.448783105Z avcodec: NO
2023-08-02T13:30:58.448785725Z avformat: NO
2023-08-02T13:30:58.448788295Z avutil: NO
2023-08-02T13:30:58.448790755Z swscale: NO
2023-08-02T13:30:58.448793295Z avresample: NO
2023-08-02T13:30:58.448795845Z GStreamer: NO
2023-08-02T13:30:58.448798255Z v4l/v4l2: YES (linux/videodev2.h)
2023-08-02T13:30:58.448800885Z 
2023-08-02T13:30:58.448803525Z Parallel framework: pthreads
2023-08-02T13:30:58.448806345Z 
............
2023-08-02T13:30:58.448859654Z Java: export all functions
2023-08-02T13:30:58.448862024Z ant: /usr/bin/ant (ver 1.10.5)
2023-08-02T13:30:58.448864504Z JNI: /opt/hostedtoolcache/jdk/8.0.362/x64/include /opt/hostedtoolcache/jdk/8.0.362/x64/include/linux /opt/hostedtoolcache/jdk/8.0.362/x64/include
2023-08-02T13:30:58.448867224Z Java wrappers: YES
2023-08-02T13:30:58.448869804Z Java tests: NO
2023-08-02T13:30:58.448872314Z 
2023-08-02T13:30:58.448874734Z Install to: /usr/local



Moreover, ffmpeg is installed on Ubuntu.


How can i fix this ? I'm deathly tired(


Thank you in advance for your assistance !


First I tried installation following the official instructions.https://github.com/bytedeco/javacv#required-software


Then the solution provided in https://stackoverflow.com/a/76750478/8087508,


but the result is the same.