Commit a694fed40688cc0d59285b935a59456e852cfad1

Authored by Ezequiel Silva
1 parent d46f8520
Exists in master and in 1 other branch devel

Correção no Reconhecedor

log/log
... ... @@ -0,0 +1,4 @@
  1 +Wed May 6 14:05:56 2015
  2 +[ERRO: recognize.cpp] Arquivo não encontrado.
  3 +
  4 +
0 5 \ No newline at end of file
... ...
mixer/src/Mixer.cpp
... ... @@ -121,7 +121,7 @@ void Mixer::mixVideos () {
121 121 " [out]\" -sameq -strict experimental -vcodec mpeg2video -r 30 -threads "+this->numThreads+" "+pathFinal;
122 122 */
123 123  
124   - string ffmpegSentence = "ffmpeg -i "+this->mainVideo+" -y -vf \"movie="+this->secondaryVideo+", "+
  124 + string ffmpegSentence = "ffmpeg -i "+this->mainVideo+" -v quiet -y -vf \"movie="+this->secondaryVideo+", "+
125 125 "scale="+ num1String +":"+num2String+", setpts=PTS-STARTPTS, [movie] overlay"+transparency+"="+strPosition+
126 126 " [out]\" -qscale 0 -strict experimental -vcodec libx264 -preset fast -r 30 -threads "+this->numThreads+" "+pathFinal;
127 127  
... ... @@ -153,7 +153,7 @@ void Mixer::setPathFinal(){
153 153 /*Ajusta o FPS do vídeo principal para 45 se preciso...*/
154 154 void Mixer::adjustVideosFps(){
155 155 //primeiro executo a linha de comando que me dá todas as informações do vídeo
156   - string ffmpegSentence = "ffmpeg -i "+this->mainVideo+" 2> "+temporaryTextFile;
  156 + string ffmpegSentence = "ffmpeg -i "+this->mainVideo+" 2> "+temporaryTextFile;
157 157 system(ffmpegSentence.c_str()); //executo o comando ffmpeg que escreve no arquivo temporário
158 158  
159 159 fpsAndLine arrayDeFps[10]; //array onde será guardado os fps encontrados
... ... @@ -223,7 +223,7 @@ void Mixer::convertMainVideoFPS(fpsAndLine arrayDeFps [], int * qtdadeDeFPSEncon
223 223 //printf("\n\n\n\n\n\n\nPID do canal: %s \n\n\n\n\n\n\n",arrayDeFps[i].possibleProgramID.c_str());
224 224 if(indexMainVideo1 > 0 && indexMainVideo2 > 0 && indexMainVideo3 > 0){ //eis aqui o vídeo principal
225 225 //printf("\n\n\n\n\n\n\nPID do canal a ser alterado: %s \n\n\n\n\n\n\n",arrayDeFps[i].possibleProgramID.c_str());
226   - string ffmpegSentence45 = "ffmpeg -i "+this->mainVideo+" -y -r 45 -vcodec libx264 -streamid 0:"+arrayDeFps[i].possibleProgramID+
  226 + string ffmpegSentence45 = "ffmpeg -i "+this->mainVideo+" -v quiet -y -r 45 -vcodec libx264 -streamid 0:"+arrayDeFps[i].possibleProgramID+
227 227 "-sameq -threads "+this->numThreads+" "+nameOfMainVideo+"-45fps.ts";
228 228 system(ffmpegSentence45.c_str());
229 229 //string removeVideoCMD = "rm -rf "+nameOfMainVideo+".ts"; //removo o vídeo exemplo.ts
... ... @@ -235,7 +235,7 @@ void Mixer::convertMainVideoFPS(fpsAndLine arrayDeFps [], int * qtdadeDeFPSEncon
235 235 }
236 236 else{
237 237 //cout << "\n############################\nConverter fps do vídeo principal com apenas um canal!\n############################\n");
238   - string ffmpegSentence45 = "ffmpeg -i "+this->mainVideo+" -y -r 45 -vcodec libx264 "
  238 + string ffmpegSentence45 = "ffmpeg -i "+this->mainVideo+" -v quiet -y -r 45 -vcodec libx264 "
239 239 "-sameq -threads "+this->numThreads+" "+nameOfMainVideo+"-45fps.ts";
240 240 system(ffmpegSentence45.c_str());
241 241 //string removeVideoCMD = "rm -rf "+nameOfMainVideo+".ts"; //removo o vídeo exemplo.ts
... ...
recognize/src/include/recognize.h
... ... @@ -21,7 +21,7 @@
21 21 #define INPUT_PATTERN 1 /* 1 = Raw file, 2 = Mic */
22 22 #define BLOCS_PATTERN 10
23 23 #define SIZE_BUFFER 256
24   -#define CONFIDENCE_RATE 0.45
  24 +#define CONFIDENCE_RATE 0.10
25 25  
26 26 #define PATH_API_UPLOADS "vlibras_user/vlibras-api/uploads/"
27 27 #define PATH_AUDIO_ORIGIN "/audio/origin/audio_origin.wav"
... ...
recognize/src/recognize.cpp
... ... @@ -71,11 +71,11 @@ void Recognize::Run(){
71 71 breakVideoParts(getTimeMediaSec());
72 72 executeJuliusEngine();
73 73 generateConfidence();
74   - filterOutputJulius();
  74 + //filterOutputJulius();
75 75 //cleanFiles();
76 76  
77 77 finish = true;
78   - notifyEndExtraction(count_lines);
  78 + //notifyEndExtraction(count_lines);
79 79 }
80 80  
81 81 void Recognize::setFrequency(int freq) {
... ... @@ -245,10 +245,12 @@ void Recognize::generateConfidence() {
245 245 } else {
246 246 string line;
247 247 float tmp;
  248 + int pass = 0;
248 249 do {
249 250 getline(in, line);
250 251 std::istringstream buf(line);
251 252 if (line.length() > 0) {
  253 + pass++;
252 254 istream_iterator<std::string> beg(buf), end;
253 255 vector<string> tokens(beg, end);
254 256 float sizeAvgScores = 0;
... ... @@ -277,9 +279,17 @@ void Recognize::generateConfidence() {
277 279 }
278 280 }
279 281 scores.push_back(avgScores/sizeAvgScores);
  282 +
  283 + }else if(pass==0){
  284 +
  285 + notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE", 0);
  286 + notifyEndExtraction(count_lines);
  287 + return;
280 288 }
281 289 } while (!in.eof());
282 290 in.close();
  291 + filterOutputJulius();
  292 + notifyEndExtraction(count_lines);
283 293 }
284 294 }
285 295  
... ... @@ -326,15 +336,19 @@ void Recognize::filterOutputJulius() {
326 336 strcpy(sentence_ptr, (char*) strFilter.c_str());
327 337 if(getConfidence())
328 338 notifyListeners(sentence_ptr, pts.front());
329   - else
  339 + else{
  340 +
330 341 notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE", pts.front());
  342 + }
331 343 scores.erase(scores.begin());
332 344 count_lines++;
333 345 }
334 346 pts.erase(pts.begin());
335 347 }
  348 +
336 349 } while (!in.eof());
337 350 in.close();
  351 + //notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE", pts.front());
338 352 }
339 353  
340 354 /*char* ptr_strFilter;
... ... @@ -345,7 +359,7 @@ void Recognize::filterOutputJulius() {
345 359  
346 360 void Recognize::notifyListeners(char* text, int64_t pts) {
347 361 //cout << "NOTIFY: " << text << endl;
348   -
  362 +
349 363 for(list<RecognizeListener*>::iterator it = listeners->begin(); it != listeners->end(); it++){
350 364 (*it)->notifyTextRecognized((unsigned char*) text, calcula_pts(pts));
351 365 }
... ...
servico/src/serviceWindowGeneration.cpp
... ... @@ -203,6 +203,7 @@ void ServiceWindowGeneration::transcodeVideoToWebm() {
203 203 string command = "ffmpeg -i ";
204 204 command.append(path_libras)
205 205 .append(" -vcodec libvpx -acodec libvorbis ")
  206 + .append(" -v quiet ")
206 207 .append(PATH_API)
207 208 .append(getUserId())
208 209 .append(".webm");
... ... @@ -218,6 +219,7 @@ void ServiceWindowGeneration::transcodeVideoToMp4() {
218 219 string command = "ffmpeg -i ";
219 220 command.append(path_libras)
220 221 .append(" -qscale 0 -strict experimental -vcodec libx264 -preset fast -r 30 ")
  222 + .append(" -v quiet ")
221 223 .append(PATH_API)
222 224 .append(getUserId())
223 225 .append(".mp4");
... ... @@ -233,6 +235,7 @@ void ServiceWindowGeneration::createThumbnail(){
233 235 string command = "ffmpeg -ss 10 -i ";
234 236 command.append(PATH_API).append(user_id).append(".mp4")
235 237 .append(" -vcodec png -vframes 1 -an -f rawvideo -y -vf scale=200:200 ")
  238 + .append(" -v quiet ")
236 239 .append(PATH_API).append(user_id).append(".png");
237 240 system(command.c_str());
238 241 }
... ...