海康rtsp拉流,rtmp推流,nginx部署转flv集成
项目实际使用并测试经正式使用无问题,有问题欢迎评论留言
核心后台java代码:
try {// FFmpeg命令String command = "ffmpeg -re -i my_video.mp4 -c copy -f flv rtmp://localhost:1935/live/mystream";// 执行命令Process process = Runtime.getRuntime().exec(command);// 获取命令输出流InputStream inputStream = process.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));// 打印命令输出String line;while ((line = reader.readLine()) != null) {System.out.println(line);}// 等待命令执行完成int exitCode = process.waitFor();System.out.println("Exit code: " + exitCode);} catch (IOException | InterruptedException e) {e.printStackTrace();}
资源下载地址