Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1006727 // framesFromVideo

JavaX fragment (include)

1  
lib 1006715 // jcodec 0.2.0
2  
lib 1006717 // jcodec 0.2.0 javase
3  
4  
import org.jcodec.common.io.*;
5  
import org.jcodec.api.awt.*;
6  
7  
static IterableIterator<BufferedImage> framesFromVideo(File video) ctex {
8  
  final FileChannelWrapper ch = NIOUtils.readableChannel(video);
9  
  final AWTFrameGrab8Bit grab = AWTFrameGrab8Bit.createAWTFrameGrab8Bit(ch);
10  
  ret iteratorFromFunction(func {
11  
    BufferedImage img = grab.getFrame();
12  
    if (img == null) NIOUtils.closeQuietly(ch);
13  
    ret img;
14  
  });
15  
  // TODO: close file when not all frames are grabbed
16  
}

Author comment

Began life as a copy of #1006718

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006727
Snippet name: framesFromVideo
Eternal ID of this version: #1006727/5
Text MD5: 9ecdcbe38b3a2d75a33cccdbe92dd56b
Author: stefan
Category: javax video
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-03 00:56:37
Source code size: 555 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 487 / 551
Version history: 4 change(s)
Referenced in: [show references]