简体   繁体   English

在处理 3 中运行 .mov 文件时遇到问题

[英]Trouble running a .mov file in processing 3

I have this code written to display a movie in a new window in processing.我编写了这段代码来在处理中的新窗口中显示电影。 When I run the code I get the display window, but nothing shows up inside it.当我运行代码时,我得到了显示窗口,但里面什么也没有显示。

I've tried different movies and file types, different display sizes and frame rates with no luck.我尝试过不同的电影和文件类型、不同的显示尺寸和帧速率,但都没有成功。 It recognizes the movie file in the data folder but says that it isn't available.它识别数据文件夹中的电影文件,但说它不可用。 I'm really new to this so it might have been a simple mistake我真的很陌生,所以这可能是一个简单的错误

import processing.video.*; 

Movie movie; 

void setup() {  
  size (200, 200); 

  movie = new Movie(this, "test.mov");  
    print(movie.available());

}

void movieEvent(Movie M) {  
  M.read();
}

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

I've also tried switching the draw and movieEvent sections with no luck.我也试过在没有运气的情况下切换 draw 和 movieEvent 部分。 I'm really stumped.我真的很难过。

You code looks correct.你的代码看起来是正确的。 (Personally I would use upper case for classes only, (eg movieEvent(Movie m) , but doesn't change the way the code runs) (我个人只会对类使用大写,(例如movieEvent(Movie m) ,但不会改变代码的运行方式)

The one thing that appears missing is actually the play() or loop() call:似乎缺少的一件事实际上是play()loop()调用:

import processing.video.*; 

Movie movie; 

void setup() {  
  size (200, 200); 

  movie = new Movie(this, "test.mov");  
    print(movie.available());
  movie.loop();
}

void movieEvent(Movie ,) {  
  m.read();
}

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

If the movie still doesn't play it might be worth doing a few more tests to isolate the issue: is it with the video file or video library on your system for some reason.如果电影仍然无法播放,则可能需要进行更多测试以隔离问题:是否出于某种原因与系统上的视频文件或视频库有关。

  1. Open Processing > Examples > Libraries > Video > Movie > Loop and run it.打开Processing > Examples > Libraries > Video > Movie > Loop并运行它。 If it plays it means the video library works fine on your system and it's likely the video file you use.如果它播放,则意味着视频库在您的系统上运行良好,并且很可能是您使用的视频文件。
  2. In your code, instead of "test.mov" try playing the transit video that comes with the video library examples.在您的代码中,尝试播放视频库示例附带的传输视频,而不是“test.mov”。 If that plays, tre encoding your video with the same codec (H.264) and try again.如果播放,请使用相同的编解码器 (H.264) 对视频进行编码,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM