# Importing Live Internet Video in Processing

**URL:** https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218
**Category:** Libraries
**Created:** [February 8, 2019, 3:23pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218 "2019-02-08T15:23:45Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ernestwzh](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@ernestwzh](https://discourse.processing.org/u/ernestwzh)
#### Post date: [February 8, 2019, 3:23pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/1 "2019-02-08T15:23:45Z")

</div>

Hi there, I was just wondering if it is possible to import a live internet video feed from the following weblink into Processing:

> **[Live Cam Ermou Street and Syntagma Square in Athens](https://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html)**
>
> The Ermou and Syntagma Square from the Electra Hotel Athens

Ultimately I wish to manipulate the live video but for now I would just like to import it into the Processing window.

Thanks for you help.

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 8, 2019, 9:20pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/2 "2019-02-08T21:20:34Z")

</div>

If the direct video link is http you should be able to pass it in where you’d normally pass the file in Processing Video’s Movie class. For some reason the url protocols are restricted. You could also use PraxisLIVE - the video library there doesn’t have that restriction.

---

<div class="post-metadata">

### Author: ![ernestwzh](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@ernestwzh](https://discourse.processing.org/u/ernestwzh)
#### Post date: [February 9, 2019, 11:23am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/3 "2019-02-09T11:23:51Z")

</div>

Thanks for replying. So you’re saying because the link has some restrictions, there’s no way I can bring it into my Processing sketch?

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 9, 2019, 12:19pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/4 "2019-02-09T12:19:17Z")

</div>

I have no idea without digging into the source of that webpage and finding the actual link to the video stream.

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [February 9, 2019, 1:21pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/5 "2019-02-09T13:21:42Z")

</div>

[https://hddn01.skylinewebcams.com/live.m3u8?a=pg04frmj4t7csjlsufthoqsqm1](https://hddn01.skylinewebcams.com/live.m3u8?a=pg04frmj4t7csjlsufthoqsqm1)  
i could open in VLC

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 9, 2019, 3:05pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/6 "2019-02-09T15:05:04Z")

</div>

I think it works as http too so you might be in luck. Use a Movie example from the Video library and pass in that link (as http not https) instead of the filename. Does it work?

---

<div class="post-metadata">

### Author: ![ernestwzh](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@ernestwzh](https://discourse.processing.org/u/ernestwzh)
#### Post date: [February 9, 2019, 7:31pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/7 "2019-02-09T19:31:29Z")

</div>

I’m new to all this, not sure where in the code I should paste the http link. The video library examples all read from an existing video file.

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 9, 2019, 7:45pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/8 "2019-02-09T19:45:08Z")

</div>

In place of the file name. eg. In the Loop example in place of `"launch2.mp4"` put `"http://<whatever the link is>"`

---

<div class="post-metadata">

### Author: ![ernestwzh](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@ernestwzh](https://discourse.processing.org/u/ernestwzh)
#### Post date: [February 11, 2019, 10:13am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/9 "2019-02-11T10:13:20Z")

</div>

Thanks for replying, I’ve tried that but nothing is playing in my sketch. Here is the code, I don’t know if I’m doing something wrong:

```auto
import processing.video.*;
Movie syn;

void setup() {
  fullScreen();

  syn = new Movie(this, "http://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html");
  syn.loop();
  syn.read();
}

void draw() {
  image(syn, 0, 0);
}

```

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 11, 2019, 2:30pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/10 "2019-02-11T14:30:29Z")

</div>

Not the .html link, the .m3u8 link that was posted earlier.

---

<div class="post-metadata">

### Author: ![ernestwzh](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@ernestwzh](https://discourse.processing.org/u/ernestwzh)
#### Post date: [February 11, 2019, 6:03pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/11 "2019-02-11T18:03:33Z")

</div>

Just tried it but it still doesn’t work, any idea why?

