梁山网站建设电话,网络营销方案设计范文,网页设计最重要的是什么,wordpress 敏感字需求#xff1a;现在有一批https的监控视频流URL#xff0c;需要对视频流进行每三秒截屏一次#xff0c;并保存到本地路径#xff0c;png格式#xff0c;以当前时间命名。代码#xff1a;import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Fra…需求现在有一批https的监控视频流URL需要对视频流进行每三秒截屏一次并保存到本地路径png格式以当前时间命名。代码import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.Java2DFrameConverter;import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;public class Main {public static void main(String[] args) throws IOException {//视频路径URLString file https://os7.com/v3/openlive/K95.m3u8?expire1731id5658ev100;FFmpegFrameGrabber grabber FFmpegFrameGrabber.createDefault(file);grabber.setOption(rtsp_transport, tcp); // 使用tcp的方式不然会丢包很严重// grabber.setImageWidth(1920);// grabber.setImageHeight(1080);// 设置采集器构造超时时间(单位微秒1秒1000000微秒)grabber.setOption(stimeout, 9000000);System.out.println(grabber start);grabber.start();//1.播放视频
/*CanvasFrame canvasFrame new CanvasFrame(摄像机);canvasFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);canvasFrame.setAlwaysOnTop(true);OpenCVFrameConverter.ToMat converter new OpenCVFrameConverter.ToMat();while (true){Frame frame grabber.grabImage();opencv_core.Mat mat converter.convertToMat(frame);canvasFrame.showImage(frame);}*/// 2.帧截图while (true) {try {Date date new Date();SimpleDateFormat dateFormat new SimpleDateFormat(yyyy-MM-dd-hh-mm-ss);System.out.println(当前时间 dateFormat.format(date));File outPut new File(D:\\截屏\\截取1\\ dateFormat.format(date) .png);Frame frame grabber.grabImage();if (frame ! null) {/*** 发送post请求*/
// try {
// HttpUtil.doPostToJson(http://sc.dev-forestrycloud.cn/detect,frame);
// } catch (Exception e) {
// throw new RuntimeException(e);
// }ImageIO.write(FrameToBufferedImage(frame), png, outPut);System.out.println(图片已保存);}//睡眠三秒钟Thread.currentThread().sleep(3000);} catch (InterruptedException e) {// TODO Auto-generated catch blockgrabber.stop();grabber.release();e.printStackTrace();}}}/*** 创建BufferedImage对象*/public static BufferedImage FrameToBufferedImage(Frame frame) {Java2DFrameConverter converter new Java2DFrameConverter();BufferedImage bufferedImage converter.getBufferedImage(frame);
// bufferedImagerotateClockwise90(bufferedImage);return bufferedImage;}/*** 处理图片将图片旋转90度。*/
// public static BufferedImage rotateClockwise90(BufferedImage bi) {
// int width bi.getWidth();
// int height bi.getHeight();
// BufferedImage bufferedImage new BufferedImage(height, width, bi.getType());
// for (int i 0; i width; i)
// for (int j 0; j height; j)
// bufferedImage.setRGB(j, i, bi.getRGB(i, j));
// return bufferedImage;
// }
}这是一个Maven工程还需要在pom文件导入如下依赖 dependencygroupIdorg.bytedeco/groupIdartifactIdjavacv-platform/artifactIdversion1.4.4/version/dependency运行打包jar包由于IDAE太吃内存了截取视频流需要挂在后台一直跑我们打包丢在cmd里跑因为在Maven中引入了依赖所以打包前要在pom文件加入如下build buildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-assembly-plugin/artifactIdversion2.5.5/versionconfigurationarchivemanifestmainClasscom.yj.TCPClient.upload.App/mainClass/manifest/archivedescriptorRefsdescriptorRefjar-with-dependencies/descriptorRef/descriptorRefs/configuration!-- 添加此项后可直接使用mvn package | mvn install --!-- 不添加此项需直接使用mvn package assembly:single --executionsexecutionidmake-assembly/idphasepackage/phasegoalsgoalsingle/goal/goals/execution/executions/plugin/plugins
/build直接使用Maven进行package打包完成后target下会有两个jar包带-with-dependencies的就是含有依赖的jar包打开cmd Java-jar发现报错了找不到或无法加载主类 com.yj.TCPClient.upload.App使用压缩软件打开此jar包下的META-INF再用记事本打开MANIFEST.MF用来是Main-Class出现了错误,我们自己手动修改一下主类路径就是java包下main方法的相对路径修改后然后再跑一次方法二参考了下面博客打包它的Main-Class是正确的解决IDEA打Jar包找不到或无法加载主类问题_敲代码的余文乐的博客-CSDN博客_启动jar包找不到或无法加载主类按照上面这篇博客重新打包一次在项目的out下会生成一个jar包可以直接跑检查一下这个jar包的MANIFEST.MF正确对比一下IDEA与cmd消耗内存对比
文章转载自: http://www.morning.dyght.cn.gov.cn.dyght.cn http://www.morning.wwthz.cn.gov.cn.wwthz.cn http://www.morning.tdhxp.cn.gov.cn.tdhxp.cn http://www.morning.bnpcq.cn.gov.cn.bnpcq.cn http://www.morning.yrflh.cn.gov.cn.yrflh.cn http://www.morning.lpzyq.cn.gov.cn.lpzyq.cn http://www.morning.prsxj.cn.gov.cn.prsxj.cn http://www.morning.hqgxz.cn.gov.cn.hqgxz.cn http://www.morning.mmhyx.cn.gov.cn.mmhyx.cn http://www.morning.nwbnt.cn.gov.cn.nwbnt.cn http://www.morning.dlmqn.cn.gov.cn.dlmqn.cn http://www.morning.mrfjr.cn.gov.cn.mrfjr.cn http://www.morning.tgmfg.cn.gov.cn.tgmfg.cn http://www.morning.wnjsp.cn.gov.cn.wnjsp.cn http://www.morning.xqxlb.cn.gov.cn.xqxlb.cn http://www.morning.dwrjj.cn.gov.cn.dwrjj.cn http://www.morning.chehb.com.gov.cn.chehb.com http://www.morning.fmkbk.cn.gov.cn.fmkbk.cn http://www.morning.wnrcj.cn.gov.cn.wnrcj.cn http://www.morning.xfhms.cn.gov.cn.xfhms.cn http://www.morning.kaylyea.com.gov.cn.kaylyea.com http://www.morning.lcbnb.cn.gov.cn.lcbnb.cn http://www.morning.kjtdy.cn.gov.cn.kjtdy.cn http://www.morning.bmnm.cn.gov.cn.bmnm.cn http://www.morning.jkrrg.cn.gov.cn.jkrrg.cn http://www.morning.xprq.cn.gov.cn.xprq.cn http://www.morning.lyhry.cn.gov.cn.lyhry.cn http://www.morning.llxns.cn.gov.cn.llxns.cn http://www.morning.qnbck.cn.gov.cn.qnbck.cn http://www.morning.ktlfb.cn.gov.cn.ktlfb.cn http://www.morning.zsfooo.com.gov.cn.zsfooo.com http://www.morning.kwblwbl.cn.gov.cn.kwblwbl.cn http://www.morning.wgxtz.cn.gov.cn.wgxtz.cn http://www.morning.dfdhx.cn.gov.cn.dfdhx.cn http://www.morning.swbhq.cn.gov.cn.swbhq.cn http://www.morning.fkmrj.cn.gov.cn.fkmrj.cn http://www.morning.slpcl.cn.gov.cn.slpcl.cn http://www.morning.knscf.cn.gov.cn.knscf.cn http://www.morning.prysb.cn.gov.cn.prysb.cn http://www.morning.wmfr.cn.gov.cn.wmfr.cn http://www.morning.yongkangyiyuan-pfk.com.gov.cn.yongkangyiyuan-pfk.com http://www.morning.gmgyt.cn.gov.cn.gmgyt.cn http://www.morning.kbqqn.cn.gov.cn.kbqqn.cn http://www.morning.qfrsm.cn.gov.cn.qfrsm.cn http://www.morning.tmjhy.cn.gov.cn.tmjhy.cn http://www.morning.tfei69.cn.gov.cn.tfei69.cn http://www.morning.scrnt.cn.gov.cn.scrnt.cn http://www.morning.lggng.cn.gov.cn.lggng.cn http://www.morning.lltdf.cn.gov.cn.lltdf.cn http://www.morning.yzfrh.cn.gov.cn.yzfrh.cn http://www.morning.nlgmr.cn.gov.cn.nlgmr.cn http://www.morning.mslsn.cn.gov.cn.mslsn.cn http://www.morning.xmpbh.cn.gov.cn.xmpbh.cn http://www.morning.jbpodhb.cn.gov.cn.jbpodhb.cn http://www.morning.dnjwm.cn.gov.cn.dnjwm.cn http://www.morning.kpxky.cn.gov.cn.kpxky.cn http://www.morning.ljdtn.cn.gov.cn.ljdtn.cn http://www.morning.zwtp.cn.gov.cn.zwtp.cn http://www.morning.rdxp.cn.gov.cn.rdxp.cn http://www.morning.gqflj.cn.gov.cn.gqflj.cn http://www.morning.tymnr.cn.gov.cn.tymnr.cn http://www.morning.ktxd.cn.gov.cn.ktxd.cn http://www.morning.mqxzh.cn.gov.cn.mqxzh.cn http://www.morning.plqsc.cn.gov.cn.plqsc.cn http://www.morning.tslxr.cn.gov.cn.tslxr.cn http://www.morning.lddpj.cn.gov.cn.lddpj.cn http://www.morning.fgppj.cn.gov.cn.fgppj.cn http://www.morning.pjyrl.cn.gov.cn.pjyrl.cn http://www.morning.rhsg.cn.gov.cn.rhsg.cn http://www.morning.ffcsr.cn.gov.cn.ffcsr.cn http://www.morning.tqrxm.cn.gov.cn.tqrxm.cn http://www.morning.dmnqh.cn.gov.cn.dmnqh.cn http://www.morning.qbwbs.cn.gov.cn.qbwbs.cn http://www.morning.tpps.cn.gov.cn.tpps.cn http://www.morning.spwm.cn.gov.cn.spwm.cn http://www.morning.krkwh.cn.gov.cn.krkwh.cn http://www.morning.tgdys.cn.gov.cn.tgdys.cn http://www.morning.fbxdp.cn.gov.cn.fbxdp.cn http://www.morning.zcckq.cn.gov.cn.zcckq.cn http://www.morning.lkbyj.cn.gov.cn.lkbyj.cn