我试图创建一条管道,将一个文件播放到我的耳机中,并创建一个音箱,它将我的麦克风的输出和文件中的音频混合在一起,然后堆放到一个虚拟音频电缆中。
换句话说,file+mic去虚拟电缆,文件也去耳机。
我注意到了一些延迟,如果我及时与我在耳机中听到的文件中的音频说话,我的麦克风的输出与文件中的音频不同步,当它从混频器出来时。
似乎我应该能够解决这个问题,从文件中添加一个延迟,因为它进入混频器,但我似乎不知道如何做到这一点。我尝试过添加一个具有最小阈值时间的队列,但是它不起作用。
到目前为止,这是我的管道:
gst-launch-1.0.exe filesrc location="C:/file.mp4" ! decodebin ! audioconvert ! audioresample ! volume volume=0.25 ! tee name=t ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 min-threshold-time=1000000000 ! audiomixer name=mix alignment-threshold=0 ! queue ! wasapisink device="virtual cable sink" \
wasapisrc device="mic" low-latency=true ! decodebin ! audioconvert ! audioresample ! volume volume=4 ! mix.
t. ! queue! wasapisink device="headphones" 发布于 2022-06-06 13:19:44
据我所知,你有三种选择:
i)实现一个缓冲区探测,它将使您能够修改单个数据包的时间戳。见管道操纵。
(2)使用G-Streamer的插件rtpjitterbuffer,该插件具有ts-offset属性,可用于调整麦克风输入的时间戳,以实现源之间的同步:
(3)向管道添加延迟,如下所示:
pipeline = gst_pipeline_new ("mypipe");
gstpipline=GST_PIPELINE (pipeline);
gst_pipeline_set_latency(gstpipline,delay you want to set in ns);https://stackoverflow.com/questions/72503337
复制相似问题