```auto
import processing.video.*;
Movie syn;

void setup() {
  fullScreen();

  syn = new Movie(this, "http://hddn01.skylinewebcams.com/live.m3u8?a=pg04frmj4t7csjlsufthoqsqm1");
  syn.loop();
  syn.read();
}

void draw() {
  image(syn, 0, 0);
}

```

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 11, 2019, 6:43pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/12 "2019-02-11T18:43:40Z")

</div>

The link has changed - it’s now [https://hddn01.skylinewebcams.com/live.m3u8?a=udnt3mth5bdqbntskbrg6n1o43](https://hddn01.skylinewebcams.com/live.m3u8?a=udnt3mth5bdqbntskbrg6n1o43)

The problem you’ll have is finding the link each time. It will probably change every few hours. I used a Linux CLI tool called `youtube-dl` to extract the link. It’s currently working in PraxisLIVE with GStreamer 1.x so should work with Video Library v2 beta if not v1.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [February 16, 2019, 4:55am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/13 "2019-02-16T04:55:19Z")

</div>

> [@neilcsmith](#):
>
> The link has changed

If the page url is stable, and the form of the link is stable – but the subdomain and suffix changes all the time – then you can retrieve the url dynamically at run time using a regex. Something like this:

```auto
String[] pageHTML = loadStrings("http://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html");
String camURLpattern = "'(https://hddn)(\\d*)(.skylinewebcams.com/live)(.*?)(.m3u8)(.*?)'"; // pg04frmj4t7csjlsufthoqsqm1"
String[] m = match(join(pageHTML, ""), camURLpattern);
String camURL = m[1] + m[2] + m[3] + m[4] + m[5] + m[6];
println(camURL);

```

As long as the url follows the pattern you specify, the code will pick it up – assuming you can then load the live video directly with processing.video (untested).

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [February 16, 2019, 5:09am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/14 "2019-02-16T05:09:32Z")

</div>

Try the IPCapture library that you can install in Processing using the Contribution Manager. Unsure if it will work with your video format but worth checking: [https://processing.org/reference/libraries/](https://processing.org/reference/libraries/)

Kf

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 16, 2019, 8:17am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/15 "2019-02-16T08:17:21Z")

</div>

@jeremydouglass that depends on the link being in the HTML source, which as far as I can tell it isn’t or I wouldn’t have needed to use `youtube-dl` in the first place 😄 It’s a blob uri. I had a quick look and couldn’t find any easy obvious way to extract it in Processing. eg. [https://stackoverflow.com/questions/42901942/how-do-we-download-a-blob-url-video](https://stackoverflow.com/questions/42901942/how-do-we-download-a-blob-url-video)

@kfrajer as far as I can tell that library says it’s just for MJPEG? Which would make sense if it’s pure Java. The Video library should be able to play this, GStreamer certainly is fine, but getting the actual link is more “fun”.

@kll How did you get the link when you first posted?

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [February 16, 2019, 9:28am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/16 "2019-02-16T09:28:50Z")

</div>

> [@neilcsmith](#):
>
> How did you get the link when you first posted?

i dig website with inspect ?media? …  
but when i call it in browser a download started.  
when i click that: vlc started and show the stream  
for a few seconds. reloading the same link does not work,  
must run program again to get a new “a=xxxxx”

that way can find it, BUT not show it??

again call browser, get download, click VLC works

```auto
String theURL = "https://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html";
String thestart = "https://hddn01.skylinewebcams.com/live.m3u8";
String theend = "'},";
String[] incoming;
int srcindex, srcend;
String line,picsrc;
PImage found;
boolean foundone = false;

void setup() {
  size(400,400);
  incoming = loadStrings(theURL);
  //printArray(incoming);

  for (int i=0; i<incoming.length; i++) {
    srcindex=0;
    srcend=0;
    line = incoming[i];
    srcindex = line.indexOf(thestart);
    if ( srcindex > 0 )//&& srcend > 0 && srcend > srcindex) 
    {
      picsrc = line.substring(srcindex); // use second part
      srcend = picsrc.indexOf(theend); // search end in that part only
      println("i "+i+" srcindex "+srcindex+" srcend "+srcend);
      picsrc = picsrc.substring(0, srcend); // cut of rest
      println(picsrc);
      //found = loadImage(picsrc);
      foundone = true;
    }
  }
}

void draw() {
// if ( foundone ) image(found,0,0);
}

```

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [February 16, 2019, 6:00pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/17 "2019-02-16T18:00:54Z")

</div>

> [@neilcsmith](#):
>
> that depends on the link being in the HTML source, which as far as I can tell it isn’t

Maybe I misunderstood. When you run my 5-line sketch above, it loads the skylinewebcams page, finds the latest .m3u8 url with the ?a= suffix, which is in the page, and prints it. This is the one you referred to when you said “The link has changed […] The problem you’ll have is finding the link each time.”

Not familiar with “blob URI” – if the m3u8 url isn’t what is needed, then apologies for the confusion.

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [February 16, 2019, 6:53pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/18 "2019-02-16T18:53:59Z")

</div>

> [@jeremydouglass](#):
>
> Maybe I misunderstood. When you run my 5-line sketch above, it loads the skylinewebcams page, finds the latest .m3u8 url with the ?a= suffix, which is in the page, and prints it.

Sorry, you’re right. I only inspected the page in the browser and found the blob URL in the video element, which is normally for hiding things. Didn’t realise the .m3u8 URL is in the script element. Lousy hiding, but it fooled me! 😄

So putting it all together, with Video library v2 beta, replacing the `gst1-java-core-0.9.1.jar` file with the latest `gst1-java-core-0.9.4.jar` (there’s a bug), adapting to force a http URL (because https gets filtered in the Video library), and using the system installed GStreamer on Ubuntu 18.04 we can get it to work. 😓 Whether it works with any other combination remains to be seen.

```auto
import processing.video.*;
Movie syn;

void setup() {
  size(640,480);
  String[] pageHTML = loadStrings("http://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html");
  String camURLpattern = "'(https://hddn)(\\d*)(.skylinewebcams.com/live)(.*?)(.m3u8)(.*?)'";
  String[] m = match(join(pageHTML, ""), camURLpattern);
  String camURL = "http://hddn" + m[2] + m[3] + m[4] + m[5] + m[6];
  println(camURL);
  syn = new Movie(this, camURL);
  syn.play();
}

void draw() {
  if (syn.available()) {
    syn.read();
  }
  image(syn, 0, 0, width, height);
}

```

 ![syn](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/d/dc6c29cfd2086a2b52b859cda420e86ee62400ad.jpeg)

---

<div class="post-metadata">

### Author: ![rojele](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rojele/32/5898_2.png) [@rojele](https://discourse.processing.org/u/rojele)
#### Post date: [April 12, 2022, 6:37pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/19 "2022-04-12T18:37:08Z")

</div>

Hi! I know that’s a three years old thread but I’m after this exact matter in this moment.  
Using the 5 lines code by @jeremydouglass or the final example from @neilcsmith, string \_m returns null (windows).  
I know I will need to make the effort of learning regex, understanding what’s happening and adapt it for other live video websites, but actually I would like to know if this code you provided is already working in your system or any variation in the webpage has made it unworkable.  
Thanks a lot for the efforts.

---

<div class="post-metadata">

### Author: ![rojele](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rojele/32/5898_2.png) [@rojele](https://discourse.processing.org/u/rojele)
#### Post date: [April 18, 2022, 6:24pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/20 "2022-04-18T18:24:21Z")

</div>

Hi! I actually found that there’s not any .m3u8 url accessible from the “inspector” tab of the browser (apart from “source:'livee.m3u8?” that doesn’t seem to be what I need in order to play it).  
The only way for getting a valid .m3u8 url of a video is through the “network” tab, and I does not have the foggiest idea about how to dig there with processing loadStrings(), because it doesn’t seem to be in the DOM.  
I wonder if this problem was there at the beginning of this thread or is a circumstance that was not there at that time.  
Thanks a lot.

[Next page](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218.md?page=2)
