请教下大佬,采用fifo这分分支,通过ffmpeg子进程合并音视频流时,如下:
process = Runtime.getRuntime().exec(
String.format("%s -report -re -r 25 -f h264 -i %s -f h264 -f s16le -ar 8000 -ac 1 -i %s -vcodec copy -acodec aac -strict -2 "
+ " -map 0:v:0 -map 1:a:0 -probesize 512 -analyzeduration 100 -f flv %s",
Configs.get("ffmpeg.path"),
videoFifoPath,
audioFifoPath,
"/mnt/d/temp/muxTest.flv"
)
);
第一个输入管道文件 videoFifoPath可以调用FileOutputStream打开,第二则会卡死,导致音频数据无法写。我 又通过其它测试,发现用ffmpeg 接受多个管理文件输入时,只有第一个打得开
比如上 面就有如下现象:
FileOutputStream videoFos = new FileOutputStream(videoFifoPath); //可以正常执行
FileOutputStream audioFos = new FileOutputStream(audioFifoPath); //卡死在这(调试跟踪是内部方法 native open0()时卡住
这就导致音频数据无法写入,大家有这种现象吗?
请教下大佬,采用fifo这分分支,通过ffmpeg子进程合并音视频流时,如下:
process = Runtime.getRuntime().exec(
String.format("%s -report -re -r 25 -f h264 -i %s -f h264 -f s16le -ar 8000 -ac 1 -i %s -vcodec copy -acodec aac -strict -2 "
+ " -map 0:v:0 -map 1:a:0 -probesize 512 -analyzeduration 100 -f flv %s",
Configs.get("ffmpeg.path"),
videoFifoPath,
audioFifoPath,
"/mnt/d/temp/muxTest.flv"
)
);
第一个输入管道文件 videoFifoPath可以调用FileOutputStream打开,第二则会卡死,导致音频数据无法写。我 又通过其它测试,发现用ffmpeg 接受多个管理文件输入时,只有第一个打得开
比如上 面就有如下现象:
FileOutputStream videoFos = new FileOutputStream(videoFifoPath); //可以正常执行
FileOutputStream audioFos = new FileOutputStream(audioFifoPath); //卡死在这(调试跟踪是内部方法 native open0()时卡住
这就导致音频数据无法写入,大家有这种现象吗?