java调用ffmpeg直播流
程序员文章站
2022-06-15 22:44:28
...
public static void getThumb() throws IOException,
InterruptedException {
//ffmpeg -re -i /Users/samson/Desktop/apple-iphone4-design_video-us-20100607_848x480.mov -vcodec copy -f flv rtmp://localhost:1935/live1/room2
ProcessBuilder processBuilder = new ProcessBuilder("ffmpeg",
"-re","-i", "/Users/samson/Desktop/apple-iphone4-design_video-us-20100607_848x480.mov",
"-vcodec", "copy" ,
"-f", "flv","rtmp://localhost:1935/live1/room2");
Process process = processBuilder.start();
InputStream stderr = process.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) ;
process.waitFor();
if (br != null)
br.close();
if (isr != null)
isr.close();
if (stderr != null)
stderr.close();
}
public static void main(String[] args) {
try {
getThumb();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
InterruptedException {
//ffmpeg -re -i /Users/samson/Desktop/apple-iphone4-design_video-us-20100607_848x480.mov -vcodec copy -f flv rtmp://localhost:1935/live1/room2
ProcessBuilder processBuilder = new ProcessBuilder("ffmpeg",
"-re","-i", "/Users/samson/Desktop/apple-iphone4-design_video-us-20100607_848x480.mov",
"-vcodec", "copy" ,
"-f", "flv","rtmp://localhost:1935/live1/room2");
Process process = processBuilder.start();
InputStream stderr = process.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) ;
process.waitFor();
if (br != null)
br.close();
if (isr != null)
isr.close();
if (stderr != null)
stderr.close();
}
public static void main(String[] args) {
try {
getThumb();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
上一篇: 如何使用async和await这对组合设计统一的取Access Token的函数 nodejsSAP成都研究院SAP Cloud PlatformSAP云平台SAP
下一篇: python爬虫框架scrapy使用指令
推荐阅读
-
详解java调用ffmpeg转换视频格式为flv
-
Vue调用Java接口下载文件流
-
Android 音视频深入 十六 FFmpeg 推流手机摄像头,实现直播 (附源码下载)
-
RTSP协议网络摄像头互联网直播开源流媒体平台如何用FFMPEG将RTSP视频流推给EasyDarwin做公网拉流分发?
-
FFmpeg 推流 + EasyDarwin 转发 + vlc 播放 实现 RTSP 直播
-
树莓派ffmpeg直播推送,nginx视频流接受转码,客户端hls rtmp视
-
【技术教程】如何通过Java程序调用RTSP拉流协议视频平台EasyNVR程序接口?
-
Window平台 EasyDarwin 和 ffmpeg 将视频文件转成RTSP直播推流
-
ffmpeg+nginx+dash调用摄像头直播
-
node-media-server+ffmpeg搭建直播推流服务