From a video how to get the frames having speech?(.txt file is given which has time for sentence start-end)
    1 view (last 30 days)
  
       Show older comments
    
    pavan chillapur
      
 on 14 Oct 2016
  
    
    
    
    
    Edited: Walter Roberson
      
      
 on 15 Oct 2016
            A video file having the subject speaking sentences is input and .txt file is also given.
0 Comments
Accepted Answer
  PHANI KUMAR.N
      
 on 15 Oct 2016
        
      Edited: Walter Roberson
      
      
 on 15 Oct 2016
  
      clc
clear all;
close all;
a=VideoReader('Rec1.mp4');
mkdir('extracted');
tic;
for img=1:a.NumberOfFrames
   file=strcat('extracted\frame',num2str(img),'.jpg');
   b=read(a,img);
    imwrite(b,file);
end
filename='Rec1_label.txt';
z=importdata(filename);
shiftfile='Rec1_shift.txt';
y=importdata(shiftfile);
fps=a.framerate;
mkdir('time extracted\sentence\');
cd('time extracted\sentence\');
   for i=1:size(z,1)
        x1=round((z(i,1)-y)*fps);
        x2=round((z(i,2)-y)*fps);
        c=z(i,3);
        if x1>img
            break
        end
        mkdir(num2str(c));
        if x2>img
            x2=img;
        end
        for img1=x1:x2
              file1=strcat(num2str(c),'\frame', num2str(img1),'.jpg');
              b1=read(a,img1);
              imwrite(b1,file1);  
          end           
     end       
   toc;
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
