Ffmpeg conflict running in different processes

Asked

Viewed 45 times

0

I have a nodejs server that does some manipulations with audio files, using the Fluent-ffmpeg library, but when concatenating some files using the function:

    ffmpeg('./public/uploads/'+tmpFilename)
    .input(path+newTmpName)
    .complexFilter([
        'acrossfade=d='+fade+':o=1:c1=tri:c2=tri'
    ])
    .on('end', () =>{

        deleteArray.push(newTmpName);
        deleteArray.push(tmpFilename);

        deleteFiles(deleteArray).then(() =>{
            parentPort.postMessage(newFilename);
        }).catch((error)=>{
            console.log('erro ao apagar os arquivos temporarios');
            throw new Error(error);
        })

    })
    .on('error', (error) =>{
        console.log('erro na concatenação das partes: '+ error)
        throw new Error(error);
    })
    .saveToFile('./public/uploads/'+newFilename);

Everything works fine when I run a single instance, if I test with more users (or even multiple tabs in the same browser) it generates with the wrong time, seeming that there is a kind of conflict between the processes running. But everywhere I look, they show that it is possible to run several processes without conflict.

  • tmpFilename is guaranteed to be unique? How do you generate it?

  • is concatenated a string uuid(v4) at the end of tmpFilename, tmpFilename = 'tmpFile'+counter+uuidv4()+'.wav';

  • 1

    The uuid no warranty, it will depend on the user and situation. Instead try: https://www.npmjs.com/package/temp.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.