dx0_
dx0_
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/22/2023 in #djs-voice
Have speaking's data
const inputFile = connection.receiver.subscribe(userId, receiverOptions);
const outputFile = fs.createWriteStream('./audio mp3.mp3');

const transcoder = new prism.FFmpeg({
args: [
'-i', 'pipe:0',
'-f', 'mp3',
'-q:a', '0',
'pipe:1'
]
});

inputFile.pipe(transcoder)
.pipe(outputFile)
.on('finish', () => {
console.log('Conversion terminée !');
})
.on('error', (err) => {
console.error('Une erreur s\'est produite lors de la conversion :', err);
});
const inputFile = connection.receiver.subscribe(userId, receiverOptions);
const outputFile = fs.createWriteStream('./audio mp3.mp3');

const transcoder = new prism.FFmpeg({
args: [
'-i', 'pipe:0',
'-f', 'mp3',
'-q:a', '0',
'pipe:1'
]
});

inputFile.pipe(transcoder)
.pipe(outputFile)
.on('finish', () => {
console.log('Conversion terminée !');
})
.on('error', (err) => {
console.error('Une erreur s\'est produite lors de la conversion :', err);
});
I did this but in the mp3 file, there is nothing
16 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/22/2023 in #djs-voice
Have speaking's data
I have this :
connection.receiver.speaking.on('start', async (userId) => {
const receiverOptions = {
mode: 'mp3',
end: {
behavior: EndBehaviorType.AfterSilence,
duration: 500
}
};

const t = connection.receiver.subscribe(userId, receiverOptions);
const decoder = new prism.opus.Decoder({
channels: 2,
rate: 48000,
frameSize: 960,
});

const outputFileStream = fs.createWriteStream('audio_output.mp3');
t.pipe(decoder).pipe(outputFileStream);


})
connection.receiver.speaking.on("end", async (data) => {
console.log(data)
})
connection.receiver.speaking.on('start', async (userId) => {
const receiverOptions = {
mode: 'mp3',
end: {
behavior: EndBehaviorType.AfterSilence,
duration: 500
}
};

const t = connection.receiver.subscribe(userId, receiverOptions);
const decoder = new prism.opus.Decoder({
channels: 2,
rate: 48000,
frameSize: 960,
});

const outputFileStream = fs.createWriteStream('audio_output.mp3');
t.pipe(decoder).pipe(outputFileStream);


})
connection.receiver.speaking.on("end", async (data) => {
console.log(data)
})
but I dont no how to convert in mp3 with fmmpeg
16 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/22/2023 in #djs-voice
Have speaking's data
i will see tomorow
16 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/22/2023 in #djs-voice
Have speaking's data
thanks br o
16 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/22/2023 in #djs-voice
Have speaking's data
I tried with an convert but its useless
16 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
Une erreur s'est produite lors de la conversion : Error: ffmpeg exited with code 1: pipe:0: Invalid data found when processing input
Une erreur s'est produite lors de la conversion : Error: ffmpeg exited with code 1: pipe:0: Invalid data found when processing input
rip
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
I try w/ ffmpeg
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
oh ok np
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
because this module may do not work at best
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
could you let me see an exemple with the best module please
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
Oh so :
const receiverOptions = {
mode: 'pcm',
end: { behavior: EndBehaviorType.AfterSilence, duration: 2000 }
};

const converter = ffmpeg()
.input(connection.receiver.subscribe(userId, receiverOptions))
.output(mp3File)
.audioCodec('libmp3lame')
.on('end', () => {
console.log('Conversion terminée.');
})
.on('error', (error) => {
console.error('Une erreur s\'est produite lors de la conversion :', error);
});

converter.run();
const receiverOptions = {
mode: 'pcm',
end: { behavior: EndBehaviorType.AfterSilence, duration: 2000 }
};

const converter = ffmpeg()
.input(connection.receiver.subscribe(userId, receiverOptions))
.output(mp3File)
.audioCodec('libmp3lame')
.on('end', () => {
console.log('Conversion terminée.');
})
.on('error', (error) => {
console.error('Une erreur s\'est produite lors de la conversion :', error);
});

converter.run();
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
receiver.on('data', (pcmData) => {
fs.appendFileSync(pcmFile, pcmData);
});
receiver.on('data', (pcmData) => {
fs.appendFileSync(pcmFile, pcmData);
});
I do this for the data. but idk how to pipe this and what's his utility
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
like :
receiver.on('end', () => {
console.log("test")
ffmpeg()
.input(pcmFile)
.output(mp3File)
.audioCodec('libmp3lame')
.on('end', () => {
console.log('Conversion terminée.');
fs.unlinkSync(pcmFile);
})
.on('error', (error) => {
console.error('Une erreur s\'est produite lors de la conversion :', error);
})
.run()

});
receiver.on('end', () => {
console.log("test")
ffmpeg()
.input(pcmFile)
.output(mp3File)
.audioCodec('libmp3lame')
.on('end', () => {
console.log('Conversion terminée.');
fs.unlinkSync(pcmFile);
})
.on('error', (error) => {
console.error('Une erreur s\'est produite lors de la conversion :', error);
})
.run()

});
?
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
I use ffmpeg to convert pcm to mp3 but it isn't working. Are there possibilities to have a mp3 check in immediatly ?
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
Thanks !
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
if I have good undertood, I must to define in a second parmeter this :
const receiver = connection.receiver.subscribe(userId, {
mode: 'pcm',
end: EndBehavior
});
const receiver = connection.receiver.subscribe(userId, {
mode: 'pcm',
end: EndBehavior
});
after, when the speaking will end, It will collect my speaking and convert it in mp3 format ?
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
oh okay
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
okay and after how to stop the subscriber to enter in the receiver.on("end" ? and collect my speak to convert the pcm to mp3 ?
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
Ok I try
30 replies
DIAdiscord.js - Imagine an app
Created by dx0_ on 6/4/2023 in #djs-voice
subscribe a connection and convert pcm buffer response to mp3
connection.receiver.unsubscribe()
30 replies