I want to stream the video from android phone camera to VLC media player running on PC.
I have written a sample code to stream the video to the specific IP on my local network using MediaRecorder. The app on phone is working but I am not able to get the stream in VLC media player.
Code of my android app to stream the video to the network:
InetAddress serverAddr = InetAddress.getByName("192.168.2.8");
Socket soc=new Socket(serverAddr,8210);
ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(soc);
tempRecorder.setOutputFile(pfd.getFileDescriptor());
tempRecorder.prepare();
Can anyone tell me where I am doing wrong or how to do this?
Media recorder is for recording. The output file you have specified will have the recorded video and you will ship the file to the server to be played as a one video file. I hope you are doing all this:
Also read the docs:
But if you want to stream the video frame by frame to the your PC, you need to capture each frame in the
onPreviewFramemethod of theCamera.PreviewCallback. From this callback transfer the byte array to your server. This way you will have a continuous stream of image frames from device camera to your server.