3

I'm trying to capture video with audio from a webcam using Processing. I'm able to capture video using Processing's video library but there's no way of capturing audio along the video with that library. There is a separate library for working with audio (the minim library) but I don't know how to merge together audio and video.

I need it to be with processing because is pretty much the only programming language I know. Now, Processing is really Java so I think there should be possible to use the Java Media Framework but I don't really know where to start to use the JMF along with Processing.

Anyone can give me some guidance on how to capture audio and video in Processing/Java?

Edit
What I'm trying to do can be done using the GSVideo library. GSPipeline is the way to go, I found this post on processing's forum with more details.

Sastrija
  • 3,284
  • 6
  • 47
  • 64
protoboard
  • 31
  • 1
  • 3
  • can you give more information about the format of the video and audio object format? It looks like you will have to figure out a way to combine them into one object representing a known video file format... – wespiserA Nov 28 '11 at 17:13
  • Where you able to solve this using GSVideo? I found only more questions in the post you linked to :) – nathanvda Mar 21 '12 at 22:25

2 Answers2

1

Just import the minim library into Processing (if you don't already have it installed) and you will have the audio extensions in the Processing directly. You can then use the AudioInput class with AudioSource class (this is better than AudioStream) to record the audio along with the video capture.

You should be able to find an interesting discussion on merging audio/video here: Processing Discourse: Minim. There is a comparison of Minim vs. ESS and a number of interesting opinions on how to go about doing it.

Ahmed Masud
  • 21,655
  • 3
  • 33
  • 58
  • By doing that will I have two output files? If that's the case is there a way to merge them in Processing? Thanks for your answer. I'll work with the minim library and see how it all works out. – protoboard Nov 28 '11 at 17:20
  • Thanks for the link. It looks harder than I thought but I'll give it a try with minim. – protoboard Nov 28 '11 at 19:59
0

I am on ubuntu, and how I was able to do this was to actually just record a screencast, using gtk-recordmydesktop. Now the snag: the JDK I was using does not use ALSA, so effectively disabling to use PulseAudio to redirect the output sound back to input.

But, if you export the sketch to an applet, and run the applet in a browser, the java-container does use ALSA, so you can just record the sound with the video.

Hope this helps.

nathanvda
  • 49,707
  • 13
  • 117
  • 139