Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
begenieus-jobs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramdayal Munda
begenieus-jobs
Commits
afce4d05
Commit
afce4d05
authored
Apr 03, 2024
by
Pragati Upadhyay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tutor shot video play on firefox
parent
10145df2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
16 deletions
+15
-16
tutor-shot.js
controller/tutor-shot.js
+5
-4
ffmpeg-helper.js
helper/ffmpeg-helper.js
+10
-12
No files found.
controller/tutor-shot.js
View file @
afce4d05
...
...
@@ -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
await
joinAudioVideo
(
videoPath
,
audioPath
,
finalVideoPath
)
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
...
...
helper/ffmpeg-helper.js
View file @
afce4d05
...
...
@@ -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
()
.
on
(
'end'
,
()
=>
{
res
(
output
)
}
)
.
on
(
'error'
,
(
err
)
=>
{
rej
(
err
)
})
.
input
(
videoPath
)
.
input
(
audioPath
)
.
output
(
output
)
.
input
(
videoPath
)
.
input
(
audioPath
)
.
output
(
output
)
.
on
(
'end'
,
(
)
=>
{
res
(
output
)
})
.
on
(
'error'
,
(
err
)
=>
{
rej
(
err
)
}
)
.
run
()
})
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment