-2

I have an Axis IP Camera that is connected over the router network and I'm trying to develop an Android application to display the video on the tablet and I'm following this example to implement a MJPEG viewer Android and MJPEG

When I type the URL into the browser: http:my_ip_cam_ipaddress/axis-cgi/mjpg/video.cgi, it displays the video successfully but when I run the application taken from the source code above in Android Studio, it doesn't give me any response. Did I input in the correct mjpeg url address for the Ip cam?

The code seems to work when I try this URL http://trackfield.webcam.oregonstate.edu/axis-cgi/mjpg/video.cgi while running the app over the WIFI network.

Please help me on this issue. Thanks!

Community
  • 1
  • 1
emenpy
  • 51
  • 1
  • 12

1 Answers1

1

You can use something like this: final VideoView videoView = (VideoView) findViewById(R.id.videoView);

    videoView.setVideoPath(
            "http://trackfield.webcam.oregonstate.edu/axis-cgi/mjpg/video.cgi");

    videoView.start();
Jerassi Ferrer
  • 284
  • 2
  • 8
  • Hi Jerassi, I couldn't get it to work with my IP Camera MJPEG URL. Do you know what was wrong? VideoView says "Can't Play this video". – emenpy Apr 11 '16 at 15:51
  • on some java code that displays such images. You need to transcode the images to a different format. E.g. on the command line that can be done with http://unix.stackexchange.com/questions/12193/transcoding-mjpeg-stream-to-flv-or-mp4 Doing this on android has been discussed at how to save the mjpeg stream as 3gp or mp4 format video files to the sdcard in android – Jerassi Ferrer Apr 11 '16 at 15:56
  • Can you elaborate it a little bit further? So I need to transcode the MJPEG Stream into 3gp or Mp4 format to get it displays by VideoView? Sorry I'm still a novice programmer. Glad you help out. Thanks Jerassi. – emenpy Apr 11 '16 at 16:05
  • yeah if you can change your stream into mp4 format it will be better with the example I give you. I expect it help you. I found this tool https://www.iskysoft.com/video-solution/convert-streaming-videos-to-mp4.html – Jerassi Ferrer Apr 11 '16 at 16:14
  • also if you can vote for my answer will be great. :) – Jerassi Ferrer Apr 11 '16 at 16:15
  • I'll try that Jerassi :)) Is there anyway I could contact you privately? – emenpy Apr 11 '16 at 16:21
  • this is my skype jerassi_alonso@hotmail.com only skype cause I don't check mailbox – Jerassi Ferrer Apr 11 '16 at 16:23
  • So I assume doing this would convert my stream into mp4 format and I will be then need to save it to the sdcard but my question is will the video be streaming live sill? – emenpy Apr 11 '16 at 16:25
  • no I mean there is a way to change format of the streaming, the first one is change the format of the camera streaming other way is using a tool to re-stream in new format and other way shoud be stream with youtube and use youtube in your app – Jerassi Ferrer Apr 11 '16 at 16:31