dir_out = '/research/gestrec/Vassilis/scene22';
[start_frame_utt, end_frame_utt]  = textread('start_end_frames_scene22-camera3.csv', '%n%n%*[^\n]','delimiter',',','headerlines',1);
signdata = create_sign_db();
for i=1:length(signdata)
    signdata_el = signdata(i);
    start_frame_sign = timestamp2frame(signdata_el.start_time,'txt',30);
    end_frame_sign = timestamp2frame(signdata_el.end_time,'txt',30);
    offset = floor(start_frame_utt(signdata_el.utterance_num)/2) + start_frame_sign;
    number = end_frame_sign - start_frame_sign + 1;
    signname = signdata_el.sign_name;
    I = findstr(signdata_el.movie_fname,'_');
    fstem_movie = sprintf('%s.%s.avi',signdata_el.movie_fname(1:I(2)-1),signname);
    fname_movie = fullfile(dir_out, fstem_movie);
    str = sprintf('!./rawtoavi -o %d -n %d scene22-camera4.vid %s', offset, number, fname_movie);
    eval(str);
end