ffmpegwasm / ffmpegwasm/ffmpeg.wasm
How to get images for each frame of a video, without file writing operations
- Lenguaje dominante
- C
- Estrellas
- 17.8k
- Forks
- 1.1k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
## On web, it takes very long time for get much frame of a video(100 frame from a mp4 file, size:3.3MB, length: 10s, 1280*720, takes 20-30 seconds),
I read the exact procedure,
* Frame extraction task about 300ms
* write file maybe taks 25 seconds
some info
* MacBook Pro (15-inch, 2017)
* 2.8 GHz 4 Core Intel Core i7
* 16 GB 2133 MHz LPDDR3
* Radeon Pro 555 2 GB
* Intel HD Graphics 630 1536 MB
* Chrome 96.0.4664.110(Stable) (x86_64)
code:
```javascript
await ffmpeg.run('-i', name, '-vf', `select='between(t\,0\,99)`, '-vsync', '0','frames%d.jpg')
```
## Can i quickly read each frame by Memory , like:
```javascript
// await ffmpeg.run('-i', name, '-vf', `select='between(t\,0\,99)`, '-vsync', '0','frames%d.jpg')
const frameArray
await ffmpeg.run('-i', name, '-vf', `select='between(t\,0\,99)`, '-vsync', '0', frameArray)
frameArray.length // 100
frameArray[10] // a image obj or a image blob
```
## solutions now:
* i try to use `pipe` but i don't know how to use is
* now, i use `ffmpeg -i ./test.mp4 -vf 'fps=1/0.1:round=zero:start_time=0,scale=1280x720,tile=10x10' M%d.jpg`
* Faster than before, but still takes a long time
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.