Recherche avancée

Médias (10)

Mot : - Tags -/wav

Autres articles (47)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (9023)

  • I want to use FFmpeg in the spring boot

    12 novembre 2024, par user25686647

    While 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);
        }
    }
}



    


    enter image description here

    


  • C# console app to process FFMPEG jpg stream output

    15 septembre 2014, par Gabriel Barzola

    I am looking some tip or idea in order to process an stream of jpg files created by a fFMPEG command.

    There is a way to split the outpuStream to capture each jpg file ?

    Here is the command
    ffmpeg -i rtsp ://somertsp:554 -an -f image2pipe -vf fps=fps=5 -

    I execute that command using a C# application.

    Here is a example code

    class Program
    {
       private static BackgroundWorker worker;
       private static MemoryStream buffer = new MemoryStream();
       private static BinaryWriter bufferWriter = new BinaryWriter(buffer);

       static void Main(string[] args)
       {
           string file = @"C:\ffmpeg\bin\ffmpeg.exe";
           string arguments = @"-i rtsp://xxx:yyy@v5demo.wavestore.com:554/rtsp/00004 -an -f image2pipe -vf fps=fps=5 -qscale 0 -";

           var processStartInfo = new ProcessStartInfo(file, arguments);
           processStartInfo.CreateNoWindow = false;
           processStartInfo.RedirectStandardError = true;
           processStartInfo.RedirectStandardOutput = true;
           processStartInfo.UseShellExecute = false;

           worker = new BackgroundWorker();
           worker.DoWork += worker_DoWork;
           worker.WorkerReportsProgress = true;
           worker.ProgressChanged += worker_ProgressChanged;

           var process = new Process();
           process.StartInfo = processStartInfo;
           process.Start();

           worker.RunWorkerAsync(process);
           process.WaitForExit();

       }

       static void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
       {
           // save the image
       }

       static void worker_DoWork(object sender, DoWorkEventArgs e)
       {
           try
           {

               var internalWorker = sender as BackgroundWorker;
               Process p = e.Argument as Process;
               buffer = new MemoryStream();
               bufferWriter = new BinaryWriter(buffer);
               using (var reader = new BinaryReader(p.StandardOutput.BaseStream))
               {
                   while (true)
                   {
                      //get the jpg image
                   }
               }

           }
           catch (Exception ex)
           {
             // Log the error, continue processing the live stream
           }
       }        
    }
  • Integrating CUDA-based video decoder into libavcodec/ffmpeg

    1er février 2019, par tmlen

    I have a CUDA-based decoder of a video format running on the GPU. I am trying to add a "codec" into libavcodec that uses it as external decoder

    Currenty, I have it working such that I can play a sequence of pictures using ffplay, which
    get decoded on the GPU with the external decoder.

    But with the current implementation, the codec module copies its output (in a RGB24 pixel format) from GPU memory to host memory after each frame, and gives this to libavcodec in its AVFrame. So with this when using ffplay, it will copy the output images back and forth between GPU and host two times (as ffplay has to copy the data to GPU for display).

    My goal is to leave the uncompressed data on GPU using on a CUDA device buffer, and have ffmpeg use it.

    ffmpeg seems to have support for this using AVHWAccel.

    • Is there any example implementation that uses this with a CUDA based decoder (not using the dedicated hardware decoders through NVDEC, CUVID, etc.) ?

    • Does ffmpeg need the output in a pixel format in a CUDA buffer, or can it also be in texture memory, in a CUDA array ?

    • Is it possible to have the hardware decoder as primary decoder of the AVCodec. It seems that hardware-acceleration is foreseen as an add-on, with the software decoder implemented by AVCodec available as fallback ?

    • It seems that ffmpeg will allocate a pool of CUDA buffers to receive its output. Is it also possible to allocate the output buffers oneself in the module’s implementation, and control how many buffers there will be.

    • Is it possible to control with how many CPU threads the decoder will be called ? With the external decoder’s interface, ideal would be one writer thread that pushes compressed codestreams, and one reader thread that pulls the uncompressed output to a CUDA buffer.