ffmpegwasm / ffmpegwasm/ffmpeg.wasm

ffprobe.wasm

Abierto
#121 18 comentarios 30 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
C
Estrellas
17.8k
Forks
1.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Is your feature request related to a problem? Please describe.**
Implement `ffprobe` wasm version.

**Describe the solution you'd like**
`ffprobe` is the necessary companion of `ffmpeg`, needed to analyze media file before processing .

**Describe alternatives you've considered**
In this simple case I'm using the command line `ffprobe` via `execFile` to probe the file

```javascript
probe = function (fpath) {
var self = this;
return new Promise((resolve, reject) => {
var loglevel = self.logger.isDebug() ? 'debug' : 'warning';
const args = [
'-v', 'quiet',
'-loglevel', loglevel,
'-print_format', 'json',
'-show_format',
'-show_streams',
'-i', fpath
];
const opts = {
cwd: self._options.tempDir
};
const cb = (error, stdout) => {
if (error)
return reject(error);
try {
const outputObj = JSON.parse(stdout);
return resolve(outputObj);
} catch (ex) {
self.logger.error("MediaHelper.probe failed %s", ex);
return reject(ex);
}
};
cp.execFile('ffprobe', args, opts, cb)
.on('error', reject);
});
}//probe
```

or in this case to `seek` to position in the media file:

```javascript
seek = function (fpath, seconds) {
var self = this;
return new Promise((resolve, reject) => {
var loglevel = self.logger.isDebug() ? 'debug' : 'panic';
const args = [
'-hide_banner',
'-loglevel', loglevel,
'-show_frames',//Display information about each frame
'-show_entries', 'frame=pkt_pos',// Display only information about byte position
'-of', 'default=noprint_wrappers=1:nokey=1',//Don't want to print the key and the section header and footer
'-read_intervals', seconds + '%+#1', //Read only 1 packet after seeking to position 01:23
'-print_format', 'json',
'-v', 'quiet',
'-i', fpath
];
const opts = {
cwd: self._options.tempDir
};
const cb = (error, stdout) => {
if (error)
return reject(error);
try {
const outputObj = JSON.parse(stdout);
return resolve(outputObj);
} catch (ex) {
self.logger.error("MediaHelper.probe failed %s", ex);
return reject(ex);
}
};
cp.execFile('ffprobe', args, opts, cb)
.on('error', reject);
});
}//seek
```
**Additional context**
Probe media files before processing; seek to media position;

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.