From f25319fc877f4f4af398a90af75aae77ce9e552b Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 16 Apr 2013 18:01:35 +0100 Subject: in pursuit of 1st render --- rotord/01.xml | 16 +++++++++++++++- rotord/ofxMovieExporter.cpp | 8 ++++++-- rotord/ofxMovieExporter.h | 12 ++++++------ rotord/rotor.cpp | 4 ++-- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/rotord/01.xml b/rotord/01.xml index f3abb80..03f3f0b 100755 --- a/rotord/01.xml +++ b/rotord/01.xml @@ -5,7 +5,21 @@ segmenter signal divide - signal to divide + signal 1 to divide + amount + 2.0 + + + + red + 0.5 + + green + 0.5 + + blue + 0.5 + outputs a single 1 every time signal enters a new number signal to analyse diff --git a/rotord/ofxMovieExporter.cpp b/rotord/ofxMovieExporter.cpp index 8b97813..8513395 100644 --- a/rotord/ofxMovieExporter.cpp +++ b/rotord/ofxMovieExporter.cpp @@ -86,11 +86,15 @@ recording = false; numCaptures = 0; +inW=outW; +inH=outH; convertCtx = sws_getContext(inW, inH, PIX_FMT_RGB24, outW, outH, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL); allocateMemory(); + + return true; } @@ -217,10 +221,10 @@ frameNum++; } - void ofxMovieExporter::encodeFrame(char *pixels) + void ofxMovieExporter::encodeFrame(unsigned char *pixels,int w,int h) { - avpicture_fill((AVPicture*)inFrame, pixels, PIX_FMT_RGB24, inW, inH); + avpicture_fill((AVPicture*)inFrame, pixels, PIX_FMT_RGB24, w, h); avpicture_fill((AVPicture*)outFrame, outPixels, PIX_FMT_YUV420P, outW, outH); //perform the conversion for RGB to YUV and size diff --git a/rotord/ofxMovieExporter.h b/rotord/ofxMovieExporter.h index 82c574c..ebd794c 100644 --- a/rotord/ofxMovieExporter.h +++ b/rotord/ofxMovieExporter.h @@ -122,18 +122,18 @@ class ofxMovieExporter // set an external pixel source, assumes 3 Byte RGB // also sets the recording size but does not crop to the recording area void setPixelSource(unsigned char* pixels, int w, int h); - + // get the number files that have been captured so far int getNumCaptures(); - + // reset the filename counter back to 0 void resetNumCaptures(); - + // get the recording size inline int getRecordingWidth() {return outW;} inline int getRecordingHeight() {return outH;} - void encodeFrame(char *pixels); + void encodeFrame(unsigned char *pixels,int w,int h); private: //#ifdef _THREAD_CAPTURE @@ -148,7 +148,7 @@ class ofxMovieExporter void clearMemory(); void encodeFrame(); - + std::string container; AVCodecID codecId; @@ -181,7 +181,7 @@ class ofxMovieExporter int posX, posY; int inW, inH; int outW, outH; - + bool usePixelSource; unsigned char* pixelSource; }; diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index ab02298..7ad1488 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -767,7 +767,7 @@ bool Video_output::render(const float duration, const float framerate,const stri int outH=480; int bitRate=4000000; int frameRate=25; - AVCodecID codecId=AV_CODEC_ID_H264; + AVCodecID codecId=AV_CODEC_ID_MPEG4; std::string container ="mov"; @@ -778,7 +778,7 @@ bool Video_output::render(const float duration, const float framerate,const stri float step=1.0f/framerate; float v=0.0f; for (float f=0.0f;fencodeFrame(get_output(Frame_spec(f,framerate,outW,outH))->RGBdata); + exporter->encodeFrame(get_output(Frame_spec(f,framerate,outW,outH))->RGBdata,outW,outH); } exporter->finishRecord(); return true; -- cgit v1.2.3