Recherche avancée

Médias (0)

Mot : - Tags -/api

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

Autres articles (102)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (7842)

  • Ffmpeg Error : Error opening output file .output_withsrt.mp4

    13 juin 2024, par Priyanshu Tiwari

    I'm building a video caption writer web app, for embedding subtitle in a video I'm using ffmpeg.

    


    But there is a error opening output file, everything is working fine in a cmd, but in VS Code it's not working.

    


    My code :

    


    import ffmpeg from "fluent-ffmpeg";&#xA;import { NextRequest } from "next/server";&#xA;&#xA;ffmpeg.setFfmpegPath(&#x27;C:\\ffmpeg\\bin\\ffmpeg.exe&#x27;)&#xA;&#xA;export async function POST(req: NextRequest) {&#xA;  try {&#xA;    const videoWithSubtitlesPath = path.join(&#xA;      process.cwd(),&#xA;      "public",&#xA;      "subtitle_video.mp4"&#xA;    );&#xA;&#xA;    console.log(videoWithSubtitlesPath)&#xA;    console.log("yaha tak");&#xA;&#xA;    await embedSubtitle(&#xA;      "http://res.cloudinary.com/dptgkunzk/video/upload/v1717785028/w8ezkazwhsqbyx7f34rw.mp4",&#xA;      "@/public/srtfile/output.srt",&#xA;      "./public/srtfile/giveme.mp4"&#xA;    );&#xA;&#xA;    console.log("calling")&#xA;  } catch (error) {&#xA;    console.log("Something went wrong while adding subtitle");&#xA;  }&#xA;&#xA;  return Response.json({ message: "done" });&#xA;}&#xA;&#xA;async function embedSubtitle(videopath: string, srtFilePath: string, outputPath: string): Promise<any>{&#xA;  if(!videopath || !srtFilePath || !outputPath) return false&#xA;&#xA;  try {&#xA;    await new Promise<void>((resolve, reject) => {&#xA;      ffmpeg()&#xA;      .input(videopath)&#xA;      .videoFilters(`subtitles = ${srtFilePath} : force_style=&#x27;Fontsize=24&#x27;`)&#xA;      .output("./output_withsrt.mp4")&#xA;&#xA;      .on("end", () => {&#xA;        console.log("Subtitle added successfully");&#xA;        resolve()&#xA;      })&#xA;&#xA;      .on("error", (err, stderr) => {&#xA;        console.error("Error during conversion and subtitle adding", err)&#xA;        console.error("stderr", stderr)&#xA;        reject(err);&#xA;      })&#xA;      .run()&#xA;    })&#xA;    return true&#xA;  } catch (error) {&#xA;    console.log("error while embedding subtile in a vidoe")&#xA;    }&#xA;}&#xA;</void></any>

    &#xA;

    Error :

    &#xA;

    &#xA;

    ffmpeg exited with code 4294967294 : Error opening output file ./output_withsrt.mp4.
    &#xA;Error opening output files : No such file or directory

    &#xA;

    &#xA;

    Kindly help

    &#xA;

  • I am trying to trim a Video, I can perform trimming Operation.I am not able to get response from node js.

    28 mars 2017, par Sumit Sarkar

    This is my block of code from index.js

    router.get(’/trimVideo’, function(req, res, next)
    res.set(
    "Content-Type" :"text/json"
    ) ;

    try{
    var inputDirectory = opts.videoDir+'/'+req.query.videoName;
    var outputDirectory = opts.videoDir+'/trim/'+'Trimmed_'+req.query.videoName;
    ffmpeg()
       .input(inputDirectory)
       .format('mp4')
       .seekInput(req.query.StartTrimTime)
       .duration(req.query.EndTrimTime)
       .on('start', function(cmd){
           console.log('Started' + cmd)
       })
       .on('error', function(err){
           console.log('An error occured: ' + err.message)
       })
       .output(outputDirectory)
       .on('end',function(){
           fs.createReadStream(outputDirectory).pipe(fs.createWriteStream(opts.videoDir+'/'+req.query.videoName));
           console.log('Finished Encoding');

           res.write(JSON.stringify({ OK: 1 }));
           res.end();
       })
       .run();
    }

    catch(error){
       res.write(JSON.stringify({ OK: 0 }));
       res.end();
    }

    ) ;

    This is my block of code for ajax call

    $.ajax(
    type : "GET",
    url : "/trimVideo",
    data :
    StartTrimTime : startTime,
    EndTrimTime : endTime,
    videoName : name
    ,
    dataJson : ’json’,
    success : function(data)
    console.log(’success’) ;
    console.log(JSON.stringify(data)) ;

    )

  • Moving .wav files from S3 to /tmp folder in AWS Lambda

    1er août 2019, par sleepyrobot

    I am currently trying to overlay two .wav files from S3 in AWS Lambda using FFMPEG. I am using node.js to do this. Here’s my process :

    1. Retrieve the files from S3, and save it to the Lambda /tmp folder
    2. Merge the two audio files, and save the output to the /tmp folder
    3. Upload the output from /tmp folder to S3.

    However, I am encountering errors on the first part, since the .wav files being downloaded are corrupted and distorted.

    I have tried using streams for this. However, I am still grasping its concept. I would appreciate any help. For my first try, I tried to retrieve an object from S3 and reupload the same

    I have tried using function for getting the audio file from S3 :

    async function readIn(bucketName, inputFilename, transfer, local) {
       console.log('reading in locally?', local);
       console.log(`reading from ${inputFilename} to ${transfer}`);

    // inputFilename is the key name (object name)
    // transfer is the filepath to where the obj will be transferred to (example: /tmp/audio1.wav)

       const writeStream = fs.createWriteStream(transfer);
       var file;

       local? await new Promise((resolve, revoke) => {
           file = fs.createReadStream(inputFilename);
           writeStream.on('finish', () => {
               console.log('file finished reading');
               resolve();
           });
           writeStream.on('error', (err) => {
               console.log('things messed up');
               revoke();
           });
           file.pipe(writeStream);
       }) : await new Promise((resolve, revoke) => {
           writeStream.on('finish', () => {
               console.log('file finished reading');
               resolve();
           });
           writeStream.on('error', (err) => {
               console.log('things messed up');
               revoke();
           });
           s3.getObject({
               Bucket : bucketName,
               Key    : inputFilename
           }, function(err, data) {
               if (err) {
                   console.log(err, err.stack);
               } else {
                   console.log('data got!');
               }
           }).createReadStream().pipe(writeStream);
       });
       console.log('returning to main from reading');
       return;
    }

    For uploading the file to S3 :

    async function writeOut(bucketName, outFile, transfer, contentType) {

           console.log('uploading', bucketName, outFile, transfer);
           return s3.upload({
               Bucket: bucketName,
               Key: outFile,
               Body: fs.createReadStream(transfer),
               //ACL: 'private',
               ContentType: contentType
           }).promise();
    }

    For merging the files (I haven’t tried this yet) :

    async function mergeFile(transfer1, transfer2, output) {
       await new Promise((resolve, revoke) => {
           console.log('beginning merge');
           var outStream = fs.createWriteStream('/tmp/output.wav');

           childProcess.exec('cp /var/task/ffmpeg /tmp/.; chmod 755 /tmp/ffmpeg;',
           function (error, stdout, stderr) {
               if (error) {
                   console.log('[ERROR]: An error occured in altering FFMPEG permission: ', error);
               } else {
                  console.log("[SUCCESS]: Successfully altered FFMPEG permission!");
                  // merge audio files
                   ffmpeg('/tmp/audio1.wav')
                   .input('/tmp/audio2.wav')
                   .on('error', function(err) {
                   console.log('An error occurred with merging: ' + err.message);
                   })
                   .complexFilter(
                   {
                   filter: 'amix',
                   inputs: ['0:a','1:a']
                   })
                   .on('end', function() {
                   console.log('Merging finished!');
                   })
                   .pipe(outStream, { end: true });
                   //.save('/tmp/output.wav');
                   //////  
               }
           })
       });}

    However, the resulting file is corrupted. Is there any error in the functions ? Please help. Thanks !