Recherche avancée

Médias (0)

Mot : - Tags -/formulaire

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (47)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (7044)

  • How to solve javacv ExceptionInInitializerError [closed]

    6 juin, par shihui wei

    I want to combine multiple images into a gif. I chose ffmpeg. I learned that there are binary dependencies including ffmpeg in java, so I chose javacv

    


    First, I added the dependency of javacv to my pom file:

    


            <dependency>&#xA;            <groupid>org.bytedeco</groupid>&#xA;            <artifactid>javacv-platform</artifactid>&#xA;            <version>1.5.11</version>&#xA;        </dependency>&#xA;

    &#xA;

    Then I wrote a code to synthesize GIF from multiple images.

    &#xA;

    public static byte[] encodeGif(List<bufferedimage> frames, int frameDelayMs, boolean loopForever) {&#xA;&#xA;        if (frames == null || frames.isEmpty()) {&#xA;            throw new IllegalArgumentException("frames 不能为空");&#xA;        }&#xA;        int width = frames.get(0).getWidth();&#xA;        int height = frames.get(0).getHeight();&#xA;&#xA;        // ByteArrayOutputStream &#x2B; FFmpegFrameRecorder&#xA;        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {&#xA;            &#xA;            try (FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(baos, width, height)) {&#xA;                recorder.setFormat("gif");&#xA;                recorder.setFrameRate(1000.0 / frameDelayMs);&#xA;&#xA;                recorder.setOption("loop", loopForever ? "0" : "1");&#xA;&#xA;                recorder.start();&#xA;&#xA;                Java2DFrameConverter converter = new Java2DFrameConverter();&#xA;                for (BufferedImage img : frames) {&#xA;                    // 把 BufferedImage 转成 Frame&#xA;                    Frame frame = converter.convert(img);&#xA;                    recorder.record(frame);&#xA;                }&#xA;&#xA;                recorder.stop();&#xA;            }&#xA;            return baos.toByteArray();&#xA;        } catch (Exception e) {&#xA;            log.error("FastGifUtil.encodeGif 失败", e);&#xA;            throw new RuntimeException("生成 GIF 失败", e);&#xA;        }&#xA;&#xA;    }&#xA;</bufferedimage>

    &#xA;

    Finally, I have prepared data to test, Below is my test code:

    &#xA;

        public void testGenerateGif() {&#xA;        log.info(">>>>>>>>>>> start get bufferedImage &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;");&#xA;        List<bufferedimage> bufferedImages = batchTaskUtils.batchIOTask(urls, url -> {&#xA;            byte[] byteData = imageClientUtils.byteData(url);&#xA;            return OpencvUtils.byteToBufferedImage(byteData);&#xA;        });&#xA;        log.info(">>>>>>>>>>> start generate gif &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;");&#xA;        long time = System.currentTimeMillis();&#xA;        byte[] bytes = GifUtils.encodeGif(bufferedImages, 50, true);&#xA;        log.info("{}", System.currentTimeMillis() - time);&#xA;        log.info(">>>>>>>>>>> start upload gif &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;");&#xA;        String upload = upload(bytes);&#xA;        log.info("{}", upload);&#xA;&#xA;    }&#xA;</bufferedimage>

    &#xA;

    However, I encountered a difficult problem : I cannot load the FFmpegFrameRecorder class. The exception error is :

    &#xA;

    java.lang.ExceptionInInitializerError&#xA;    at org.bytedeco.javacv.FFmpegFrameRecorder.<clinit>(FFmpegFrameRecorder.java:356)&#xA;    at com.kuaishou.qa.utils.GifUtils.encodeGif(GifUtils.java:29)&#xA;    at com.kuaishou.qa.AnimationDiffTest.testGenerateGif(AnimationDiffTest.java:88)&#xA;    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&#xA;    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&#xA;    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&#xA;    at java.base/java.lang.reflect.Method.invoke(Method.java:566)&#xA;    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)&#xA;    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)&#xA;    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)&#xA;    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)&#xA;</clinit>

    &#xA;

  • Discord.js "Error : FFMPEG not found" but I'm pretty sure I have it

    21 février 2020, par Cole Perry

    I’m learning Discord.js and following this tutorial : https://discord.js.org/#/docs/main/stable/topics/voice . From the start, when I try to run- npm install ffmpeg-binaries I get a huge error message but it tells me to just use install ffmpeg so I did.

    Here is my Index.js page(I’ve replaced my token with * here) :

    const Discord = require('discord.js');
    const Colesbot = new Discord.Client();

    const token = '**********************************';

    Colesbot.on('ready', () =>{
       console.log('Slamsbot is online.');
    })

    Colesbot.on('message', msg=>{
      if(msg.content == "What up bot?"){
          msg.reply("Whats good pimp?")
      }
    });

    Colesbot.on('message', message=>{
       if (message.content === '/join') {
           // Only try to join the sender's voice channel if they are in one themselves
           if (message.member.voiceChannel) {
               message.member.voiceChannel.join().then(connection => {
                   message.reply('I have successfully connected to the channel!');
               }).catch(console.log);
       } else {
           message.reply('You need to join a voice channel first!');
         }
       }
    });

    //Event listener for new guild members
    Colesbot.on('guildMemberAdd', member =>{
       // Send the message to a designated channel on a server:
       const channel = member.guild.channels.find(ch => ch.name === 'general');
       // Do nothing if the channel wasn't found on this server
       if (!channel) return;
       // Send the message, mentioning the member
       channel.send(`Welcome to the server, ${member}. Please use the bot-commands channel to assign yourself a role.`);
    })

    Colesbot.login(token);



    exports.run = (client, message, args) => {

       let user = message.mentions.users.first || message.author;


    }

    If I type "/join" while not connected to a voice channel I get the proper message. However, if I try while I am I get this error message :

    Error: FFMPEG not found
    task_queues.js:94
    message:"FFMPEG not found"
    stack:"Error: FFMPEG not found\n    at Function.selectFfmpegCommand (c:\Users\bobal\Documents\GitHub\Spotify-Playlist-Discord-bot\node_modules\prism-media\src\transcoders\ffmpeg\Ffmpeg.js:46:13)\n    at new FfmpegTranscoder (c:\Users\bobal\Documents\GitHub\Spotify-Playlist-Discord-bot\node_modules\prism-media\src\transcoders\ffmpeg\Ffmpeg.js:7:37)\n    at new MediaTranscoder (c:\Users\bobal\Documents\GitHub\Spotify-Playlist-Discord-bot\node_modules\prism-media\src\transcoders\MediaTranscoder.js:10:19)\n    at new Prism (c:\Users\bobal\Documents\GitHub\Spotify-Playlist-Discord-bot\node_modules\prism-media\src\Prism.js:5:23)\n    at new VoiceConnection (c:\Users\bobal\Documents\GitHub\Spotify-Playlist-Discord-bot\node_modules\discord.js\src\client\voice\VoiceConnection.js:46:18)\n    at c:\Users\bobal\Documents\GitHub\Spotify-Playlist-Discord-bot\node_modules\discord.js\src\client\voice\ClientVoiceManager.js:63:22\n    at new Promise (<anonymous>)\n    at ClientVoiceManager.joinChannel (c:\Users\bobal\Documents\GitHub\Spotif...
    </anonymous>

    So I went to that folder and the file Ffmpeg.js is there and here is its contents :

    const ChildProcess = require('child_process');
    const FfmpegProcess = require('./FfmpegProcess');

    class FfmpegTranscoder {
     constructor(mediaTranscoder) {
       this.mediaTranscoder = mediaTranscoder;
       this.command = FfmpegTranscoder.selectFfmpegCommand();
       this.processes = [];
     }

     static verifyOptions(options) {
       if (!options) throw new Error('Options not provided!');
       if (!options.media) throw new Error('Media must be provided');
       if (!options.ffmpegArguments || !(options.ffmpegArguments instanceof Array)) {
         throw new Error('FFMPEG Arguments must be an array');
       }
       if (options.ffmpegArguments.includes('-i')) return options;
       if (typeof options.media === 'string') {
         options.ffmpegArguments = ['-i', `${options.media}`].concat(options.ffmpegArguments).concat(['pipe:1']);
       } else {
         options.ffmpegArguments = ['-i', '-'].concat(options.ffmpegArguments).concat(['pipe:1']);
       }
       return options;
     }

     /**
      * Transcodes an input using FFMPEG
      * @param {FfmpegTranscoderOptions} options the options to use
      * @returns {FfmpegProcess} the created FFMPEG process
      * @throws {FFMPEGOptionsError}
      */
     transcode(options) {
       if (!this.command) this.command = FfmpegTranscoder.selectFfmpegCommand();
       const proc = new FfmpegProcess(this, FfmpegTranscoder.verifyOptions(options));
       this.processes.push(proc);
       return proc;
     }

     static selectFfmpegCommand() {
       try {
         return require('ffmpeg-binaries');
       } catch (err) {
         for (const command of ['ffmpeg', 'avconv', './ffmpeg', './avconv']) {
           if (!ChildProcess.spawnSync(command, ['-h']).error) return command;
         }
         throw new Error('FFMPEG not found');
       }
     }
    }

    module.exports = FfmpegTranscoder;

    I also added ffmpeg to system path and it didn’t help :

    C:\ffmpeg
    C:\Users\bobal\Documents\GitHub\Spotify-Playlist-Discord-bot\ffmpeg

    I’m not quite sure what to do from here. If you need any other info I’d be glad to give it.

  • How would I go about packaging an mp3 file into an mp4 container ?

    22 novembre 2020, par Jacob

    So here's the issue that I'm currently having. I need an audio player for iOS that will play mp3. Now at first glance this may seem like a trivial issue, just create an audio tag and give it the URL to the mp3 file. While this technically works, it's basically unusable since iOS needs to download the entire file before starting to play it. This results in a really long wait time when trying to play large mp3 files (could get close to a minute).&#xA;So the first thing I tried was to manually mimic the chunking that chrome does for playing mp3 files. I first sent a HEAD request to get the byte length of the audio file. Used that length / duration in seconds to get the average bytes per second and use that data to request chunks based on where the user seeks to. That didn't work since sometimes mp3 files contain metadata that throw off the calculation (like a cover image). Additionally, sometimes mp3 files use VBR (Variable Bit Rate) and then I'm well and truly screwed.

    &#xA;&#xA;

    So this lead me to thinking, Safari couldn't possibly require the end user to download an entire mp4 file before playing it. So I took an mp3 file, converted it to mp4 on an online converter and tested my theory out. Voila, it worked. Safari was streaming the mp4 file in chunks and the wait time went to close to 0. Alright, so now all I need to do is convert mp3 files to mp4 files. The problem now is, I have requirement not to use my server for converting these files. I want to offload this expensive operation to the client. After looking around for a bit I found a few wasm libraries to do this, great ! Nope. These wasm libraries are huge (24 MB) and would add an unacceptable amount to my already large bundles files. So this brings me to my question. Is there any way to "trick" safari into thinking that my mp3 file is mp4. What I've tried already :

    &#xA;&#xA;

    On input change event -> get the file -> clone it into a new Blob with a mimeType of video/mp4 and then upload that file to the server. Chrome plays this file no problem (probably because it detects it's an mp3 file), on Safari however it's unable to play the file.

    &#xA;&#xA;

    So my question is, is there any way to package the mp3 file in an mp4 container (Client Side !important) to "force" Safari into chunking the file.

    &#xA;