2016-11-04 2 views
0

오디오 시각화를 위해 3.2.2 처리를 사용하고 있습니다. Visualizer를 재생하는 코드가 있지만 비디오 (.mp4) 파일로 저장하는 방법을 모르겠습니다.처리 중 비디오 내보내기 3

여기에 내가 쓴 내용은 다음과 같습니다

import ddf.minim.*; 
import ddf.minim.analysis.*; 

Minim minim; 
AudioPlayer player; 
AudioMetaData meta; 
BeatDetect beat; 
int r = 200; 
float rad = 70; 
void setup() 
{ 
    size(500, 500); 
    //size(600, 400); 
    minim = new Minim(this); 
    player = minim.loadFile("son_final.mp3"); 
    meta = player.getMetaData(); 
    beat = new BeatDetect(); 
    player.play(); 
    //player.play(); 
    background(-1); 
    noCursor(); 
} 

void draw() 
{ 
    float t = map(mouseX, 0, width, 0, 1); 
    beat.detect(player.mix); 
    fill(#1A1F18,50); 
    noStroke(); 
    rect(0, 0, width, height); 
    translate(width/2, height/2); 
    noFill(); 
    fill(-2, 10); 
    if (beat.isOnset()) rad = rad*0.9; 
    else rad = 70; 
    ellipse(0, 0, 2*rad, 2*rad); 
    stroke(-1, 50); 
    int bsize = player.bufferSize(); 
    for (int i = 0; i < bsize - 1; i+=5) 
    { 
    float x = (r)*cos(i*2*PI/bsize); 
    float y = (r)*sin(i*2*PI/bsize); 
    float x2 = (r + player.left.get(i)*100)*cos(i*2*PI/bsize); 
    float y2 = (r + player.left.get(i)*100)*sin(i*2*PI/bsize); 
    line(x, y, x2, y2); 
    } 
    beginShape(); 
    noFill(); 
    stroke(-1, 50); 
    for (int i = 0; i < bsize; i+=30) 
    { 
    float x2 = (r + player.left.get(i)*100)*cos(i*2*PI/bsize); 
    float y2 = (r + player.left.get(i)*100)*sin(i*2*PI/bsize); 
    vertex(x2, y2); 
    pushStyle(); 
    stroke(-5); 
    strokeWeight(2); 
    point(x2, y2); 
    popStyle(); 
    } 
    endShape(); 
    if (flag) showMeta(); 
} 


void showMeta() { 
    int time = meta.length(); 
    textSize(50); 
    textAlign(CENTER); 
    text((int)(time/1000-millis()/1000)/60 + ":"+ (time/1000-millis()/1000)%60, -7, 21); 
} 

boolean flag =false; 
void mousePressed() { 
    if (dist(mouseX, mouseY, width/2, height/2)<150) flag =!flag; 
} 

void keyPressed() { 
    if(key=='e')exit(); 
} 

나는 MovieMaker와 라이브러리를 가져올 수 있습니다 알고 있지만이 코드에서 사용하는 방법을 모르겠어요. 몇 가지 변경 사항을 제안하십시오.

감사합니다.

답변

0

비디오 내보내기 라이브러리를 사용할 수 있습니다. 여기에 자세한 정보 : http://funprogramming.org/VideoExport-for-Processing/

VideoExport의 인스턴스를 만든 다음 draw() 함수의 끝에 videoExport.saveFrame()을 호출하면됩니다.

import com.hamoid.*; 

VideoExport videoExport; 

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

    videoExport = new VideoExport(this, "basic.mp4"); 
} 
void draw() { 
    background(#224488); 
    rect(frameCount * frameCount % width, 0, 40, height); 

    videoExport.saveFrame(); 
} 

온라인 자원의 톤이있다. 나는 결과 톤을 검색하기 위해 "비디오 내보내기 처리"를 검색하는 것이 좋습니다. 그런 다음 무언가를 시도하고 정확히 어디에서 붙어 있는지 정확히 표시하는 MCVE (전체 프로젝트 아님)을 게시하십시오.

+0

안녕하세요 @KevinWorkman 변경 한 내용과 .mp4 비디오 파일을 내보내지만 오디오가 없습니다! – Shivams334

+0

@ShivamSharma 정말 약간의 연구를하는 것이 좋습니다. Google은 "비디오 내보내기 사운드 처리"를 통해 다른 사람들이 어떻게 해왔는지 확인합니다. 무언가를 시도한 다음 문제가 생기면 특정 질문을 게시하십시오. 행운을 빕니다. –