Recherche avancée

Médias (91)

Autres articles (43)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 is the first MediaSPIP stable release.
    Its official release date is June 21, 2013 and is announced here.
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

Sur d’autres sites (5182)

  • Urgent Help Needed : FFmpeg Integration in .NET MAUI for Android [closed]

    15 juin 2024, par Billy Vanegas

    I'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 :

    


    &lt;?xml version="1.0" encoding="utf-8"?>&#xA;<manifest>&#xA;    <application></application>&#xA;    &#xA;    &#xA;    &#xA;    &#xA;</manifest>&#xA;

    &#xA;

    Method ConvertMp3ToWav :

    &#xA;

    private async Task ConvertMp3ToWav(string mp3Path, string wavPath)&#xA;{&#xA;    try&#xA;    {&#xA;        // Check directory and create if not exists&#xA;        var directory = Path.GetDirectoryName(wavPath);&#xA;        if (!Directory.Exists(directory))&#xA;            Directory.CreateDirectory(directory!);&#xA;&#xA;        // Check if WAV file exists&#xA;        if (!File.Exists(wavPath))&#xA;            Console.WriteLine($"File not found {wavPath}, creating empty file.");&#xA;            using var fs = new FileStream(wavPath, FileMode.CreateNew);&#xA;&#xA;        // Check if MP3 file exists&#xA;        if (!File.Exists(mp3Path))&#xA;            Console.WriteLine($"File not found {mp3Path}");&#xA;&#xA;        // Extract FFmpeg binaries&#xA;        string? ffmpegBinaryPath = await ExtractFFmpegBinaries(Platform.AppContext);&#xA;&#xA;        // Configure FFmpeg options&#xA;        FFMpegCore.GlobalFFOptions.Configure(new FFOptions { BinaryFolder = Path.GetDirectoryName(ffmpegBinaryPath!)! });&#xA;&#xA;        // Convert MP3 to WAV&#xA;        await FFMpegArguments&#xA;              .FromFileInput(mp3Path)&#xA;              .OutputToFile(wavPath, true, options => options&#xA;                  .WithAudioCodec("pcm_s16le")&#xA;                  .WithAudioSamplingRate(44100)&#xA;                  .WithAudioBitrate(320000)&#xA;                  )&#xA;              .ProcessAsynchronously();&#xA;    }&#xA;    catch (Exception ex)&#xA;    {&#xA;        Console.WriteLine($"An error occurred during the conversion process: {ex.Message}");&#xA;        throw;&#xA;    }&#xA;}&#xA;

    &#xA;

    Method ExtractFFmpegBinaries :

    &#xA;

    private async Task<string> ExtractFFmpegBinaries(Context context)&#xA;{&#xA;    var architectureFolder = "x86"; // Adjust according to device architecture&#xA;    var ffmpegBinaryName = "ffmpeg"; &#xA;    var ffmpegBinaryPath = Path.Combine(context.FilesDir!.AbsolutePath, ffmpegBinaryName);&#xA;    var tempFFMpegFileName = Path.Combine(FileSystem.AppDataDirectory, ffmpegBinaryName);&#xA;&#xA;    if (!File.Exists(ffmpegBinaryPath))&#xA;    {&#xA;        try&#xA;        {&#xA;            var assetPath = $"Libs/{architectureFolder}/{ffmpegBinaryName}";&#xA;            using var assetStream = context.Assets!.Open(assetPath);&#xA;           &#xA;            await using var tempFFMpegFile = File.OpenWrite(tempFFMpegFileName);&#xA;            await assetStream.CopyToAsync(tempFFMpegFile);&#xA;&#xA;            // Adjust permissions for FFmpeg binary&#xA;            Java.Lang.Runtime.GetRuntime()!.Exec($"chmod 755 {tempFFMpegFileName}");&#xA;        }&#xA;        catch (Exception ex)&#xA;        {&#xA;            Console.WriteLine($"An error occurred while extracting FFmpeg binaries: {ex.Message}");&#xA;            throw;&#xA;        }&#xA;    }&#xA;    else&#xA;    {&#xA;        Console.WriteLine($"FFmpeg binaries already extracted to: {ffmpegBinaryPath}");&#xA;    }&#xA;&#xA;    return tempFFMpegFileName!;&#xA;}&#xA;</string>

    &#xA;

    What I Need :

    &#xA;

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

    &#xA;

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

    &#xA;

    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.

    &#xA;

    Thank you in advance for your help !

    &#xA;

  • Frames from Video Using OpenCV in Ubuntu with Java 17

    2 août 2023, par bstrdn

    I'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.

    &#xA;

    Here's my test code :

    &#xA;

    Main class

    &#xA;

    import org.opencv.core.Core;&#xA;import org.opencv.videoio.VideoCapture;&#xA;&#xA;public class Main {&#xA;  public static String videoPath = "";&#xA;  static {&#xA;    String osName = System.getProperty("os.name").toLowerCase();&#xA;    if (osName.contains("win")) {&#xA;      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);&#xA;      videoPath = ClassLoader.getSystemResource("video.mp4").getPath();&#xA;    } else {&#xA;      videoPath = "/video.mp4";&#xA;//      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);&#xA;      System.load("/usr/lib/opencv_java470.so");&#xA;    }&#xA;  }&#xA;&#xA;  public static void main(String[] args) throws InterruptedException {&#xA;    VideoCapture videoCapture = new VideoCapture(videoPath);&#xA;    if (!videoCapture.isOpened()) {&#xA;      System.out.println("Error opening video file.");&#xA;    } else {&#xA;      System.out.println("Everything is fine.");&#xA;    }&#xA;    System.out.println(Core.getBuildInformation());&#xA;    Thread.sleep(1000000000000000000L);&#xA;  }&#xA;}&#xA;

    &#xA;

    Maven :

    &#xA;

    &lt;?xml version="1.0" encoding="UTF-8"?>&#xA;<project xmlns="http://maven.apache.org/POM/4.0.0">&#xA;  <modelversion>4.0.0</modelversion>&#xA;  <parent>&#xA;    <groupid>org.springframework.boot</groupid>&#xA;    <artifactid>spring-boot-starter-parent</artifactid>&#xA;    <version>3.0.2</version>&#xA;    <relativepath></relativepath> &#xA;  </parent>&#xA;  <groupid>org.example</groupid>&#xA;  <artifactid>untitled</artifactid>&#xA;  <version>1.0-SNAPSHOT</version>&#xA;  <properties>&#xA;    17&#xA;    17&#xA;    UTF-8&#xA;  </properties>&#xA;&#xA;<dependencies>&#xA;<dependency>&#xA;  <groupid>org.bytedeco</groupid>&#xA;  <artifactid>opencv-platform</artifactid>&#xA;  <version>4.7.0-1.5.9</version>&#xA;</dependency>&#xA;&#xA;<dependency>&#xA;  <groupid>org.springframework.boot</groupid>&#xA;  <artifactid>spring-boot-starter-web</artifactid>&#xA;</dependency>&#xA;</dependencies>&#xA;<build>&#xA;<plugins>&#xA;  <plugin>&#xA;    <groupid>org.springframework.boot</groupid>&#xA;    <artifactid>spring-boot-maven-plugin</artifactid>&#xA;  </plugin>&#xA;</plugins>&#xA;</build>&#xA;</project>&#xA;

    &#xA;

    Dockerfile :

    &#xA;

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

    &#xA;

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

    &#xA;

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

    &#xA;

    Moreover, ffmpeg is installed on Ubuntu.

    &#xA;

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

    &#xA;

    Thank you in advance for your assistance !

    &#xA;

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

    &#xA;

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

    &#xA;

    but the result is the same.

    &#xA;

  • How to enable LHLS in FFMPEG 4.1 ?

    27 décembre 2020, par mehdi.r

    I am trying to create a low latency CMAF video stream using FFMPEG.&#xA;To do so, I would like to enable the lhls option in FFMPEG in order to have the #EXT-X-PREFETCH tag written in the HLS manifest.

    &#xA;&#xA;

    From the FFMPEG doc :

    &#xA;&#xA;

    https://www.ffmpeg.org/ffmpeg-all.html

    &#xA;&#xA;

    &#xA;

    Enable Low-latency HLS(LHLS). Adds #EXT-X-PREFETCH tag with current >segment’s URI. Apple doesn’t have an official spec for LHLS. Meanwhile >hls.js player folks are trying to standardize a open LHLS spec. The >draft spec is available in https://github.com/video-dev/hlsjs->rfcs/blob/lhls-spec/proposals/0001-lhls.md This option will also try >to comply with the above open spec, till Apple’s spec officially >supports it. Applicable only when streaming and hls_playlist options >are enabled. This is an experimental feature.

    &#xA;

    &#xA;&#xA;

    I am using the following command with FFMPEG 4.1 :

    &#xA;&#xA;

    ffmpeg -re -i ~/Documents/videos/BigBuckBunny.mp4 \&#xA;    -map 0 -map 0 -map 0 -c:a aac -c:v libx264 -tune zerolatency \&#xA;    -b:v:0 2000k -s:v:0 1280x720 -profile:v:0 high \&#xA;    -b:v:1 1500k -s:v:1 640x340  -profile:v:1 main \&#xA;    -b:v:2 500k -s:v:2 320x170  -profile:v:2 baseline \&#xA;    -bf 1 \&#xA;    -keyint_min 24 -g 24 -sc_threshold 0 -b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1 \&#xA;    -window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a" \&#xA;    -hls_playlist 1 -seg_duration 1 -streaming 1  -strict experimental -lhls 1 -remove_at_exit 1 \&#xA;    -f dash manifest.mpd&#xA;&#xA;

    &#xA;&#xA;

    The kind of HLS manifest I obtained for a specific resolution :

    &#xA;&#xA;

    #EXTM3U&#xA;#EXT-X-VERSION:6&#xA;#EXT-X-TARGETDURATION:1&#xA;#EXT-X-MEDIA-SEQUENCE:8&#xA;#EXT-X-MAP:URI="init-stream0.mp4"&#xA;#EXTINF:0.998458,&#xA;#EXT-X-PROGRAM-DATE-TIME:2019-06-21T18:13:56.966&#x2B;0900&#xA;chunk-stream0-00008.mp4&#xA;#EXTINF:0.998458,&#xA;#EXT-X-PROGRAM-DATE-TIME:2019-06-21T18:13:57.964&#x2B;0900&#xA;chunk-stream0-00009.mp4&#xA;#EXTINF:0.998458,&#xA;#EXT-X-PROGRAM-DATE-TIME:2019-06-21T18:13:58.963&#x2B;0900&#xA;chunk-stream0-00010.mp4&#xA;#EXTINF:0.998458,&#xA;#EXT-X-PROGRAM-DATE-TIME:2019-06-21T18:13:59.961&#x2B;0900&#xA;chunk-stream0-00011.mp4&#xA;#EXTINF:1.021678,&#xA;#EXT-X-PROGRAM-DATE-TIME:2019-06-21T18:14:00.960&#x2B;0900&#xA;chunk-stream0-00012.mp4&#xA;...&#xA;&#xA;

    &#xA;&#xA;

    As you can see the #EXT-X-PREFETCH tag is missing.

    &#xA;&#xA;

    Any help would be highly appreciated.

    &#xA;&#xA;

    Edit

    &#xA;&#xA;

    I also compiled FFmpeg from its master branch by doing the following :

    &#xA;&#xA;

    nasm

    &#xA;&#xA;

    sudo apt-get install nasm mingw-w64&#xA;

    &#xA;&#xA;

    Codecs

    &#xA;&#xA;

    sudo apt-get install libx265-dev libnuma-dev libx264-dev libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev&#xA;

    &#xA;&#xA;

    FFmpeg

    &#xA;&#xA;

    mkdir lhls&#xA;cd lhls &#xA;git init &#xA;git clone https://github.com/FFmpeg/FFmpeg.git&#xA;cd FFmpeg &#xA;git checkout master&#xA;

    &#xA;&#xA;

    AOM (inside FFmpeg dir)

    &#xA;&#xA;

    git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom &amp;&amp; \&#xA;mkdir -p aom_build &amp;&amp; \&#xA;cd aom_build &amp;&amp; \&#xA;PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off -DENABLE_NASM=on ../aom &amp;&amp; \&#xA;PATH="$HOME/bin:$PATH" make &amp;&amp; \&#xA;make install&#xA;cd..&#xA;

    &#xA;&#xA;

    Compiling

    &#xA;&#xA;

    PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \&#xA;  --prefix="$HOME/ffmpeg_build" \&#xA;  --pkg-config-flags="--static" \&#xA;  --extra-cflags="-I$HOME/ffmpeg_build/include" \&#xA;  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \&#xA;  --extra-libs="-lpthread -lm" \&#xA;  --bindir="$HOME/bin" \&#xA;  --enable-gpl \&#xA;  --enable-libaom \&#xA;  --enable-libass \&#xA;  --enable-libfdk-aac \&#xA;  --enable-libfreetype \&#xA;  --enable-libmp3lame \&#xA;  --enable-libopus \&#xA;  --enable-libvorbis \&#xA;  --enable-libvpx \&#xA;  --enable-libx264 \&#xA;  --enable-libx265 \&#xA;  --enable-nonfree &amp;&amp; \&#xA;PATH="$HOME/bin:$PATH" make &#xA;

    &#xA;&#xA;

    Unfortunately, the #EXT-X-PREFETCH is still missing in the HLS Manifest.

    &#xA;&#xA;

    I also tried nightly builds from https://ffmpeg.zeranoe.com/builds/ , same result.

    &#xA;&#xA;

    Any help would be highly appreciated.

    &#xA;&#xA;

    EDIT 2 :resolved

    &#xA;&#xA;

    Thanks to @aergistal and @Gyan , the #EXT-X-PREFETCH tag is now present in my HLS manifest.

    &#xA;&#xA;

    Here the FFMPEG command I am using :

    &#xA;&#xA;

    ./ffmpeg -re -i ~/videos/BigBuckBunny.mp4 -loglevel debug \&#xA;  -map 0 -map 0 -map 0 -c:a aac -c:v libx264 -tune zerolatency \&#xA;  -b:v:0 2000k -s:v:0 1280x720 -profile:v:0 high -b:v:1 1500k -s:v:1 640x340  -profile:v:1 main -b:v:2 500k -s:v:2 320x170  -profile:v:2 baseline -bf 1 \&#xA; -keyint_min 24 -g 24 -sc_threshold 0 -b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1 -window_size 5 \&#xA; -adaptation_sets "id=0,streams=v id=1,streams=a" -hls_playlist 1 -seg_duration 3 -streaming 1 \&#xA; -strict experimental -lhls 1 -remove_at_exit 0 -master_m3u8_publish_rate 3 \&#xA; -f dash -method PUT -http_persistent 1  https://example.com/manifest.mpd&#xA;

    &#xA;&#xA;

    Apparently the mime types are not passed to the server & FFmpeg seems to ignore the -headers option.

    &#xA;