Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Launching ffmpeg from cmd in sketch?

$
0
0

Hi all, As the title says, i'm trying to launch ffmpeg, which is a command line utility, from within a sketch. I've tried exec(), and open() and launch(), with no real success that I can see. The code below prints "the process returned 1" to the processing console, but the command line is never launched.

What do I need to do to make this work?

Thanks in advance.

code:

import processing.video.*;
Movie mov;
String fileName;

void setup() {
  size(800, 800);
}

void draw() {
}

void keyPressed() {
  if (key == 'p') selectInput("Select movie:", "movieSelected");
}

void movieSelected(File selection) {
  if (selection == null) {
    println("Window was closed or the user hit cancel.");
  } else {
    fileName = selection.getAbsolutePath();
    mov = new Movie(this, fileName);

    String[] processCommands = {
      "E:/Tertiary/COMP390/Movie Second/ffmpeg/bin/ffmpeg.exe",
      "ffmpeg", "-i", "mov", "-codec:a", "libmp3lame", "-qscale:a 2", "fileName" + "output.mp3"
    };
    Process p = launch(processCommands);

    try {
      int result = p.waitFor();
      println("the process returned " + result);
    }
    catch (InterruptedException e) {
    }
  }
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles