def affective(video_path, video_file, output_path): audio_path = output_path audio_file = video_file + ".wav" ret = extract_audio(video_path, video_file, audio_path, audio_file) if ret == 0: # normal return A, a = arousal.get_arousal(video_path, video_file, audio_path, audio_file) v = valence.get_valence(audio_path, audio_file, A, a) utils.dump(output_path, video_file + "_arousal.txt", a) utils.dump(output_path, video_file + "_valence.txt", v) utils.dump2(output_path + "/final/", video_file + "_final.txt" , v, a) plot_data.plot_data_pyplot(output_path + "/final/" + video_file + "_final.txt", v, a) try: os.remove(audio_path + audio_file) except OSError: print "Warning: file not removed" print "Finished"
def affective(video_file, title): create_thumb(video_file) print '===', video_file, title (path, filename) = os.path.split(video_file) (title, ext) = os.path.splitext(filename) audio_file = title + '.wav' print '===', path, filename, audio_file path = path + '/' ret = extract_audio(path, video_file, audio_file) if ret == 0: # normal return A, a = arousal.get_arousal(path, filename, path, audio_file) v = valence.get_valence(path, audio_file, A, a) I = get_intensity(assemble_vag(v, a)) B = get_block_histogram(I) #utils.dump3(title + '.avg' , v, a) save_block_file(B, path + title + '.blk') try: os.remove(audio_file) except OSError: print "Warning: file not removed" print "Finished"