# Movie loading and playing issue

**URL:** <https://discourse.processing.org/t/movie-loading-and-playing-issue/6880>\
**Category:** Libraries\
**Created:** [December 24, 2018, 3:21pm UTC](https://discourse.processing.org/t/movie-loading-and-playing-issue/6880 "2018-12-24T15:21:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumaghos](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@sumaghos](https://discourse.processing.org/u/sumaghos)\
**Post date:** [December 24, 2018, 3:21pm UTC](https://discourse.processing.org/t/movie-loading-and-playing-issue/6880/1 "2018-12-24T15:21:46Z")

</div>

I am using the below simple code to load and play a movie file, which is under “data” folder

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

void setup() {
  size(1920, 1080);
  myMovie = new Movie(this, "clouds.mpg");
  print(myMovie.duration());
  myMovie.loop();
}

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

// Called every time a new frame is available to read
void movieEvent(Movie m) {
  m.read();
}

```

the Duration is showed “0.0” and the movie does not play.  
I am able to play the file in vlc player. Can anyone please suggest what could be the issue?

---

<div class="post-metadata">

**Author:** ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)\
**Post date:** [December 24, 2018, 4:39pm UTC](https://discourse.processing.org/t/movie-loading-and-playing-issue/6880/2 "2018-12-24T16:39:01Z")

</div>

This might be because Processing Video library doesn’t know how to decode that video, while VLC does. To be honest, I never heard of `.mpg` file extension before, so I’m certain that this is the case.

Do you happen to know which codec is it in? What happens if you put other video files with different codecs into the same code?

---

<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:** [December 24, 2018, 5:34pm UTC](https://discourse.processing.org/t/movie-loading-and-playing-issue/6880/3 "2018-12-24T17:34:16Z")

</div>

> [@Architector\_4](#):
>
> To be honest, I never heard of `.mpg` file extension

They were quite common. Usually MPEG-1 or MPEG-2. It’s possible the old video library left support out. Could try Video library v2-beta with Gstreamer 1.x.

---

<div class="post-metadata">

**Author:** ![sumaghos](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@sumaghos](https://discourse.processing.org/u/sumaghos)\
**Post date:** [December 24, 2018, 6:02pm UTC](https://discourse.processing.org/t/movie-loading-and-playing-issue/6880/4 "2018-12-24T18:02:41Z")

</div>

Tried with .mov, .mp4 format also. Didn’t work. The funny thing is all these files used to be running earlier. But I recently re-installed processing and facing this issue. Os is ubuntu 16.04

---

<div class="post-metadata">

**Author:** ![sumaghos](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@sumaghos](https://discourse.processing.org/u/sumaghos)\
**Post date:** [January 7, 2019, 8:21am UTC](https://discourse.processing.org/t/movie-loading-and-playing-issue/6880/5 "2019-01-07T08:21:42Z")

</div>

The issue remain unsolved. The same is working in windows. Might be missing some libraries in ubuntu 16.04 LTS

---

<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:** [January 7, 2019, 9:36am UTC](https://discourse.processing.org/t/movie-loading-and-playing-issue/6880/6 "2019-01-07T09:36:19Z")

</div>

If you’re using v1 of the Video library, make sure you’ve installed the legacy GStreamer 0.10 plugins, including the bad and ugly ones. Or try the v2 beta as suggested earlier so that you can use GStreamer 1.0 - although still make sure you install the bad and ugly packages for that.

On Linux the Video library uses the OS installed GStreamer rather than a bundled version, hence difference to Windows.
