Recherche avancée

Médias (91)

Autres articles (32)

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

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (4745)

  • Why does the video lose few seconds after FFMPEG xfade ?

    25 août 2023, par promaxdev

    I am having a use case where I need to add a few xfade transitions to an existing video at uniform intervals. I followed an approach almost similar to the one explained in the official document here and the SO reply here

    


    Here is the command that I use.

    


    ffmpeg 
-i clean_0.mp4 
-filter_complex "[0] split = 8[i1][i2][i3][i4][i5][i6][i7][i8]; 
    [i1]select='between(t\,0.0\,3.75)',setpts='PTS-STARTPTS'[i11]; 
    [i2]select='between(t\,3.75\,7.5)',setpts='PTS-STARTPTS'[i22]; 
    [i3]select='between(t\,7.5\,11.25)',setpts='PTS-STARTPTS'[i33]; 
    [i4]select='between(t\,11.25\,15.0)',setpts='PTS-STARTPTS'[i44]; 
    [i5]select='between(t\,15.0\,18.75)',setpts='PTS-STARTPTS'[i55]; 
    [i6]select='between(t\,18.75\,22.5)',setpts='PTS-STARTPTS'[i66]; 
    [i7]select='between(t\,22.5\,26.25)',setpts='PTS-STARTPTS'[i77]; 
    [i8]select='between(t\,26.25\,30.0)',setpts='PTS-STARTPTS'[i88]; 
    [i11][i22]xfade=duration=1:offset=2.75:transition=dissolve [c1]; 
    [i33][i44]xfade=duration=1:offset=2.75:transition=distance [c2]; 
    [i55][i66]xfade=duration=1:offset=2.75:transition=fadegrays [c3]; 
    [i77][i88]xfade=duration=1:offset=2.75:transition=pixelize [c4]; 
    [c1][c2][c3][c4]concat=n=4:v=1:a=0 " 
