javacv
javacv copied to clipboard
Constructing FFmpeg Frame Grabber with an InputStream
Hello,
We are trying to construct an FFmpegFrameGrabber object with an InputStream instead of a URL in Android. Here is what we are doing now: grabber = new FFmpegFrameGrabber("rtsp://192.168.42.1/live");
. Unfortunately, since our application uses both Wifi and LTE, we need to explicitly bind the sockets that the FFmpegFrameGrabber uses to Wifi. We thought the easiest way to do that would be to create a Wifi socket to our RTSP URL, then get an InputStream from this socket and pass it into the constructor for the grabber. However, we aren't sure how to convert a UDP socket object into an InputStream that the grabber can consume. Do you know any way to do this (or any other methods to achieve what we want)? Thanks in advance for your help.
I have this same issue too.
i downgraded to version 1.4.4 which works fine with inputstream.
Versions above 1.5.3 doesnt work with inputstream.
implementation 'org.bytedeco:javacv:1.4.4'
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '4.0.1-1.4.4', classifier: 'android-arm'
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '4.0.1-1.4.4', classifier: 'android-x86'
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '4.0.1-1.4.4', classifier: 'android-arm64'
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '4.0.1-1.4.4', classifier: 'android-x86_64'
implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.1-1.4.4', classifier: 'android-arm'
implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.1-1.4.4', classifier: 'android-x86'
implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.1-1.4.4', classifier: 'android-arm64'
implementation group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '4.1-1.4.4', classifier: 'android-x86_64'
@oluwabajio To get the previous old default behavior, you'll need to set the maximumSize to 0.
@saudet Thanks for your reply, do you mean
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(copyFile.getAbsolutePath());
grabber.setMaximumSize(0);
No, maximumSize only does something in the case of an InputStream.