ffmpeg-cli-wrapper icon indicating copy to clipboard operation
ffmpeg-cli-wrapper copied to clipboard

stdin && stdout

Open RupengWang opened this issue 6 years ago • 2 comments

Could you please tell me if your project support stdin and stdout to process image stream using ffmpeg ? My ffmpeg command is like this

ffmpeg -y -f image2pipe -vcodec mjpeg -r 24 -i - -vcodec mpeg1video -f mpegts -q:v 0 -

I viewed you code, but didn't find the way.

RupengWang avatar Jun 26 '18 03:06 RupengWang

In terms of syntax: you can use addStdoutOutput() and addInput("-"). Your command would look like this:

new FFmpegBuilder()
            .overrideOutputFiles(true)
            .setFormat("image2pipe")
            .addExtraArgs("-vcodec", "mpjeg")
            .addExtraArgs("-r", "24")
            .addInput("-")
            .addStdoutOutput()
              .setVideoCodec("mpeg1video")
              .setFormat("mpegts")
              .setVideoQuality(1)
              .done()
            .build();

I didn't set the -q:v arg (VideoQuality) to zero because you would get the following exception: java.lang.IllegalArgumentException: quality must be positive

Omar-Riaz avatar Aug 06 '18 09:08 Omar-Riaz

Thanks for you answer! I've finished my work several weeks ago using a similar approach.

RupengWang avatar Aug 06 '18 10:08 RupengWang