gpt4 book ai didi

ffmpeg - 录制时音频/视频不同步

转载 作者:行者123 更新时间:2023-12-04 23:02:05 27 4
gpt4 key购买 nike

我正在用 gdigrab 录制桌面,用 dshow 录制音频,但它们不同步。

这是我尝试的第一件事,总是有大约相同的延迟(大约 20-30 帧):

// Command
ffmpeg -f dshow -i audio="Microphone (NVIDIA RTX Voice)" -f gdigrab -framerate 60 -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -c:v h264 -preset ultrafast -qp 0 C:\Videos\test2.mp4

// Bottom of debug log
Input file #0 (audio=Microphone (NVIDIA RTX Voice)):
Input stream #0:0 (audio): 15 packets read (1323000 bytes); 15 frames decoded (330750 samples);
Total: 15 packets (1323000 bytes) demuxed
Input file #1 (desktop):
Input stream #1:0 (video): 223 packets read (1849663242 bytes); 223 frames decoded;
Total: 223 packets (1849663242 bytes) demuxed
Output file #0 (C:\Videos\test2.mp4):
Output stream #0:0 (video): 243 frames encoded; 243 packets muxed (211227447 bytes);
Output stream #0:1 (audio): 322 frames encoded (329728 samples); 323 packets muxed (120103 bytes);
Total: 566 packets (211347550 bytes) muxed
238 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000028163c9c040] Statistics: 2 seeks, 810 writeouts

我尝试的第二件事我相信解决了音频同步问题,但我真的可以说出来,因为它使录音非常滞后:
// Command
ffmpeg -f gdigrab -framerate 60 -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -f dshow -i audio="Microphone (NVIDIA RTX Voice)" -c:v h264 -preset ultrafast -qp 0 C:\Videos\test2.mp4

// Bottom of debug log
Input file #0 (desktop):
Input stream #0:0 (video): 112 packets read (928978848 bytes); 112 frames decoded;
Total: 112 packets (928978848 bytes) demuxed
Input file #1 (audio=Microphone (NVIDIA RTX Voice)):
Input stream #1:0 (audio): 12 packets read (1058400 bytes); 12 frames decoded (264600 samples);
Total: 12 packets (1058400 bytes) demuxed
Output file #0 (C:\Videos\test2.mp4):
Output stream #0:0 (video): 388 frames encoded; 388 packets muxed (109408287 bytes);
Output stream #0:1 (audio): 258 frames encoded (264192 samples); 259 packets muxed (96404 bytes);
Total: 647 packets (109504691 bytes) muxed
124 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000019da713c040] Statistics: 2 seeks, 421 writeouts

如何同步音频和视频?

原来只有麦克风有延迟,我尝试使用 virtual-audio-capturer设备和音频完美同步,但这只是桌面音频而不是麦克风。

最佳答案

尝试将设备从 RTX 更改为您的实际设备。

关于ffmpeg - 录制时音频/视频不同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62375922/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com