question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to take image from rtsp?

See original GitHub issue

previusly I used Http IP camera, for that I used following code

URL myUrl = new URL("http://192.168.15.999/axis-cgi/jpg/image.cgi");
BufferedImage bufferedImage;
bufferedImage = ImageIO.read(myUrl); 
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
ImageIO.write(bufferedImage, "jpg", baos);

but now they are providing stream of RTSP. How I can used RTPS for above code

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:30 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
sandip-narwadecommented, Jun 18, 2018

your code is working Big Buck Bunny video is playing

but for my RTSP not working

1reaction
sarxoscommented, Jun 18, 2018

Hi @sandipJava,

Sorry for hanging with this for so long. I had some other important to do first. I did a quick look into the code to check VLCJ args in accordance to the code provided in #355 (thanks @jaysentang for pointing this out).

After these changes provided RTPS endpoints (at least the ones I tested) work fine.

I also prepared small example based on your code:

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JFrame;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.WebcamResolution;
import com.github.sarxos.webcam.ds.vlcj.VlcjDriver;
import uk.co.caprica.vlcj.medialist.MediaListItem;

public class WebcamRtspExample {

	static {
		String name = "Big Buck Bunny";
		String rtsp = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov";
		Webcam.setDriver(new VlcjDriver(Arrays.asList(new MediaListItem(name, rtsp, new ArrayList<MediaListItem>()))));
	}

	public static void main(String[] args) throws InterruptedException, IOException {

		Webcam webcam = Webcam.getWebcams().get(0);
		webcam.setViewSize(WebcamResolution.VGA.getSize());
		WebcamPanel panel = new WebcamPanel(webcam);

		JFrame window = new JFrame("Webcam Panel");
		window.add(panel);
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		window.pack();
		window.setVisible(true);
	}
}

After I run it:

image

IMPORTANT!!!

Please note that this fix has not been released yet and is available in SNAPSHOT version only!!! You need to download 0.3.13-SNAPSHOT version of webcam-capture-driver-vlcj from here:

https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.github.sarxos&a=webcam-capture-driver-vlcj&v=0.3.13-SNAPSHOT

Please make sure to update all webcam-capture JARs to 0.3.12 in case you are using older version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to grab a single image from RTSP stream using FFMPEG
Try ffmpeg -y -i rtsp://admin:admin@192.168.10.113:554/live -vframes 1 do.jpg.
Read more >
Capture single frame image from RTSP stream
I can get a single jpeg image by entering the following url in the RPi CLI: http://192.168.xxx.yyy/cgi-bin/snapshot.cgi?1, however it takes ...
Read more >
grabbing an image from an rtsp stream
==> Every 5 minutes: The RPI will run a script that will grab a JPG frame from a remote (Hosafe) rtsp stream. Name...
Read more >
How to capture frames from a video stream or RTSP camera
Install FFMPEG according to the directions of your current OS: Windows: Use a program like 7-Zip to unpack the files to your preferred...
Read more >
Grab a snapshot from an RTSP video stream every 1 second.
The first few frames mostly come through properly, but then the images start to just have the two part of the image filled...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found