目录
设想一
设想二
方案三
关键技术
测试语句
测试脚本
参考文档
设想一
//开始录制
_option.mp4_save_path = custom_path;
_option.mp4_max_second = max_second;
vector<Track::Ptr> mytracks = getTracks();
auto src = MediaSource::find( DEFAULT_VHOST, "1", "adminstream");
/* if (src) {
vector<Track::Ptr> one =src->getTracks();
mytracks.emplace_back(one[0]);
}*/
_mp4 = makeRecorder(sender, getTracks(), type, _option);
设想二
gbcomZlm->mp4test1分支
方案三
关键技术
public static void main(String[] args) {
String ffmpegExePath = "C:\\workspace\\project\\greejoy\\picManager\\web\\tools\\ffmpeg\\bin\\ffmpeg.exe";
String inputFilePath = "C:\\Users\\Dulk\\Desktop\\ukulele\\01\\《小星星》.mp4";
String outputFilePath = "C:\\Users\\Dulk\\Desktop\\ukulele\\01\\littleStarJava.jpg";
List<String> command = new ArrayList<String>();
command.add(ffmpegExePath);
command.add("-i");
command.add(inputFilePath);
command.add("-f");
command.add("image2");
command.add("-ss");
command.add("10");
command.add("-t");
command.add("0.001");
command.add("-s");
command.add("320*240");
command.add(outputFilePath);
ProcessBuilder builder = new ProcessBuilder();
builder.command(command);
//正常信息和错误信息合并输出
builder.redirectErrorStream(true);
try {
//开始执行命令
Process process = builder.start();
//如果你想获取到执行完后的信息,那么下面的代码也是需要的
StringBuffer sbf = new StringBuffer();
String line = null;
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((line = br.readLine()) != null) {
sbf.append(line);
sbf.append(" ");
}
String resultInfo = sbf.toString();
System.out.println(resultInfo);
} catch (IOException e) {
e.printStackTrace();
}
}
测试语句
ffmpeg -i D:/web-video-platform/zlm/www/record/2fbe2a926db241b483ab4ea79950fb0c/dxw3Stream/2024-04-01/142727-142741.mp4 -i D:\web-video-platform\zlm\www\record\1\adminstream\2024-04-01\142727-142743.mp4
-filter_complex "[1:a]volume=0.3[a1];[0:a][a1]amix=inputs=2:duration=first[a]" -map 0:v -map "[a]" -c:v copy -c:a aac -y d:\output.mp4f
测试脚本
/home/dualven/zlmtest 10.60.2.175
举例:
curl "http://10.60.100.196:6080/index/api/startRecord?secret=tzaaghfRyvwtQ7STrA1ag8K1xtThSk9v&type=1&vhost=__defaultVhost__&app=1&stream=adminstream"
curl "http://10.60.100.196:6080/index/api/stopRecord?secret=tzaaghfRyvwtQ7STrA1ag8K1xtThSk9v&type=1&vhost=__defaultVhost__&app=1&stream=adminstream"
参考文档
https://blog.csdn.net/xian0710830114/article/details/130921272
https://www.cnblogs.com/deng-cc/p/10123069.html命令行