Felix Felix - 3 months ago 96
Java Question

java: rtsp stream to file using vlcj

I am trying to store a rtsp stream to file using vlcj.

I've done a couple of tutorials, looked at some of their test projects but haven't been able to do this.

Any ideas? Thanks in advance!




EDIT

Found an An example of transcoding and saving video from a capture device. Trying to get it to work. Looking for some documentation on the "options" part in
mediaPlayer.playMedia(mrl, options);
.

Answer

Someone answered me on the video lan forums, check it out.

My relevant code is below, where the most important part is the additional option for the vlc media player ":file{dst=C:/Users/the man/yahoo.mp4}".

    mFactory = new MediaPlayerFactory();
    mPlayer = mFactory.newHeadlessMediaPlayer();

    String mrl = "rtsp://@" + addressStr + ":" + mPhoneRTSPPort;

    String options = ":sout=#transcode{vcodec=h264,venc=x264{cfr=16},scale=1,acodec=mp4a,ab=160,channels=2,samplerate=44100}"
            + ":file{dst=C:/Users/the man/yahoo.mp4}";

    mPlayer.playMedia(mrl, options);