// Is this a packet from the video stream?
if (packet.stream_index() == videoStream) {
// Decode video frame
int len = avcodec_decode_video2(pCodecCtx, pFrame, frameFinished, packet);
LongPointer opaque = new LongPointer(pFrame.opaque());
if (packet.dts() != AV_NOPTS_VALUE) {
pts = packet.dts();
} else if (!opaque.isNull() && opaque.get() != AV_NOPTS_VALUE) {
pts = opaque.get();
} else {
pts = 0;
}
AVRational time_base = pStream.time_base();
pts = 1000*pts*time_base.num()/time_base.den();