Recherche avancée

Médias (0)

Mot : - Tags -/metadatas

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

Autres articles (79)

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

  • How to set up my complex filter with zoompan and xfade for ffmpeg using Fluent-FFmpeg .complexFilter method ?

    21 août 2024, par Rémy Groleau

    I'm using fluent-ffmpeg with Node.js. My problem is the setup of my complex filter.

    


    const filters = Array.from({ length: imageCount - 1 }).map((_, i) => {
        const rndInt = Math.floor(Math.random() * 1000) + 1

        return {
            zoompanFilter1: {
                filter: 'zoompan',
                options: {
                    z: 'min(zoom+0.001,1.3)',
                    d: `${imageDuration * 60}`, 
                    x: `iw/2-iw*(1/2-${rndInt}/100)*iw/zoom`, 
                    y: `ih/2-ih*(1/2-${rndInt}/100)*ih/zoom`, 
                    s: '1080x1920', // Output size
                    fps: '60'
                },
                inputs: `[${i}:v]`,
                outputs: `zoomed${i}`
            },
            zoompanFilter2: {
                filter: 'zoompan',
                options: {
                    z: 'min(zoom+0.001,1.3)', 
                    d: `${imageDuration * 60}`, 
                    x: 'iw/2-iw*(1/2-33/100)*iw/zoom',
                    y: 'ih/2-ih*(1/2-33/100)*ih/zoom',
                    s: '1080x1920', // Output size
                    fps: '60'
                },
                inputs: [`${i + 1}:v`],
                outputs: `zoomed${i + 1}`
            },
            xfadeFilter: {
                filter: 'xfade',
                options: {
                    transition: 'fade', // Crossfade transition effect
                    duration: '0.5', // Duration of crossfade in seconds
                    offset: `${imageDuration - 1}` // Offset to start the crossfade
                },
                inputs: [`zoomed${i + 1}`, `zoomed${i}`],
                outputs: `crossfaded${i}`
            },
        };
    });


    


    This is my complete code :

    


    async function createVideo() {
    // Escape file paths for Windows
    const videoPath = path.resolve(__dirname+ '/output.mp4').replace(/\\/g, '\\\\');
    const audioPath = path.resolve(__dirname+ '/output.mp3').replace(/\\/g, '\\\\');
    const backgroundMusicPath = path.resolve(__dirname+ '/background-music.mp3').replace(/\\/g, '\\\\');

    const command = ffmpeg();

    const imagesDir = path.join(__dirname, 'images');
    const images = fs.readdirSync(imagesDir)
        .filter(file => /.(jpg|jpeg|png)$/i.test(file)) // Filter image files
        .sort() // Sort filenames to ensure the correct order
        .map(file => path.join(imagesDir, file));

        images.map((image) => command.input(image))

    const imageCount = images.length;
    const audioDuration = await getAudioDurationInSeconds(audioPath);
    const imageDuration =  Math.round(audioDuration / imageCount)

    const filters = Array.from({ length: imageCount - 1 }).map((_, i) => {
        const rndInt = Math.floor(Math.random() * 1000) + 1

        return {
            zoompanFilter1: {
                filter: 'zoompan',
                options: {
                    z: 'min(zoom+0.001,1.3)', // Reset zoom to 1.0
                    d: `${imageDuration * 60}`, // Duration of the zoom effect
                    x: `iw/2-iw*(1/2-${rndInt}/100)*iw/zoom`, // Center x
                    y: `ih/2-ih*(1/2-${rndInt}/100)*ih/zoom`, // Center y
                    s: '1080x1920', // Output size
                    fps: '60'
                },
                inputs: `[${i}:v]`,
                outputs: `zoomed${i}`
            },
            zoompanFilter2: {
                filter: 'zoompan',
                options: {
                    z: 'min(zoom+0.001,1.3)', // Reset zoom to 1.0
                    d: `${imageDuration * 60}`, // Duration of the zoom effect
                    x: 'iw/2-iw*(1/2-33/100)*iw/zoom', // Center x
                    y: 'ih/2-ih*(1/2-33/100)*ih/zoom', // Center y
                    s: '1080x1920', // Output size
                    fps: '60'
                },
                inputs: [`${i + 1}:v`],
                outputs: `zoomed${i + 1}`
            },
            xfadeFilter: {
                filter: 'xfade',
                options: {
                    transition: 'fade', // Crossfade transition effect
                    duration: '0.5', // Duration of crossfade in seconds
                    offset: `${imageDuration - 1}` // Offset to start the crossfade
                },
                inputs: [`zoomed${i + 1}`, `zoomed${i}`],
                outputs: `crossfaded${i}`
            },
        };
    });

    command
    .input(audioPath)
    .input(backgroundMusicPath)
    .outputOptions([
        '-pix_fmt', 'yuv420p',
        '-c:v', 'libx264',
        '-c:a', 'aac',
        '-y',
        '-t', `${audioDuration}`,
        '-r', '60',
        '-s', '1080x1920',
        '-preset', 'ultrafast',
        '-map', '[final_video]',
        '-map', '[mixed_audio]',
    ])
    .complexFilter([
        // Apply zoompan filters and xfade transitions
        ...filters.flatMap(({ zoompanFilter1, zoompanFilter2, xfadeFilter }) => [
            zoompanFilter1,
            zoompanFilter2,
            xfadeFilter,
        ]),
        {
            filter: 'concat',
            options: {
                n: imageCount - 1, // Number of videos to concatenate
                v: 1, // Video streams
                a: 0 // No audio streams
            },
            inputs: filters.map((_, i) => `crossfaded${i}`),
            outputs: 'video_sequence'
        },
        {
            filter: 'curves',
            options: 'preset=increase_contrast',
            inputs: 'video_sequence',
            outputs: 'curves'
        },
        {
            filter: 'subtitles',
            options: `./subtitles.ass:fontsdir=./fonts/:force_style='FontName=Montserrat Black Italic,FontSize=17,MarginL=10,MarginV=25,Alignment=10,Spacing=0.2,Outline=0.1,Shadow=1.5'`,
            inputs: '[curves]',
            outputs: 'final_video'
        },
        {
            filter: 'volume',
            options: 0.3,  // Adjust the volume to 25% of the original
            inputs: `${imageCount + 1}:a`,
            outputs: 'background_music_adjusted'
        },
        // Apply the amix filter to mix the two audio inputs
        {
            filter: 'amix',
            options: {
                inputs: 2,
                duration: 'first',
                dropout_transition: 0,
                weights: '1 0.25',
                normalize: 0
            },
            inputs: [`${imageCount}:a`, 'background_music_adjusted'],
            outputs: 'mixed_audio'
        },
      ])
    .save(videoPath)
    .on('progress', function(progress) {
        console.log('Processing: ' + progress.percent + '% done');
      })
    .on('end', function(stdout, stderr) {
        // emptyFolder(imagesDir)
        console.log('Transcoding succeeded !');
      }) 
    .on('error', function(err) {
        console.error('Une erreur s\'est produite :', err.message);
    });
}


    


    My problem is I see the 1 image then the transition and i see the 2 image. After that I'm supposed to see the 3 image but I see the 2 image.

    


    What am I doing wrong ?

    


    I tried switching the inputs: [`zoomed${i + 1}`, `zoomed${i}`] to inputs: [`zoomed${i}`, `zoomed${i+1}`] but it just showed the next image and not a loop of consecutive images.

    


  • ffmpeg cannot open a simple microsoft wav file exported with Audacity

    18 février 2014, par sebpiq

    I have exported a sound file to microsoft wav using Audacity.
    I am trying to open this file with ffmpeg :

    ffmpeg -i steps-stereo-16b-44khz.wav /tmp/test.ogg

    and here's the ouput I get :

    fmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
     built on Jun 12 2013 13:46:11 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
     configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
     libpostproc    52.  2.100 / 52.  2.100
    [dca @ 0x7fd30c013600] Not a valid DCA frame

    ... SNIP ...

    [dca @ 0x7fd5bc013600] Invalid bit allocation index
    [dca @ 0x7fd5bc013600] error decoding block
       Last message repeated 3 times
    [dca @ 0x7fd5bc013600] Didn't get subframe DSYNC
    [dca @ 0x7fd5bc013600] error decoding block
    [wav @ 0x7fd5bc013000] max_analyze_duration 5000000 reached at 5009070 microseconds
    [wav @ 0x7fd5bc013000] decoding for stream 0 failed
    [wav @ 0x7fd5bc013000] Could not find codec parameters for stream 0 (Audio: dts ([1][0][0][0] / 0x0001), 192000 Hz, 2 channels, fltp, 0 kb/s): no decodable DTS frames
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    steps-stereo-16b-44khz.wav: could not find codec parameters

    If I export the same file to .ogg or .aiff, no problem, the following works fine :

    ffmpeg -i steps-stereo-16b-44khz.aiff /tmp/test.ogg

    Any idea what could be wrong ?

    A link to my wav file so you can try to reproduce.

    NB my final goal is to slice the audio file. I know I can export file directly to .ogg with audacity. This is just a test case.

    EDIT

    Getting file info with another program like sox, works well :

    sox --info steps-stereo-16b-44khz.wav

    Input File     : 'steps-stereo-16b-44khz.wav'
    Channels       : 2
    Sample Rate    : 44100
    Precision      : 16-bit
    Duration       : 00:00:02.10 = 92608 samples = 157.497 CDDA sectors
    File Size      : 370k
    Bit Rate       : 1.41M
    Sample Encoding: 16-bit Signed Integer PCM
  • ffmpef cannot open a simple microsoft wav file exported with Audacity

    23 juillet 2013, par sebpiq

    I have exported a sound file to microsoft wav using Audacity.
    I am trying to open this file with ffmpeg :

    ffmpeg -i steps-stereo-16b-44khz.wav /tmp/test.ogg

    and here's the ouput I get :

    fmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
     built on Jun 12 2013 13:46:11 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
     configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
     libpostproc    52.  2.100 / 52.  2.100
    [dca @ 0x7fd30c013600] Not a valid DCA frame

    ... SNIP ...

    [dca @ 0x7fd5bc013600] Invalid bit allocation index
    [dca @ 0x7fd5bc013600] error decoding block
       Last message repeated 3 times
    [dca @ 0x7fd5bc013600] Didn't get subframe DSYNC
    [dca @ 0x7fd5bc013600] error decoding block
    [wav @ 0x7fd5bc013000] max_analyze_duration 5000000 reached at 5009070 microseconds
    [wav @ 0x7fd5bc013000] decoding for stream 0 failed
    [wav @ 0x7fd5bc013000] Could not find codec parameters for stream 0 (Audio: dts ([1][0][0][0] / 0x0001), 192000 Hz, 2 channels, fltp, 0 kb/s): no decodable DTS frames
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    steps-stereo-16b-44khz.wav: could not find codec parameters

    If I export the same file to .ogg or .aiff, no problem, the following works fine :

    ffmpeg -i steps-stereo-16b-44khz.aiff /tmp/test.ogg

    Any idea what could be wrong ?

    A link to my wav file so you can try to reproduce.

    NB my final goal is to slice the audio file. I know I can export file directly to .ogg with audacity. This is just a test case.