Commit afce4d05 by Pragati Upadhyay

tutor shot video play on firefox

parent 10145df2
......@@ -42,9 +42,9 @@ module.exports.generateVideo = async function (req, res) {
let imageDir = TEMP_IMAGE_DIR
let imagePathString = path.join(imageDir, `${tutorShotData._id}_%d.png`)
videoPath = path.join(TEMP_VIDEO_DIR, `${tutorShotData._id}.mp4`)
videoPath = path.join(TEMP_VIDEO_DIR, `${tutorShotData._id}.webm`)
thumbnailPath = path.join(TEMP_IMAGE_DIR, `${tutorShotData._id}_thumbnail`)
fileName = `${tutorShotData._id}.mp4`
fileName = `${tutorShotData._id}.webm`
thumbnailName = `${tutorShotData._id}_thumbnail.png`
// // this is to generate each individual images and get their buffers
......@@ -116,8 +116,9 @@ module.exports.generateVideo = async function (req, res) {
socket.emit("videoGenerationProgress", socketPayload)
let audioPath = path.join(TEMP_AUDIO_DIR, `ts-${tutorShotData._id}.mp3`); // path to only audio
await createAudio(tutorShotData.audio, audioPath)
finalVideoPath = path.join(TEMP_VIDEO_DIR, `ts-final-${tutorShotData._id}.mp4`); // path to combined video and audio
finalVideoPath = path.join(TEMP_VIDEO_DIR, `ts-final-${tutorShotData._id}.webm`); // path to combined video and audio
await joinAudioVideo(videoPath, audioPath, finalVideoPath)
videoPath = finalVideoPath;
} else {
socketPayload.percent = 99
socketPayload.subTask[0].percent = 99
......
......@@ -63,7 +63,6 @@ module.exports.createVideoFromImages = async function (imageArr, options) {
////// to delete the frames that are created //////
if (deleteImages)
frames.forEach((filePath) => {
console.log("🚀 ~ frames.forEach ~ filePath:", filePath)
fs.access(filePath, fs.constants.F_OK, (err) => {
if (!err) {
// File exists, proceed with deletion
......@@ -92,15 +91,15 @@ module.exports.createVideoFromImages = async function (imageArr, options) {
module.exports.joinAudioVideo = async function (videoPath, audioPath, output) {
return new Promise((res, rej) => {
ffmpeg()
.input(videoPath)
.input(audioPath)
.output(output)
.on('end', () => {
res(output)
})
.on('error', (err) => {
rej(err)
})
.input(videoPath)
.input(audioPath)
.output(output)
.run()
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment