Hello Richard, 

Maybe worth mentioning: the present discussion group is for general ideas 
on the Google App Engine, and related problems and trends. For coding in 
Java, you’ll be at an advantage to rather post your questions on 
Stackoverflow, to gain this way access to a large number of experts; it is 
meant for providing you help with coding.

On Saturday, 24 April 2021 at 09:27:56 UTC-4 Richard Arnold wrote:

> 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/c418b7a9-9846-4f96-8e9c-2f310cbb18edn%40googlegroups.com.

Reply via email to