Recherche avancée

Médias (1)

Mot : - Tags -/wave

Autres articles (82)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • 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 (9967)

  • ENOENT Error in Node When Calling Ffmpeg binary from Fluent-Ffmpeg Api

    7 novembre 2018, par Peter

    Background

    I am wiring up a firebase function in node. Purpose is to parse an inbound audio clip to a set length. Using ffmpeg and fluent-ffmpeg.

    Problem

    When the function is triggered in firebase, I am getting ENOENT error when Fluent-Ffmpeg attempts to access the Ffmpeg binary

    Firebase Debug Output

    Error : Error : spawn
    ./Cloud/functions/node_modules/ffmpeg-binaries/bin/ffmpeg ENOENT
    at exports._errnoException (util.js:1018:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9) code : ’ENOENT’, errno :
    ’ENOENT’, syscall : ’spawn
    ./Cloud/functions/node_modules/ffmpeg-binaries/bin/ffmpeg’, path :
    ’./Cloud/functions/node_modules/ffmpeg-binaries/bin/ffmpeg’,
    spawnargs : [ ’-formats’ ]

    Expected Outcome

    Inbound file is downloaded to a temp directory, cropped, and re-uploaded to firebase storage as the cropped file.

    Environment

    • mac client / firebase storage
    • node v8.1.0
    • ffmpeg v3.2.2
    • fluent-ffmpeg v2.1.2

    Code [Updated To Reflect Svenskunganka’s Change. Now Works]

    const ffmpeg = require('fluent-ffmpeg');
    const PREVIEW_PREFIX = 'preview_';

    exports.generatePreviewClip = functions.storage.object('audioFiles').onChange(event => {

         //console.log('Times this function has run: ', run++);

         const object = event.data; // The Storage object.
         const fileBucket = object.bucket; // The Storage bucket that contains the file.
         const filePath = object.name; // File path in the bucket.
         const contentType = object.contentType; // File content type.
         const resourceState = object.resourceState; // The resourceState is 'exists' or 'not_exists' (for file/folder deletions).
         const metageneration = object.metageneration; // Number of times metadata has been generated. New objects have a value of 1.

         // Exit if this is triggered on a file that is not an audio file.
         if (!contentType.startsWith('audio/')) {
           console.log('This is not an audio file.');
           console.log('This is the file:', filePath);
           return;
         }

         // Get the file name.
         const fileName = path.basename(filePath);
         console.log('Working with filename', fileName);
         // Exit if the file is already an audio clip.
         if (fileName.startsWith(PREVIEW_PREFIX)) {
           console.log('Already a preview clip.');
           return;
         }

         // Exit if this is a move or deletion event.
         if (event.data.resourceState === 'not_exists') {
           console.log('This is a deletion event.');
           return;
         }

         // Exit if file exists but is not new and is only being triggered
         // because of a metadata change.
         if (resourceState === 'exists' && metageneration > 1) {
           console.log('This is a metadata change event.');
           return;
         }

         // Download file from bucket.

         const bucket = gcs.bucket(fileBucket);
         const tempFilePath = path.join(os.tmpdir(), fileName);
         return bucket.file(filePath).download({
           destination: tempFilePath
         }).then(() => {

           console.log('Audio file downloaded locally to temp directory', tempFilePath);

       var ffmpegPath = require("ffmpeg-binaries").ffmpegPath();
       var ffprobePath = require("ffmpeg-binaries").ffprobePath();

       // Generate a croped file using ffmpeg.
       var command = new ffmpeg(tempFilePath);
           command.setFfmpegPath(ffmpegPath);
           command.setFfprobePath(ffprobePath);

           command
                 .setStartTime('00:00:03')
                 .setDuration('10')
                 .output(tempFilePath)
                 .on('end', function() {
                       console.log('Audio Crop Done Successfully');
                  })
                  .on('error', function(err)
                  {
                     console.log('Error:', err);
                  }).run();

                 }).then(() => {
           console.log('Preview file created at', tempFilePath);
           // We add a 'preview_' prefix to the audio file name. that's how it will appear in firebase.
           const previewFileName = PREVIEW_PREFIX + fileName;
           console.log('previewFileName is', previewFileName)
           const previewFilePath = path.join(path.dirname(filePath), previewFileName);
           console.log('previewFilePath is', previewFilePath);
           // Uploading the preview file.
           return bucket.upload(tempFilePath, {destination: previewFilePath});
         // Once the file has been uploaded delete the local file to free up disk space.
         }).then(() => fs.unlinkSync(tempFilePath));

         // [END audio file generation]

       });

    Contents and Structure of my ffmpeg-binaries/bin Directory

    -rwxrwxrwx  1 sherpa  staff    24M Dec 10  2016 ffmpeg
    -rwxr--r--  1 sherpa  staff    35M Jan 12  2017 ffmpeg.exe
    -rwxr--r--  1 sherpa  staff    35M Jan 12  2017 ffplay.exe
    -rwxrwxrwx  1 sherpa  staff    24M Dec 10  2016 ffprobe
    -rwxr--r--  1 sherpa  staff    35M Jan 12  2017 ffprobe.exe
    -rwxrwxrwx  1 sherpa  staff    22M Dec 10  2016 ffserver

    Things I Have Tried

    • I can execute ffmpeg from the command line
    • sudo chmod -R u+x ffmpeg-binaries/
    • ffmpeg set in global path
    • used ffmpeg.exe binary in setFfmpegPath, got same result
      • Error : Error : spawn ./Cloud/functions/node_modules/ffmpeg-binaries/bin/ffmpeg.exe ENOENT
    • played with numerous different setFfmpegPath path structures, e.g :
      • ./Cloud/functions/node_modules/ffmpeg-binaries/bin/ffmpeg
      • node_modules/ffmpeg-binaries/bin/ffmpeg
      • ./Cloud/functions/node_modules/ffmpeg-binaries/bin/

    Thanks for any suggestions.

  • Matplotlib animation MovieWriters fails on Ubuntu 12.04

    13 février 2013, par jjwebster

    I am attempting to save matplotlib animations to a movie via ffmpeg on Ubuntu 12.04 LTS (32-bit Desktop). Following the matplotlib example, it fails to load the animation writer : AttributeError: 'module' object has no attribute 'writers' (line 15 of the example) :

    import numpy as np
    import matplotlib
    matplotlib.use("Agg")
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation

    def update_line(num, data, line):
       line.set_data(data[...,:num])
       return line,

    # Set up formatting for the movie files
    Writer = animation.writers['ffmpeg']

    Via apt-get, I've tried installing ffmpeg, every codec imaginable, and even tried to compile ffmpeg from source. Nothing works.

    How do I get matplotlib to talk to ffmpeg on Ubuntu ?

  • CreateComponent(AMFVideoEncoderVCE_AVC) failed with error 36

    16 février 2021, par Mitrajeet Golsangi

    I am working on a matplotlib project and want to save it in a mp4 video format.
