Recherche avancée

Médias (0)

Mot : - Tags -/organisation

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

Autres articles (68)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • 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 ;

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

  • How can I use ffmpeg to create a seamless looping gif ? [closed]

    27 juin 2024, par DavidNyan10

    I have an MP4 file which contains animation repeating in a loop. Let's just say, for example, a video of rain. However, when loop is turned on, the video cuts off at the wrong place and does not make a nice smooth animation. The part where it loops is obvious. It's just that the video contains more than one cycle of the loop, but not an exact integer of the full cycle.

    


    My goal is to turn this video into a gif with a seamless loop. In other words, I want the last frame of the video to match the first frame.

    


    My approach : I found a "Seamless loop creator" website on Google, tried it out, and it worked REALLY well. I thought all my problems have been solved. But little did I know, I've been only looking at the few seconds at the beginning and at the end of the video, not paying attention to what's in the middle. The sneaky pesky little website cuts off the video right in the middle, stitch the "seamless transition" at the beginning and end of the video, and put an ugly cross-fade in the middle where the frames don't line up. That is stupid. This of course, isn't noticable on rain videos, but on videos like a character jumping, the crossfade is very visible.

    


    My second approach : I'd use FFMPEG to get the first frame of the video, then starting from the last frame of the video and backwards, it'd try to find a frame that matches exactly with the first frame.

    


    Steps :

    


      

    1. Get the first frame and save it as a PNG or something I don't know
    2. 


    3. Reverse the original video
    4. 


    5. Match the image to each frame of the video in step 2. It is now easier because it's not doing it backwards frame by frame.
    6. 


    7. When a frame match is found, cut off all the frames before this matched frame.
    8. 


    9. Reverse back the video
    10. 


    


    Can I achieve something like this in ffmpeg, preferably a one-liner in windows cmd ?

    


    Follow-up question : Would it be better to leave the last frame the same as first frame or should I remove it ? For example, when it's looping, it would repeat that exact frame two times, is that good ? Or which one provides better results ? And if it's better to not include the last frame (the one that matches), how would I do it in my process above ?

    


    I tried ChatGPT, expecting a ready-made code. Put it in the command prompt and lost my original video file. Had to use a recovery tool because the file was overwritten.

    


  • How to get webam frames one by one but also compressed ?

    29 mars, par Vorac

    I need to grab frames from the webcam of a laptop, transmit them one by one and the receiving side stitch them into a video. I picked ffmpeg-python as wrapper of choice and the example from the docs works right away :

    


    #!/usr/bin/env python

# In this file: reading frames one by one from the webcam.


import ffmpeg

width = 640
height = 480


reader = (
    ffmpeg
    .input('/dev/video0', s='{}x{}'.format(width, height))
    .output('pipe:', format='rawvideo', pix_fmt='yuv420p')
    .run_async(pipe_stdout=True)
)

# This is here only to test the reader.
writer = (
    ffmpeg
    .input('pipe:', format='rawvideo', pix_fmt='yuv420p', s='{}x{}'.format(width, height))
    .output('/tmp/test.mp4', format='h264', pix_fmt='yuv420p')
    .overwrite_output()
    .run_async(pipe_stdin=True)
)


while True:
    chunk = reader.stdout.read(width * height * 1.5)  # yuv
    print(len(chunk))
    writer.stdin.write(chunk)


    


    Now for the compression part.

    


    My reading of the docs is that the input to the reader perhaps needs be rawvideo but nothing else does. I tried replacing rawvideo with h264 in my code but that resulted in empty frames. I'm considering a third invocation looking like this but is that really the correct approach ?

    


    encoder = (                                                                     
    ffmpeg                                                                      
    .input('pipe:', format='rawvideo', pix_fmt='yuv420p', s='{}x{}'.format(width, height))
    .output('pipe:', format='h264', pix_fmt='yuv420p')                          
    .run_async(pipe_stdin=True, pipe_stdout=True)                               


    


  • Processing Video Frames in C# (FFMPEG Slow)

    9 septembre 2020, par julian bechtold

    I am trying to extract frames out of mp4 videos in order to process them.

    


    Namely there is a watermark / timestamp within the video image which I want to use to automatically stitch the videos together. The Video creation date is not sufficient for this task.
enter image description here

    


    Also the part of extracting the text out of the video with AI is fine.

    


    However, FFMPEG seems terribly slow. the source Video is 1080p / 60fps (roughly 1GB per 5 Minutes of video).

    


    I have tried two methods so far using Accord.FFMPEG wrapper :

    


    public void GetVideoFrames(string path)
{
    using (var vFReader = new VideoFileReader())
    {
        // open video file
        vFReader.Open(path);
        // counter is beeing used to extract every xth frame (1 Frame per second)
        int counter = 0;
        for (int i = 0; i < vFReader.FrameCount;i ++)
        {
            counter++;
            if (counter <= 60)
            {
                _ = vFReader.ReadVideoFrame();
                continue;
            }
            else
            {
                Bitmap frame = vFReader.ReadVideoFrame();
                // Process Bitmap
            }
        }
    }
}


    


    The other attempt :

    


    for (int i = 0; i < vFReader.FrameCount;i+= 60)
{
    // notice here, I am specifying which exact frame to extract
    Bitmap frame = vFReader.ReadVideoFrame(i);
    // process frame
}


    


    The second method is what I tried first and it's totally unfeasible. Apparently FFMPEG makes a new seek for each specific frame and thus the operation takes longer and longer for each frame processed.
After 5 frames already, it takes roughly 4 seconds to produce one Frame.

    


    The first method at least does not seem to suffer from that issue as heavily but it still takes roughly 2 seconds to yield a frame. At this rate i'm faster to process the video manually.

    


    Is there anything wrong with my approach ? Also I rather don't want to have a solution where I need to separately install third party libraries on the target machine.
So, if there are any alternatives, I'd be happy to try them out but it seems litterally everyone on stack overflow is either pointing to ffmpeg or opencv.