-pix_fmt yuv420p -y clean_out.mp4 


    


    (The above code is executed in a single line broken down for ease of understanding.)

    


    What this does is splits the input video in to parts of equal length in duration and and inserts xfade effects in between and the concats them. So the net effect would be the original video with xfade effects added.

    


    The input video is 30 seconds in length and has 25 fps. But the output video is 26 seconds.

    


    Here are my analysis so far.

    


      

    • the no. of seconds reduced with each added transition. i.e. when 5 transitions are provided, the output video reduces to 25 seconds
    • 


    • ffprobe at different stages below

        

      • i1, i2,... being copies of input video had 750 frames @ 25fps ie 30 seconds
      • 


      • i11, i22,... -> had 94 frames @ 25fps resulting in 3.76 seconds (3.76 X 8 = 30.08s)
      • 


      • c1, c2,.. -> had 163 frames @ 25fps resulting in 6.52 seconds (6.52 X 4 = 26.08s)
      • 


      


    • 


    • Enabling trace on ffmpeg showed different filters like 'Parsed_select_', 'Parsed_setpts_' and 'Parsed_xfade_', 'Parsed_concat_' corresponding to the 'select', 'setpts', 'xfade' and concat filters and there was another 'auto_scale_' auto inserted by ffmpeg. But details were found only for Parsed_select_ and Parsed_setpts_* filters in rest of the logs. There was no other trace of Parsed_xfade_* filters. So not much info from there
    • 


    


    End result is concat of all c* videos resulting in reduced duration

    


    So we can infer that xfade is causing some frames to be lost. (or I am doing it wrong) I need help to find the reason for the reduction in the duration of the final video and fix it.Also, Is there a way to log Xfade trace ?

    


  • C program cannot find function which included in header file

    17 juin 2013, par Juneyoung Oh

    I made program like this.

     1 #include
     2 #include
     3 #include
     4 #include "libavformat/avformat.h"
     5
     6 int main (int argc, char* argv[]){
     7         av_register_all();
     8         return 0;
     9 }

    My header file located in

    root@ubuntu:/home/juneyoungoh/getDuration# find / -name "avformat.h"
    /root/ffmpeg/libavformat/avformat.h
    /usr/local/include/libavformat/avformat.h

    then I run with gcc getDuration.c , but I show message like below.

    root@ubuntu:/home/juneyoungoh/getDuration# gcc getDuration.c
    /tmp/ccwjonqH.o: In function `main':
    getDuration.c:(.text+0x10): undefined reference to `av_register_all'
    collect2: ld returned 1 exit status

    Frankly, I do not have any idea what makes this.

    Thanks for your answers.

    ========================== edited #1 ===========================

    when I "ls /usr/local/lib", I get this.

    root@ubuntu:/home/juneyoungoh/getDuration# ls /usr/local/lib/
    libavcodec.a   libavutil.a    libopus.la       libvpx.a   python2.7
    libavdevice.a  libfdk-aac.a   libpostproc.a    libx264.a
    libavfilter.a  libfdk-aac.la  libswresample.a  libyasm.a
    libavformat.a  libopus.a      libswscale.a     pkgconfig

    you can see libavformat.a in the very first of the last line.

    so if I command like what you suggest, I get below.

    /root/ffmpeg/libavformat/vqf.c:244: undefined reference to `av_free_packet'
    /usr/local/lib//libavformat.a(vqf.o): In function `add_metadata':
    /root/ffmpeg/libavformat/vqf.c:58: undefined reference to `av_malloc'
    /root/ffmpeg/libavformat/vqf.c:64: undefined reference to `av_dict_set'
    /usr/local/lib//libavformat.a(vqf.o): In function `vqf_read_header':
    /root/ffmpeg/libavformat/vqf.c:148: undefined reference to `av_dict_set'
    /root/ffmpeg/libavformat/vqf.c:208: undefined reference to `av_log'
    /root/ffmpeg/libavformat/vqf.c:216: undefined reference to `av_malloc'
    /root/ffmpeg/libavformat/vqf.c:170: undefined reference to `av_log'
    /root/ffmpeg/libavformat/vqf.c:121: undefined reference to `av_log'
    /root/ffmpeg/libavformat/vqf.c:184: undefined reference to `av_log'
    /root/ffmpeg/libavformat/vqf.c:136: undefined reference to `av_log'
    /usr/local/lib//libavformat.a(wavenc.o): In function `wav_write_trailer':
    /root/ffmpeg/libavformat/wavenc.c:210: undefined reference to `av_rescale'
    /usr/local/lib//libavformat.a(wavenc.o): In function `wav_write_packet':
    /root/ffmpeg/libavformat/wavenc.c:181: undefined reference to `av_log'

    It is too long, so I just post little part of that.

    I think all link of libavformat has been broken, But I do not know

    what can I do to fix that link.

    I have installed that their official link said.

    https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideQuantal

  • Creating GIF with FFMPEG in AWS Lambda creates an empty gif ?

    29 décembre 2020, par blablubla12

    I'm trying to create a gif using an existing command (which I have no idea what it's doing as I don't really understand ffmpeg). That command worked perfectly on a C# Console App (as a string), however once I migrated to AWS Lambda (Node.js 12.x - which I'm also new at) it uploads an empty gif (0 B). Here is a part of the code :

    


    const bucket = eventObject.BucketName;
const srcKey = eventObject.ObjectKey;
const target = s3.getSignedUrl('getObject', { Bucket: bucket, Key: srcKey, Expires: 1000 });
const overlayTarget = s3.getSignedUrl('getObject', { Bucket: bucket, Key: 'overlays/overlay.png', Expires: 1000 });
const fileName = guid + "_gif.gif";
const tempPath = '/tmp/' + fileName;

function CreateGif() {
    return new Promise((resolve, reject) => {

        const ffmpeg = spawn(ffmpegPath, [
            "-ss",
            eventObject.GifTimecode,
            "-i",
            target,
            "-i",
            overlayTarget,
            "-filter_complex",
            `[0:v] trim = duration = ${eventObject.GifDuration}, setpts = PTS - STARTPTS, scale = 450:-1[trimmed]; [trimmed] split[trimmed1][trimmed2];     [trimmed2] reverse[rev];     [trimmed1] [rev] concat=n=2:v=1:a=0 [v];     [v] [1:v] overlay=0:0:format=rgb[overlayed];     [overlayed] split[a][b];     [a] palettegen=stats_mode=diff[palette];     [b] [palette] paletteuse=bayer:bayer_scale=3.5[out] `,
            "-map",
            '[out]',
            tempPath
        ]);

        ffmpeg.stderr.setEncoding('utf8');
        ffmpeg.stderr.on('data', (data) => {
            console.log(data);
        });

        ffmpeg.on('close', function (code) {
            console.log('closed');
            resolve();
        });

        ffmpeg.on('error', function (err) {
            console.log(err);
            reject();
            throw new Error(err);
        });
    });
}

function uploadToS3() {
    return new Promise((resolve, reject) => {
        let tmpFile = createReadStream(tempPath);

        var params = {
            Bucket: bucket,
            Key: 'gifs/' + fileName,
            Body: tmpFile,
            ContentType: `image/gif`
        };

        s3.upload(params, function (err, data) {
            if (err) {
                console.log(err);
                reject();
            }
            console.log(`successful upload to ${bucket}/${fileName}`);
            resolve();
        });
    });
}

await CreateGif();
await uploadToS3();


    


    I'm sure the issue is the args that are being passed, however I've not found a way to separate the args in the array in a way that works.

    


    Here's the same command in C# (this one works fine) :

    


    var command = "-ss " + timeCode + " -i "
                  + "\"" + videoPath + "\""
                  + " -i "
                  + "\"" + path + "/" + imageOverlayFilePath + "\" "
                  + " -filter_complex "
                  + "\""
                  + $"[0:v] trim = duration = {gifDuration}, setpts = PTS - STARTPTS, scale = 450:-1[trimmed]; [trimmed] split[trimmed1][trimmed2];     [trimmed2] reverse[rev];     [trimmed1] [rev] concat=n=2:v=1:a=0 [v];     [v] [1:v] overlay=0:0:format=rgb[overlayed];     [overlayed] split[a][b];     [a] palettegen=stats_mode=diff[palette];     [b] [palette] paletteuse=bayer:bayer_scale=3.5[out] "
                  + "\""
                  + " -map [out] "
                  + "\"" + output + "\"";


    


    How do I separate the command string in the args array spawn(ffmpegPath, [])