appended timestamp to filenames
This commit is contained in:
parent
21d8706175
commit
febb0a47ae
1 changed files with 6 additions and 4 deletions
|
@ -46,22 +46,24 @@ class FFmpegService {
|
|||
|
||||
async function generateThumbnailHelper(ffmpeg: FFmpeg, file: File) {
|
||||
try {
|
||||
const inputFileName = `${Date.now().toString}-${file.name}`;
|
||||
const thumbFileName = `${Date.now().toString}-thumb.png`;
|
||||
ffmpeg.FS(
|
||||
'writeFile',
|
||||
file.name,
|
||||
inputFileName,
|
||||
await getUint8ArrayView(new FileReader(), file)
|
||||
);
|
||||
|
||||
await ffmpeg.run(
|
||||
'-i',
|
||||
file.name,
|
||||
inputFileName,
|
||||
'-ss',
|
||||
'00:00:01.000',
|
||||
'-vframes',
|
||||
'1',
|
||||
'thumb.png'
|
||||
thumbFileName
|
||||
);
|
||||
const thumb = ffmpeg.FS('readFile', 'thumb.png');
|
||||
const thumb = ffmpeg.FS('readFile', thumbFileName);
|
||||
ffmpeg.FS('unlink', 'thumb.png');
|
||||
ffmpeg.FS('unlink', file.name);
|
||||
return thumb;
|
||||
|
|
Loading…
Reference in a new issue