赞
踩
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-websocket</artifactId>
- <version>5.2.5.RELEASE</version>
- <scope>compile</scope>
- </dependency>
- import org.apache.log4j.Logger;
- import org.springframework.web.socket.BinaryMessage;
- import org.springframework.web.socket.WebSocketSession;
-
- import java.io.InputStream;
- import java.util.List;
-
-
- /**
- * <pre>
- * TODO:视频工具类
- * </pre>
- *
- * @author zhangjunchao
- * @date 2019/8/19
- */
- public class VideoUtils {
- private final static Logger logger = Logger.getLogger(VideoUtils.class);
- // 声明的ffmpeg.exe固定路径变量
- public String FFMPEG_PATH = "D:/ffmpeg/bin/ffmpeg.exe";
- public String channel = "";
- public WebSocketSession webSocketSession = null;
- private Process process;
-
-
- public VideoUtils(String channel, WebSocketSession webSocketSession) {
- // ffmpeg路径需要更换自己的
- FFMPEG_PATH = "D:\\developsoftware\\wisdom_screen_ds1200\\server\\ETCMornitoring\\src\\main\\resources" +
- "\\export_template" +
- "\\ffmpeg.exe";
- this.channel = channel;
- this.webSocketSession = webSocketSession;
- }
- /**
- * 视频转换
- *
- * @param video_path
- */
- public void convertCommand() {
- String channel = this.channel;
- WebSocketSession webSocketSession = this.webSocketSession;
- System.out.println("start");
- System.out.println(FFMPEG_PATH);
- InputStream errorStream = null;
- InputStream inputStream = null;
- try {
- List<String> commands = new java.util.ArrayList<String>();
- commands.add(FFMPEG_PATH);
- commands.add("-rtsp_transport");
- commands.add("tcp");
- commands.add("-i");
- commands.add(channel);
- commands.add("-vcodec");
- co
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。