串联mka文件但保留时间戳 [英] Concatenating mka files but keeping timestamp

查看:84
本文介绍了串联mka文件但保留时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试混合一些来自 FFMPEG 的mka文件,这些文件来自Twilio视频会议录像.我正在尝试为每个参与者获取曲目,但是我试图从文件中保留整体时间戳.

I am trying to mix a few files with FFMPEG that are mka and are from a Twilio Video Conference recording. I am trying to get tracks for each participant but I am trying to keep the overall timestamp from the file.

具体示例:我有以下三个文件:

Concrete example: i have these three files:

0PA1896e43f4ca0edf17d8dbfc0bab95a52.mka
1PA2a640f11bc13af2c29397800f058cb05.mka
2PA9fa5b32edc016f6f5b9669bb9b308d97.mka

这些文件是通话中参与者的所有曲目,但在不同的时间加入(离开会议并重新进入,会生成一个新文件).

These files are all tracks of a participant in the call but joined at different times(left the meeting and re-entered, results in a new file).

我想将那些文件混合在一个文件中,同时保留记录时的时间戳.FFProbe显示了每个文件的开头:

I want to mix those files in a single file while keeping the timestamp when it was recorded. FFProbe shows the start of each of this files:

0PA1896e43f4ca0edf17d8dbfc0bab95a52.mka - Duration: 00:00:17.87, start: 1.360000, bitrate: 78 kb/s
1PA2a640f11bc13af2c29397800f058cb05.mka - Duration: 00:00:22.76, start: 22.521000, bitrate: 78 kb/s
2PA9fa5b32edc016f6f5b9669bb9b308d97.mka - Duration: 00:00:20.36, start: 48.944000, bitrate: 78 kb/s

因此,应该使第一个00:00:17.87保持静音,然后从00:00:22.76添加第二个文件,并从48.944000添加第三个文件.这将导致单个文件中添加了所有这三个记录,但是在没有任何内容的情况下却保持了静音,并且添加了所有记录.实际上,我希望一开始能有所延迟.

So the first 00:00:17.87 should be silenced, then append the second file from 00:00:22.76 and the third from 48.944000. This would result a single file with all those 3 recording added but with silence when there is nothing, with all the recordings added. Practically, i want a delay at the start.

想象一下,我要添加一个从第2分钟开始的第4条记录,在记录3和4之间将是一片寂静.

Imagine i'm adding a 4th recording that starts at minute 2, between recording 3 and 4 would be a gap of silence.

或者想象有3个参与者参加的呼叫,但是第3个参与者只能从第5分钟开始进入.前5分钟应该保持静音,这样我可以将trascribe api传递给第3个参与者并且仍然获得正确的时间戳.

Or imagine a call with 3 participants but the 3rd one would enter only from minute 5. The first 5 minutes should be silenced so I can pass the trascribe api the 3rd participant and still get the correct timestamps.

我想要这种方式的原因是因为我想将音频转录为文本,并希望可以听到文本的确切时间戳.

The reason i want it this way is because I want to transcribe the audio to text and want the exact timestamp when the text can be heard.

推荐答案

您将为此使用aresample和amix过滤器.aresample过滤器将应用于每个输入,以便在开始时间戳之前插入静音.然后将这些处理后的流与混合过滤器混合在一起.

You would use the aresample and amix filters for this. The aresample filter will be applied to each input in order to insert silence till the starting timestamp. These processed streams are then mixed together with the amix filter.

我将调用输入0.mka,1.mka和2.mka

I'm going call the inputs 0.mka, 1.mka and 2.mka

ffmpeg -copyts -i 0.mka -i 1.mka -i 2.mka -filter_complex "[0]aresample=async=1:first_pts=0[a0];[1]aresample=async=1:first_pts=0[a1];[2]aresample=async=1:first_pts=0[a2];[a0][a1][a2]amix=inputs=3" out.mka

这篇关于串联mka文件但保留时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