We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello!
I have been working with video and audio during a project, and when they both seemed to work properly I decided to put them together. After searching for the problem in my code, I found that loading in the audio files blocked the ability to play a video. I isolated the part of the code that does not work:
import processing.video.*;
import processing.sound.*;
SoundFile ring;
Movie mov1;
void setup() {
size(200,200);
background(0);
mov1 = new Movie(this, "VIDEO1.mp4");
ring = new SoundFile (this, "vintage.mp3"); //soundfile phone ringing
mov1.loop();
}
void movieEvent(Movie m) {
m.read();
}
void draw() {
image(mov1, 0, 0, width, height);
}
When I remove the part "ring = new SoundFile (this, "vintage.mp3")" it the video plays, but otherwise it won't.
I have no clue how to solve this problem, do you?
Thank you in advance! :)
Answers
If you want to combine audio and video, you should try @hamoid Video Export library. You can install it via the library manager in the Processing IDE. Look for Video Export. Hamoid has an example merging video and sound if I remember properly. Now, I am not sure if it will work right way if your original video has its own sound. You can tell us more or maybe @hamoid could comment on that.
Kf
What OS exactly? Have you got PulseAudio running? It looks like one or other library is opening the sound device in an exclusive mode, or your system is only set up for exclusive sound output.
Have you tried using
new Movie (this, "vintage.mp3");
? Bit odd but that might work. The underlying PlayBin in GStreamer should support mp3, although whether the video library fails without a video sink I don't know.