Skip to content
Next
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
296
Merge Requests
40
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
b6f40c18
Commit
b6f40c18
authored
16 hours ago
by
Mark Harding
Browse files
Options
Download
(fix): improve transcoder and prepare for future progress logging
parent
777b5903
master
No related merge requests found
Pipeline
#94746721
passed with stages
in 13 minutes and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
Core/Media/Services/FFMpeg.php
View file @
b6f40c18
...
...
@@ -54,6 +54,7 @@ class FFMpeg implements ServiceInterface
'ffmpeg.binaries'
=>
'/usr/bin/ffmpeg'
,
'ffprobe.binaries'
=>
'/usr/bin/ffprobe'
,
'ffmpeg.threads'
=>
$this
->
config
->
get
(
'transcoder'
)[
'threads'
],
'timeout'
=>
0
,
]);
$this
->
ffprobe
=
$ffprobe
?:
FFProbeClient
::
create
([
'ffprobe.binaries'
=>
'/usr/bin/ffprobe'
,
...
...
@@ -253,19 +254,25 @@ class FFMpeg implements ServiceInterface
$pfx
=
(
$rotated
?
$opts
[
'width'
]
:
$opts
[
'height'
])
.
'.'
.
$format
;
$path
=
$sourcePath
.
'-'
.
$pfx
;
try
{
echo
"
\n
Transcoding:
$path
(
$this->key
)"
;
echo
"
\n
Transcoding:
$path
(
$this->key
)
\n
"
;
$formatMap
[
$format
]
->
on
(
'progress'
,
function
(
$a
,
$b
,
$pct
)
{
echo
"
\r
$pct
% transcoded"
;
// also emit out to cassandra so frontend can keep track
});
$formatMap
[
$format
]
->
setKiloBitRate
(
$opts
[
'bitrate'
])
->
setAudioChannels
(
2
)
//
->setAudioChannels(2)
->
setAudioKiloBitrate
(
$opts
[
'audio_bitrate'
]);
$video
->
save
(
$formatMap
[
$format
],
$path
);
//now upload to s3
$this
->
uploadTranscodedFile
(
$path
,
$pfx
);
//cleanup tmp file
@
unlink
(
$path
);
}
catch
(
\Exception
$e
)
{
echo
" failed
{
$e
->
getMessage
()
}
"
;
//cleanup tmp file
@
unlink
(
$path
);
}
}
}
...
...
This diff is collapsed.
Please
register
or
sign in
to comment