Movie loading and playing issue

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

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?

1 Like

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?

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.

1 Like

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

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

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.

2 Likes