I am attempting to use FFMPEG on Google App Engine (Java) to re-encode some
video files I have that are sitting in Google Cloud Storage. I found a Java
wrapper around ffmpeg that I would like to use here:
https://github.com/kokorin/Jaffree.
My issue is that this library requires an InputStream and OutputStream. I
am trying to specify the InputStream as a file in Google Cloud Storage and
the OutputStream as a new file.
I think I have done specifying the InputStream correctly, but I do not know
what to do about the OutputStream.
How can I specify the OutputStream to be a new file?
Or if possible, can I just overwrite the file in Google Cloud Storage?
Here is my Java code in Google App Engine so far:
Storage storage = StorageOptions.getDefaultInstance().getService();
// This is the input file
BlobId id = BlobId.of("storageBucket", "videos/video_1.mp4");
byte[] content = storage.readAllBytes(id);
InputStream inputStream = new ByteArrayInputStream(content);
FFmpeg.atPath()
.addInput(PipeInput.pumpFrom(inputStream))
.setOverwriteOutput(true)
.addArguments("-movflags", "faststart")
.addOutput(PipeOutput.pumpTo(outputStream)) <---- I need to set this
.setProgressListener(new ProgressListener() {
@Override
public void onProgress(FFmpegProgress progress) {
double percents = 100. * progress.getTimeMillis() /
duration.get();
System.out.println("Progress: " + percents + "%");
}
})
.execute();
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/ffd7f916-9bbd-413e-9afd-8ac7e0021e5fn%40googlegroups.com.