Investigating the Java code of the lib, I found no way to save playing video somewhere. However, the VLC core has such capabilities, according to this doc, you can duplicate the stream and save it, redirecting it right to the file.
I thought we could supply the corresponding arguments while creating an instance of lib, so I tried to add an option when initializing library in libvlcjni.c
like that:
"--sout=duplicate{dst=standard{access=file,mux=ts,dst=/storage/emulated/0/example.mp4}, dst=display}"
but seems it's not working. Any other ideas?
You can concurrently save a playing video to a file using libvlc (at least the following worked for me):
final ArrayList<String> args = new ArrayList<>();
args.add("-vvv");
mLibVLC = new LibVLC(this, args);
mMediaPlayer = new MediaPlayer(mLibVLC);
<code associating surface for display...>
Media media = new Media(mLibVLC, Uri.parse(SAMPLE_URL));
media.addOption(":sout=#duplicate{dst=file{dst=" + <file name> + "},dst=display}");
mMediaPlayer.setMedia(media);
mMediaPlayer.play();