Recherche avancée

Médias (0)

Mot : - Tags -/organisation

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

Autres articles (45)

  • 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

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (10308)

  • Ffmpeg hangs when -vcodec copy specified (called from Java via ProcessBuilder)

    24 juin 2015, par Inglonias

    I’m trying to use ffmpeg to export an array of bytes to a video file, but the people I work with insist that I use -vcodec copy in the arguments for it. This, however, causes the code to hang, whereas if I don’t use -vcodec copy, the code will not hang. I don’t know what the problem is, and I’ve been trying to debug this code for the past two hours.

    Here is the relevant section of code. I’ve added comments above and below the line where the code hangs. Can anybody help me ?

           // This is the tricky part. We need to build an ffmpeg process that
           // takes input from stdin, and then plug Java into that.
           ProcessBuilder ffmpegBuilder = new ProcessBuilder();
           String[] cmd = {"ffmpeg", "-i", "-","-vcodec", "copy", directory
                   + "/" + fileName};
           StringBuilder combinedCmd = new StringBuilder();
           for (String s : cmd) {
               combinedCmd.append(s);
               combinedCmd.append(" ");
           }
           mLogger.log(Level.INFO,"Final command is " + combinedCmd.toString());
           ffmpegBuilder.command(cmd);
           ffmpegBuilder.redirectErrorStream(true); // So that stdout and stderr go
                                                       // to the same stream.
           byte[] dataToWrite = new byte[data.size()];
           for (int i = 0; i < dataToWrite.length; i++) {
               dataToWrite[i] = data.get(i); // Is there really STILL no better way
                                               // to convert an ArrayList to an
                                               // array?!
           }
           try {
               Process ffmpeg = ffmpegBuilder.start();
               OutputStream stdin = ffmpeg.getOutputStream();
               BufferedReader stdout = new BufferedReader(new InputStreamReader(
                       ffmpeg.getInputStream()));
    //HANGS AT THIS LINE vvvvvvvvvvvvvvvv
               stdin.write(dataToWrite);
    //HANGS AT THIS LINE ^^^^^^^^^^^^^^^^

               String line = "I know a song that gets on everybody's nerves...";
               while ((line != null) && stdout.ready()) {
                   line = stdout.readLine();
                   mLogger.log(Level.INFO, line);
               }
               try {
                   ffmpeg.waitFor(2, TimeUnit.SECONDS);
                   ffmpeg.destroyForcibly();
               } catch (InterruptedException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
               }
           } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }
  • C# How do I set the volume of sound bytes[]

    23 juillet 2016, par McLucario

    Im trying to change the volume of sound bytes[] in C#. Im reading a sound file with FFMPEG and and wanna change the volume on the fly. I found some examples and but I didnt understand them.

    public void SendAudio(string pathOrUrl)
    {
       cancelVid = false;
       isPlaying = true;

       mProcess = Process.Start(new ProcessStartInfo
       { // FFmpeg requireqs us to spawn a process and hook into its stdout, so we will create a Process
           FileName = "ffmpeg",
           Arguments = "-i " + (char)34 + pathOrUrl + (char)34 + // Here we provide a list of arguments to feed into FFmpeg. -i means the location of the file/URL it will read from
           " -f s16le -ar 48000 -ac 2 pipe:1", // Next, we tell it to output 16-bit 48000Hz PCM, over 2 channels, to stdout.
           UseShellExecute = false,
           RedirectStandardOutput = true, // Capture the stdout of the process
           Verb = "runas"
       });

       while (!isRunning(mProcess)) { Task.Delay(1000); }

       int blockSize = 3840; // The size of bytes to read per frame; 1920 for mono
       byte[] buffer = new byte[blockSize];
       byte[] gainBuffer = new byte[blockSize];
       int byteCount;

       while (true && !cancelVid) // Loop forever, so data will always be read
       {
           byteCount = mProcess.StandardOutput.BaseStream // Access the underlying MemoryStream from the stdout of FFmpeg
           .Read(buffer, 0, blockSize); // Read stdout into the buffer

           if (byteCount == 0) // FFmpeg did not output anything
               break; // Break out of the while(true) loop, since there was nothing to read.

           if (cancelVid)
               break;

           disAudioClient.Send(buffer, 0, byteCount); // Send our data to Discord
       }
       disAudioClient.Wait(); // Wait for the Voice Client to finish sending data, as ffMPEG may have already finished buffering out a song, and it is unsafe to return now.
       isPlaying = false;
       Console.Clear();
       Console.WriteLine("Done Playing!");
  • Jupyter Notebook JSONDecodeError to open file

    25 février 2021, par potterykid

    Expected behavior :
open a mp3 with no error

    


    Actual behavior :
I used the script below,

    


    from pydub
import AudioSegment

    


    song = AudioSegment.from_mp3("audio.mp3")

    


    and there is a JSONDecodeError

    


    JSONDecodeError : Expecting value : line 1 column 1 (char 0)

    


    JSONDecodeError                           Traceback (most recent call last)&#xA; in <module>&#xA;   6 dst = "research.wav"&#xA;   7 &#xA;----> 8 sound = AudioSegment.from_mp3(src)&#xA;   9 sound.export(dst, format = "wav")&#xA;&#xA;~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_mp3(cls, file, parameters)&#xA; 736     @classmethod&#xA; 737     def from_mp3(cls, file, parameters=None):&#xA;--> 738         return cls.from_file(file, &#x27;mp3&#x27;, parameters=parameters)&#xA; 739 &#xA; 740     @classmethod&#xA;&#xA;~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)&#xA; 683             info = None&#xA; 684         else:&#xA;--> 685             info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)&#xA; 686         if info:&#xA; 687             audio_streams = [x for x in info[&#x27;streams&#x27;]&#xA;&#xA;~/opt/anaconda3/lib/python3.8/site-packages/pydub/utils.py in mediainfo_json(filepath, read_ahead_limit)&#xA; 277     stderr = stderr.decode("utf-8", &#x27;ignore&#x27;)&#xA; 278 &#xA;--> 279     info = json.loads(output)&#xA; 280 &#xA; 281     if not info:&#xA;&#xA;~/opt/anaconda3/lib/python3.8/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)&#xA; 355             parse_int is None and parse_float is None and&#xA; 356             parse_constant is None and object_pairs_hook is None and not kw):&#xA;--> 357         return _default_decoder.decode(s)&#xA; 358     if cls is None:&#xA; 359         cls = JSONDecoder&#xA;&#xA;~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w)&#xA; 335 &#xA; 336         """&#xA;--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())&#xA; 338         end = _w(s, end).end()&#xA; 339         if end != len(s):&#xA;&#xA;~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)&#xA; 353             obj, end = self.scan_once(s, idx)&#xA; 354         except StopIteration as err:&#xA;--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None&#xA; 356         return obj, end&#xA;&#xA;JSONDecodeError: Expecting value: line 1 column 1 (char 0)```&#xA;</module>

    &#xA;