Question: I'm using jcodec for frame extraction from mp4 files, 
and creating a new video file from the images.

However, I'm taking hard time for getting the total number of frame in jcodec.
(And I've looked the jcodec sources, but I cannot find it..)

Does jcodec provides this?
Or should I use other libraries?

Answer: 
For me this code return info:

```
FileChannelWrapper ch = NIOUtils.readableFileChannel(new File("c:/trans/test.mp4"));
MP4Demuxer demuxer = new MP4Demuxer(ch);
DemuxerTrack video_track = demuxer.getVideoTrack();
System.out.println("video_duration: " + video_track.getMeta().getTotalDuration());
System.out.println("video_frame: " + video_track.getMeta().getTotalFrames());

```
Maybe need opencv:

```java
import com.googlecode.javacv.cpp.opencv_highgui;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
/**
* sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
* sudo apt-get update
* sudo apt-get install ffmpeg
*There is opencv_ffmpeg_64.dll file in /home/fang/BigDataSoft/opencv-2.4.13/3rdparty/ffmpeg
*/
public class GetFrameFormVideo {
public static void main(String[] args) {
// System.out.println("Welcome to OpenCV " + Core.VERSION);
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
// Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
// System.out.println("m = " + m.dump());
//Load the local OpenCV library so that you can use it to call the Java API
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
run2();
}
public static void run2() {
//Read video file
VideoCapture cap = new VideoCapture("/home/fang/Downloads/src_11.mp4");
System.out.println(cap.isOpened());
//Determine whether the video is open
if (cap.isOpened()) {

double frameCount = cap.get(opencv_highgui.CV_CAP_PROP_FRAME_COUNT);
System.out.println("Total video frames:"+frameCount);

double fps = cap.get(opencv_highgui.CV_CAP_PROP_FPS);
System.out.println("Video frame rate"+fps);

double len = frameCount / fps;
System.out.println("Total video duration:"+len);
Double d_s = new Double(len);
System.out.println(d_s.intValue());
Mat frame = new Mat();
for (int i = 0; i < d_s.intValue(); i++) {
//Set the position of the video (unit: milliseconds)
cap.set(opencv_highgui.CV_CAP_PROP_POS_MSEC, i * 1000);
//Read the next frame
if (cap.read(frame)) {
System.out.println("Saving");
//Save the picture to the local directory
Highgui.imwrite("/home/fang/images/" + i + ".jpg", frame);
}
}
//Close video file

```