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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
tutor-shot.js
controller/tutor-shot.js
+4
-3
ffmpeg-helper.js
helper/ffmpeg-helper.js
+3
-4
No files found.
controller/tutor-shot.js
View file @
afce4d05
...
@@ -42,9 +42,9 @@ module.exports.generateVideo = async function (req, res) {
...
@@ -42,9 +42,9 @@ module.exports.generateVideo = async function (req, res) {
let
imageDir
=
TEMP_IMAGE_DIR
let
imageDir
=
TEMP_IMAGE_DIR
let
imagePathString
=
path
.
join
(
imageDir
,
`
${
tutorShotData
.
_id
}
_%d.png`
)
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`
)
thumbnailPath
=
path
.
join
(
TEMP_IMAGE_DIR
,
`
${
tutorShotData
.
_id
}
_thumbnail`
)
fileName
=
`
${
tutorShotData
.
_id
}
.
mp4
`
fileName
=
`
${
tutorShotData
.
_id
}
.
webm
`
thumbnailName
=
`
${
tutorShotData
.
_id
}
_thumbnail.png`
thumbnailName
=
`
${
tutorShotData
.
_id
}
_thumbnail.png`
// // this is to generate each individual images and get their buffers
// // this is to generate each individual images and get their buffers
...
@@ -116,8 +116,9 @@ module.exports.generateVideo = async function (req, res) {
...
@@ -116,8 +116,9 @@ module.exports.generateVideo = async function (req, res) {
socket
.
emit
(
"videoGenerationProgress"
,
socketPayload
)
socket
.
emit
(
"videoGenerationProgress"
,
socketPayload
)
let
audioPath
=
path
.
join
(
TEMP_AUDIO_DIR
,
`ts-
${
tutorShotData
.
_id
}
.mp3`
);
// path to only audio
let
audioPath
=
path
.
join
(
TEMP_AUDIO_DIR
,
`ts-
${
tutorShotData
.
_id
}
.mp3`
);
// path to only audio
await
createAudio
(
tutorShotData
.
audio
,
audioPath
)
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
)
await
joinAudioVideo
(
videoPath
,
audioPath
,
finalVideoPath
)
videoPath
=
finalVideoPath
;
}
else
{
}
else
{
socketPayload
.
percent
=
99
socketPayload
.
percent
=
99
socketPayload
.
subTask
[
0
].
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) {
...
@@ -63,7 +63,6 @@ module.exports.createVideoFromImages = async function (imageArr, options) {
////// to delete the frames that are created //////
////// to delete the frames that are created //////
if
(
deleteImages
)
if
(
deleteImages
)
frames
.
forEach
((
filePath
)
=>
{
frames
.
forEach
((
filePath
)
=>
{
console
.
log
(
"🚀 ~ frames.forEach ~ filePath:"
,
filePath
)
fs
.
access
(
filePath
,
fs
.
constants
.
F_OK
,
(
err
)
=>
{
fs
.
access
(
filePath
,
fs
.
constants
.
F_OK
,
(
err
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
// File exists, proceed with deletion
// File exists, proceed with deletion
...
@@ -92,15 +91,15 @@ module.exports.createVideoFromImages = async function (imageArr, options) {
...
@@ -92,15 +91,15 @@ module.exports.createVideoFromImages = async function (imageArr, options) {
module
.
exports
.
joinAudioVideo
=
async
function
(
videoPath
,
audioPath
,
output
)
{
module
.
exports
.
joinAudioVideo
=
async
function
(
videoPath
,
audioPath
,
output
)
{
return
new
Promise
((
res
,
rej
)
=>
{
return
new
Promise
((
res
,
rej
)
=>
{
ffmpeg
()
ffmpeg
()
.
input
(
videoPath
)
.
input
(
audioPath
)
.
output
(
output
)
.
on
(
'end'
,
()
=>
{
.
on
(
'end'
,
()
=>
{
res
(
output
)
res
(
output
)
})
})
.
on
(
'error'
,
(
err
)
=>
{
.
on
(
'error'
,
(
err
)
=>
{
rej
(
err
)
rej
(
err
)
})
})
.
input
(
videoPath
)
.
input
(
audioPath
)
.
output
(
output
)
.
run
()
.
run
()
})
})
}
}
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