ffmpeg中的问题amix音频过滤器后的时间戳计算

时间:2016-04-25 11:41:41

标签: audio ffmpeg media-player avaudioplayer decoder

我正在开发一个使用ffmpeg的音频播放器应用程序,它将处理动态音频trac切换和混音。 我能够动态地成功实现轨道切换。但我在音频混音方面面临挑战。

我使用“amix”音频滤镜来混合多个音轨。我能够成功混合音轨。但是当我尝试在音频混合后提取时间戳(使用av_frame_get_best_effort_timestamp)时,我得到了不连续的音频时间戳。请以不同的时间间隔查看下面给出的日志快照。任何有助于确定问题的帮助将不胜感激。谢谢。如果您需要更多信息,请与我们联系。

框架位置计算:


    double realTime = av_frame_get_best_effort_timestamp(RawFrame)
    auto formatContext = m_FFMpegData->formatContext();
    auto timeBase = formatContext->streams[streamId]->time_base;
    double framePosition = realTime * av_q2d(timeBase);

图表:

Amix filter graph

               

    Logs:
    -----------------------------
    DEC  -> Pos:  "00:00:00:20"
    DEC  -> Pos:  "00:00:00:22"
    DEC  -> Pos:  "00:00:00:24"
    Issue in Audio Timestamp continuity
    DEC  -> Pos:  "00:00:00:22"
    DEC  -> Pos:  "00:00:00:23"
    DEC  -> Pos:  "00:00:00:24"

    -----------------------------
    DEC  -> Pos:  "00:00:03:16"
    DEC  -> Pos:  "00:00:03:17"
    DEC  -> Pos:  "00:00:03:27"
    Issue in Audio Timestamp continuity
    DEC  -> Pos:  "00:00:03:18"
    DEC  -> Pos:  "00:00:03:19"
    DEC  -> Pos:  "00:00:03:20"

    -----------------------------
    DEC  -> Pos:  "00:00:04:08"
    DEC  -> Pos:  "00:00:04:09"
    DEC  -> Pos:  "00:00:04:21"
    Issue in Audio Timestamp continuity
    DEC  -> Pos:  "00:00:04:10"
    DEC  -> Pos:  "00:00:04:10"
    DEC  -> Pos:  "00:00:04:11"

    -----------------------------
    DEC  -> Pos:  "00:00:06:12"
    DEC  -> Pos:  "00:00:06:13"
    DEC  -> Pos:  "00:00:07:00"
    Issue in Audio Timestamp continuity
    DEC  -> Pos:  "00:00:06:14"
    DEC  -> Pos:  "00:00:06:15"
    DEC  -> Pos:  "00:00:06:15"

    -----------------------------
    DEC  -> Pos:  "00:00:07:03"
    DEC  -> Pos:  "00:00:07:05"
    DEC  -> Pos:  "00:00:07:24"
    Issue in Audio Timestamp continuity
    DEC  -> Pos:  "00:00:07:05"
    DEC  -> Pos:  "00:00:07:06"
    DEC  -> Pos:  "00:00:07:07"

    -----------------------------
    DEC  -> Pos:  "00:00:09:07"
    DEC  -> Pos:  "00:00:09:09"
    DEC  -> Pos:  "00:00:10:04"
    Issue in Audio Timestamp continuity
    DEC  -> Pos:  "00:00:09:10"
    DEC  -> Pos:  "00:00:09:10"
    DEC  -> Pos:  "00:00:09:11"
    

0 个答案:

没有答案