Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (44)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

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

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (5578)

  • How to pass BytesIO image objects to ffmpeg ?

    13 avril 2023, par Mr.Slow

    I a have a (nested) list od BytesIO objects (images) that I would like to pass to ffmpeg and make a video. I do know, the ffmpeg cannot take it straight. What should I convert it in first ? There might be a better way using 'pipe :', which I did not succeed to implement yet.
(in this example code I ignore image duration and audio, too)

    


    def merge_videos(file_id: float, audio_list: List[BinaryIO], duration_list: List[float], images_nested_list):
    # flatten the nested list of images
    images_list = [image for images_sublist in images_nested_list for image in images_sublist]
    
    additional_parameters = {'c:a': 'aac', 'c:v': 'libx264'}

    # Create a BytesIO object to hold the output video data
    output_data = io.BytesIO()

    # create the FFmpeg command with the specified parameters and pipe the output to the BytesIO object
    command = ffmpeg.output(*images_list, '-', vf='fps=10,format=yuv420p', preset='veryfast', shortest=None, r=10, max_muxing_queue_size=4000, **additional_parameters).pipe(output_data)

    try:
        # run the FFmpeg command with error and output capture
        subprocess.check_output(['ffmpeg', '-y', '-f', 'concat', '-safe', '0', '-i', 'audio.txt', '-i', '-', '-c:v', 'copy', '-c:a', 'aac', f"{PROJECT_PATH}/data/final-{file_id}.mp4"], input=output_data.getvalue())
        log.info("Final video with file_id %s has been converted successfully", file_id)


    


    ...this code returns :

    


    TypeError: Expected incoming stream(s) to be of one of the following types: ffmpeg.nodes.FilterableStream; got <class>&#xA;</class>

    &#xA;

    How to handle it please ? Thanks for help.

    &#xA;

  • naming dual audio tracks with ffmpeg

    22 octobre 2012, par Azevedo

    I'm using ffmpeg to combine 1 video + 2 audio tracks into a mp4 container.

    How do I set the name of each track ? (so in the player it won't be '0' and '1')

    ffmpeg -i file1.avi -i extra-audio.mp4 -c copy -map 0:0 -map 0:1 -map 1:0 final.mp4

    thanks !

  • JavaFXFrameConverter consuming insane amounts of memory

    17 juillet 2023, par iexav

    The JavaFXFrameConverter (from the wrapper of the ffmpeg C library in java) convert() method is consuming an outrageous amount of memory. To elaborate a bit more, it does not happen usually. If I just make an instance of the class in my main method, grab a frame via FFMpegFrameGrabber and give it to the convert() method the memory usage is pretty much none. However, when I attempt to do pretty much the exact same in a class I made using an ExecutorService my memory usage jumps up to 8 gigabytes when convert is called. The converter and executor service are declared as member variables of my class. Namely :

    &#xA;

        final JavaFXFrameConverter converter = new JavaFXFrameConverter();&#xA;    private  ExecutorService           videoExecutor;&#xA;

    &#xA;

    (the videoExecutor is instantiated in the constructor of the class :

    &#xA;

    videoExecutor=Executors.newSingleThreadExecutor();&#xA;

    &#xA;

    Now, the method I am using for processing of the video frames is this :

    &#xA;

        private void processVideo(){&#xA;        videoExecutor.submit(() -> {&#xA;            processingVideo.set(true);&#xA;            try{&#xA;&#xA;                while(processingVideo.get() &amp;&amp; (videoQueue.peek())!=null){&#xA;&#xA;                    final Frame cloneFrame = videoQueue.poll();&#xA;                    final Image image = converter.convert(cloneFrame);&#xA;                    final long timeStampDeltaMicros = cloneFrame.timestamp - timer.elapsedMicros();&#xA;                    if (timeStampDeltaMicros > 0) {&#xA;                        final long delayMillis = timeStampDeltaMicros / 1000L;&#xA;                        try {&#xA;                            Thread.sleep(delayMillis);&#xA;                        } catch (InterruptedException e) {&#xA;                            Thread.currentThread().interrupt();&#xA;                        }&#xA;                    }&#xA;&#xA;                    cloneFrame.close();&#xA;                    System.out.println("submitted image");&#xA;                videoListener.submitData(image);&#xA;                }&#xA;            }catch (NullPointerException e){&#xA;                NullPointerException ex = new NullPointerException("Error while processing video frames.");&#xA;            videoListener.notifyFailure(ex);&#xA;            }&#xA;&#xA;            processingVideo.set(false);&#xA;&#xA;        });&#xA;    }&#xA;

    &#xA;

    I sent the whole method for a bit more context but realistically speaking the only part that is of real significance is the converter.conver(cloneFrame) ; I used the intelliJ profiler and also the debugger and this is exactly where the problem occurs. When convert is called after doing some stuff it eventually ends up in this method :

    &#xA;

            public <t extends="extends" buffer="buffer"> void getPixels(int x, int y, int w, int h, WritablePixelFormat<t> pixelformat, T buffer, int scanlineStride) {&#xA;            int fss = this.frame.imageStride;&#xA;            if (this.frame.imageChannels != 3) {&#xA;                throw new UnsupportedOperationException("We only support frames with imageChannels = 3 (BGR)");&#xA;            } else if (!(buffer instanceof ByteBuffer)) {&#xA;                throw new UnsupportedOperationException("We only support bytebuffers at the moment");&#xA;            } else {&#xA;                ByteBuffer bb = (ByteBuffer)buffer;&#xA;                ByteBuffer b = (ByteBuffer)this.frame.image[0];&#xA;&#xA;                for(int i = y; i &lt; y &#x2B; h; &#x2B;&#x2B;i) {&#xA;                    for(int j = x; j &lt; x &#x2B; w; &#x2B;&#x2B;j) {&#xA;                        int base = 3 * j;&#xA;                        bb.put(b.get(fss * i &#x2B; base));&#xA;                        bb.put(b.get(fss * i &#x2B; base &#x2B; 1));&#xA;                        bb.put(b.get(fss * i &#x2B; base &#x2B; 2));&#xA;                        bb.put((byte)-1);&#xA;                    }&#xA;                }&#xA;&#xA;            }&#xA;        }&#xA;</t></t>

    &#xA;

    Now, everything up until this point is fine. The memory usage is at around 130mb but alas, when execution enters in these 2 for loops that's where the downright stupid memory usage occurs. Every single one of these bb.put calls is netting me around 3 more megabytes of memory usage. By the end of it you can probably guess what happens. Also all of these memory allocations do happen on the stack so I'm assuming that's why my memory usage stops at around 8-8.5 gigabytes otherwise the program would crash (that has also happened, out of memory exception thrown, but it doesn't usually happen, it kind of just lingers at those 8 gigabytes.) Frankly speaking I'm at a bit of a loss. I haven't seen virtually anyone anywhere mention this ever and I ran out of things to try to fix this so I am making this post.

    &#xA;

    By the way another thing I tried is make the ExecutorService in the same class as the main method and when I submitted there I also didn't have these memory problems.

    &#xA;