gpt4 book ai didi

audio - 在mp4文件中只延迟一个 channel 的音频流

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

如何仅对包含立体声音频流的 mp4 的 1 个音频 channel 应用延迟?

我有一个视频test.mp4有 2 个流:

Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 8042 kb/s, 60 fps, 60 tbr, 60k tbn (default)
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s (default)
如您所见,AAC 音轨是立体声的。我需要申请 2 秒 延迟到 音频流中的 channel (流 1)。
这是一个成功地为两个音频流( detailed description here )执行此操作的脚本:
ffmpeg -i "test.mp4" -itsoffset 2 -i "test.mp4" -map 0:v -map 1:a -c:v copy "test_delay.mp4"
基本上它使用 -map获取输入 ID 0 的选项的 v视频流( -i "test.mp4" 是第一个未延迟的输入,ID 为 0),以及输入 ID 1a音频流( -itsoffset 2 -i "test.mp4" 是第二个延迟 2 秒的输入,ID 为 1 )组成最终输出。
我想我应该尝试使用 -map_channel 相反,但我很困惑如何将它与 -itsoffset 合并选项也是如此。
以下结果是没有音频流的视频:
ffmpeg -i "test.mp4" -itsoffset 2 -i "test.mp4" -map 0:v -map_channel 1.1.0:0.0 -map_channel 1.1.1:0.1 -c:v copy "test_delay.mp4"
以下(包括 -map 1:a 这次)导致 R ch 成功延迟,但根本没有 L ch(单声道音频流):
ffmpeg -i "test.mp4" -itsoffset 2 -i "test.mp4" -map 0:v -map 1:a -map_channel 1.1.0:0.0 -map_channel 1.1.1:0.1 -c:v copy "test_delay.mp4"
有小费吗?

该命令将由自动化且不受监控的系统运行,因此如果可能的话,我真的试图将其限制为仅执行 1 个命令。

最佳答案

使用 adelay 筛选:

ffmpeg -i "test.mp4" -i "test.mp4" \
-filter_complex[1:a]adelay=0|2000[out] \
-map 0:v -c:v copy "test_delay.mp4"
adelay以毫秒为单位进行一系列延迟,由 | 分隔, 立体声 channel 布局为 LEFT|RIGHT所以将第二个延迟设置为 2000 毫秒。

关于audio - 在mp4文件中只延迟一个 channel 的音频流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71566185/

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