Recherche avancée

Médias (0)

Mot : - Tags -/navigation

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

Autres articles (35)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (2798)

  • Add a seconds counter text to a sliced video with ffmpeg that starts from 0

    16 mars 2024, par virtualdj

    I'm trying to convert a small part of a screen recording video into a GIF with ffmpeg. I would like to add a seconds counter on it as the frame rate of the GIF file is reduced, so I can guess the time passing from the counter.

    


    Normally, assuming to start at 43 seconds and cutting after 33 seconds, the example video would have been encoded to GIF with :

    


    ffmpeg -i in.mp4 -vf "scale=300:-1,fps=5,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -ss 43 -t 33 out.gif


    


    To print the timecode, I add the following after fps=5, :

    


    drawtext=text='%{pts\:hms}':font='Arial':fontcolor=red:fontsize=14:x=(w-text_w)/2:y=(h-text_h-6),


    


    Doing so, prints a timecode on the output that starts from 00:00:43.000, not from zero. Similarly the timecode option :

    


    drawtext=text='':font='Arial':fontcolor=red:fontsize=14:x=(w-text_w)/2:y=(h-text_h-6):timecode='00\:00\:00\:00':timecode_rate=5,


    


    will ouput 00:00:43:0. There doesn't seem to have a way to use the "output" timecode (that starts from 0) ; also, I would like to have the seconds only.

    


    How can I do that ?

    


  • Extract 5 seconds of a mp4 video for every 60 seconds of the video [duplicate]

    8 mars 2024, par transientflaw

    I'm trying to write a batch script with ffmpeg that takes every mp4 files in a folder, extracts 5 seconds out of them at 2 seconds after the start of the video, and then, if the original video lasts longer than 60 seconds, as well as that first segment, it takes another 5 seconds segment for every 60 seconds until it cannot because there are not enough seconds to segment.

    


    Is it clear ?

    


    I've tried this code

    


    @echo off

rem Set input and output directories
set "input_dir=C:\Users\Lex\Desktop\vtrip"
set "output_dir=C:\Users\Lex\Desktop\vtrip\output"

rem Loop through all MP4 files in the input directory
for %%I in ("%input_dir%\*.mp4") do (
    rem Extract 5 seconds starting 2 seconds after the start of the video
    ffmpeg -i "%%I" -ss 2 -t 5 "%output_dir%\temp_segment_1_%%~nI.mp4"

    rem Get total duration of the video
    for /f "tokens=*" %%a in ('ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "%%I"') do set "duration=%%a"

    rem Check if the duration exceeds 60 seconds
    if !duration! GTR 60 (
        rem Calculate the number of segments
        set /a "num_segments=!duration!/62"
        
        rem Extract 5-second segments every 62 seconds
        set /a "start_time=64"  REM Start from 2 seconds after the first segment
        for /l %%x in (2,1,!num_segments!) do (
            ffmpeg -i "%%I" -ss !start_time! -t 5 "%output_dir%\temp_segment_%%x_%%~nI.mp4"
            set /a "start_time+=62"
        )
    )
)



    


    I've tried it on 3 files, the 2 that are under 1 minute are fine but there is one that lasts 2m29 and it only extracts 1 segment for that last one whereas it should extract 3 5-seconds segments for this one video.

    


    Any way to fix that ?

    


  • Converting an audio file from .oga format to .mp3 using ffmpeg package on nodeJs produces a max of 3 seconds output file no matter the input duration

    15 janvier 2024, par JnrLouis

    I am downloading an audio file in .oga format and saving it. Then I am trying to convert the file to .mp3 format, but the issue is the output file is always truncated and a maximum of 3 seconds. I have gone through the fluent-ffmpeg library and I can't seem to find what I'm doing wrong.

    


    I have ffmpeg installed and I'm using the fluent-ffmpeg library. The downloaded .oga file doesn't seem to have any issues, the issue is after it gets converted to .mp3.

    


    I also tried converting to .wav, and I faced the same issue.

    


    Below is my current code :

    


    const fs = require("fs");
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
const axios = require("axios");

const inputPath = __dirname + '/audio/input.oga';
const outputPath = __dirname + '/audio/output.mp3';

const saveVoiceMessage = async (url) => {
    try {
        const response = await axios({
            method: 'GET',
            url: url,
            responseType: 'stream'
        });
        const inStream = fs.createWriteStream(inputPath);
        await response.data.pipe(inStream);
    } catch (error) {
        console.error(error);
    }
}

const convertToMp3 = async () => {
    try {
        const outStream = fs.createWriteStream(outputPath);
        const inStream = fs.createReadStream(inputPath);
        // I also tried using the inputPath directly, still didn't work
        ffmpeg(inStream)
            .toFormat("mp3")
            .on('error', error => console.log(`Encoding Error: ${error.message}`))
            .on('exit', () => console.log('Audio recorder exited'))
            .on('close', () => console.log('Audio recorder closed'))
            .on('end', () => console.log('Audio Transcoding succeeded !'))
            .pipe(outStream, { end: true })
    } catch (error) {
        console.error(error);
    }
}

const saveAndConvertToMp3 = async (url) => {
    try {
        await saveVoiceMessage(url);
        await convertToMp3();
        }

    } catch (error) {
        console.error(error);
    }
}