-
Notifications
You must be signed in to change notification settings - Fork 315
Home
Welcome to the jcodec wiki!
Decode all frames from a file
File file = new File("video.mp4");
FrameGrab grab = FrameGrab.createFrameGrab(NIOUtils.readableChannel(file));
Picture picture;
while (null != (picture = grab.getNativeFrame())) {
System.out.println(picture.getWidth() + "x" + picture.getHeight() + " " + picture.getColor());
}
Why did you decide to do -128..+127
instead of 0..255
?
Do all of the color transforms support -128..+127
?
@svitvitskiy
The range -128..127
was chosen because it is a native range for the byte type. Alternatively standard range of 0..255
could be used but this creates a necessity to use &0xff
all the time in the code. All the transforms that used to be called *8Bit
support this range in a form of adjusted clipping ranges. All the arithmetics is the same regardless of the actual range. The range conversion happens only when the final platform-specific image gets extracted (i.e. BufferedImage or Bitmap) if ever.
Transcoder will automatically insert the necessary color transforms in between filters to build the pipeline. All we have to do is just declare that the filter inputs and outputs are RGB.