I am using the ffmpeg program for converting the animation in a video. This is the code for conversion

    


    # The animation definition

ani = FuncAnimation(figure, my_frame_function, frames=100,
                   interval=5, init_func=init, blit=True, repeat=True)


# Path for ffmpeg

plt.rcParams['animation.ffmpeg_path'] = 'C:/ffmpeg/bin/ffmpeg.exe'


# Setting up the writer

Writer = writers['ffmpeg']
writer = Writer(fps=10, metadata=dict(artist='Mitrajeet'), bitrate=None)

# Trying to Save the file
ani.save("test.png", writer=writer)  #  ---- Error here


    


    After running the file I get this Error

    


    MovieWriter stderr:&#xA;[h264_amf @ 00000000004ec840] CreateComponent(AMFVideoEncoderVCE_AVC) failed with error 36&#xA;Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height&#xA;&#xA;Traceback (most recent call last):&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\animation.py", line 251, in saving&#xA;    yield self&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\animation.py", line 1161, in save&#xA;    writer.grab_frame(**savefig_kwargs)&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\animation.py", line 363, in grab_frame&#xA;    self.fig.savefig(self._frame_sink(), format=self.frame_format,&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\figure.py", line 2311, in savefig&#xA;    self.canvas.print_figure(fname, **kwargs)&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 81, in print_figure&#xA;    super().print_figure(*args, **kwargs)&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backend_bases.py", line 2210, in print_figure&#xA;    result = print_method(&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backend_bases.py", line 1639, in wrapper&#xA;    return func(*args, **kwargs)&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backends\backend_agg.py", line 456, in print_raw&#xA;    fh.write(renderer.buffer_rgba())&#xA;BrokenPipeError: [Errno 32] Broken pipe&#xA;&#xA;During handling of the above exception, another exception occurred:&#xA;&#xA;Traceback (most recent call last):&#xA;  File "prime_counting_function.py", line 63, in <module>&#xA;    ani.save("D:/PycharmProjects/Math Graphs/Prime Numbers/output/test.png", writer=writer)&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\animation.py", line 1161, in save&#xA;    writer.grab_frame(**savefig_kwargs)&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in __exit__&#xA;    self.gen.throw(type, value, traceback)&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\animation.py", line 253, in saving&#xA;    self.finish()&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\animation.py", line 354, in finish&#xA;    self.cleanup()&#xA;  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\animation.py", line 390, in cleanup&#xA;    raise subprocess.CalledProcessError(&#xA;subprocess.CalledProcessError: Command &#x27;[&#x27;C:/ffmpeg/bin/ffmpeg.exe&#x27;, &#x27;-f&#x27;, &#x27;rawvideo&#x27;, &#x27;-vcodec&#x27;, &#x27;rawvideo&#x27;, &#x27;-s&#x27;, &#x27;640x480&#x27;, &#x27;-pix_fmt&#x27;, &#x27;rgba&#x27;, &#x27;-r&#x27;, &#x27;10&#x27;, &#x27;-loglevel&#x27;, &#x27;error&#x27;, &#x27;-i&#x27;, &#x27;pipe:&#x27;, &#x27;-vcodec&#x27;, &#x27;h264&#x27;, &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;, &#x27;-metadata&#x27;, &#x27;artist=Mitrajeet&#x27;, &#x27;-y&#x27;, &#x27;D:/PycharmProjects/Math Graphs/Prime Numbers/output/test.png&#x27;]&#x27; returned non-zero exit status 1.&#xA;</module>

    &#xA;

    So whats wrong here ??

    &#xA;