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

16
LINES

< > BotCompany Repo | #1006727 // framesFromVideo

JavaX fragment (include)

lib 1006715 // jcodec 0.2.0
lib 1006717 // jcodec 0.2.0 javase

import org.jcodec.common.io.*;
import org.jcodec.api.awt.*;

static IterableIterator<BufferedImage> framesFromVideo(File video) ctex {
  final FileChannelWrapper ch = NIOUtils.readableChannel(video);
  final AWTFrameGrab8Bit grab = AWTFrameGrab8Bit.createAWTFrameGrab8Bit(ch);
  ret iteratorFromFunction(func {
    BufferedImage img = grab.getFrame();
    if (img == null) NIOUtils.closeQuietly(ch);
    ret img;
  });
  // TODO: close file when not all frames are grabbed
}

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: 486 / 549
Version history: 4 change(s)
Referenced in: [show references]