bramp / bramp/ffmpeg-cli-wrapper

Add support for -i pipe:0

Abierto
#334 8 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
Java
Estrellas
1.9k
Forks
424
Merge medio
5 h 35 min
PR fusionados (30 d)
2

Descripción

Hello, I need to transcode live videos,
essentially reading from an InputStream and pipeing the output into an OutputStream is what I need to do.
Unfortunately writing the file to disk is not possible for my use case.
I tried using 2 unix sockets which did work for some formats, but some input formats did not work that way. notably the MP4 demuxer
didnt like demuxing from a unix socket. It does however work with demuxing from stdin.

Sadly your CLI wrapper has no support for demuxing from stdin, so I have to rely on ProcessBuilder directly for this one task.

I wouldnt mind developing this as a feature and making a PR to this repo if you are intrested in this.
My idea would be to add a function to FFmpegBuilder that accepts a supplier to a InputStream.
A bit like this:
```
FFmpegBuilder builder = ...
Supplier streamSupplier = ...
builder.setStdIn(streamSupplier)
```

At some appropriate location in the library I would add this code or something similar:
(This may possible require starting of a "background" thread and I will maybe have to make adjustments for java 8 compat.)
```
Supplier streamSupplier = ...
Process proc = ...
if (streamSupplier != null) {
try(OutputStream outputStream = proc.getOutputStream();
InputStream stream = streamSupplier.get()) {
stream.transferTo(outputStream);
}
}

```

After these changes someone could then call
builder.addInput("pipe:0") to pipe the input from the InputStream.
For my usecase the output would still be a unix socket since my output muxer can write to the unix socket
and the input would be from the InputStream.

Tell me if you have any intrest in this feature and I will begin making it and give you a PR shortly.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con FFmpegBuilder y el punto de entrada de gestión de procesos utilizado por el wrapper de Java; revisa cómo un proveedor de InputStream propuesto podría alimentar el proceso mientras addInput("pipe:0") selecciona stdin. Se considera terminado cuando la entrada en directo se puede transmitir sin escribir en el disco, teniendo en cuenta la compatibilidad con Java 8 y conservando el comportamiento de salida existente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
cli, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.