FFMPEG用filter_complex替换视频音频

时间:2017-02-21 13:54:56

标签: ffmpeg ffmpeg-php

我想要这样一个输出视频,其输出的音频是使用ffmpeg -filter_complex机制创建的,

/usr/local/Cellar/ffmpeg/3.2.2/bin/ffmpeg 
-i /uploads/videos/1487684390-lg9htt0RW2.mov 
-i /uploads/audios/1487664761-SCPbo6Tkac.mp3 
-filter_complex "
[0:a]atrim=0:8.70824980736,asetpts=PTS-STARTPTS[aud1]; 
[1:a]atrim=0:12.9567301273,asetpts=PTS-STARTPTS[aud2];
[0:a]volume=0.3,atrim=start=8.70824980736:21.6649799347,asetpts=PTS-STARTPTS[slow_aud]; 
[aud2][slow_aud] amerge=inputs=2[a_merged];
[0:a]atrim=start=21.6649799347:31.6410098076 [remaining_audio]; 
[aud1][a_merged][remaining_audio]concat=n=3:v=0:a=1[aout]" 
-map 0:v -map "[aout]" -c:v copy -acodec mp3 
/uploads/output/1487684390-lg9htt0RW2.mov

根据UTC时间戳记录录制的原始音频视频基于UTC时间戳录制的原始视频

            13:00-------- Original Event Audio -------- 13:20
       12:50------------- Event Video Recorded --------------13:30

这是我的要求

因此输出视频的音频应包含

  1. 前10秒(12:50 - 13:00)是录制的事件视频音频
  2. 下一个20秒(13:00-13:20)合并音频(原始音频+原始视频,其中原始视频的音频音量为.3)
  3. 剩余10秒(13:21-13:30)的视频将播放视频的剩余音频
  4. 通过以上命令获得的内容

    1. 前10秒(12:50-13:00)是录制的事件视频音频已实现
    2. 下一个20秒(13:00-13:20)合并音频(原始音频+原始视频,其中原始视频的音频音量为.3)已实现
    3. 剩余10秒(13:21-13:30)的视频将播放剩余的视频音频未实现

1 个答案:

答案 0 :(得分:1)

您无法重置剩余音频的时间戳,就像concat过滤器所需要的那样。所以,它应该是

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="maintext">
  <h2> Main text goes here...</h2>
</div>
<div id="boxes">
  <div id="dialog" class="window">
    <div id="san">
      <section>
        <select id="Rank" class="cs-select cs-skin-elastic">
          <option value="" disabled selected>Choose Language</option>
          <option value="English" data-class="flag-english">English</option>
          <option value="Arabic" data-class="flag-arabic">Arabic</option>
          <option value="French" data-class="flag-french">French</option>

        </select>
      </section>
    </div>
  </div>
  <div style="width: 2478px; font-size: 32pt; color: white; height: 1202px; display: none; opacity: 0.4;" id="mask"></div>
</div>


<div class="container">
  <div class="English">
    <select class="second-level-select">
      <option value="">-Select Your Country-</option>
      <option value="USA">Usa</option>
      <option value="India">India</option>
    </select>
  </div>

  <div class="Arabic">
    <select class="second-level-select">
      <option value="">-Select Your Country-</option>
      <option value="UAE">UAE</option>
      <option value="Kuwait">Kuwait</option>
    </select>
  </div>

</div>

实现相同结果的更简单方法是

[0:a]atrim=start=21.6649799347:31.6410098076,asetpts=PTS-STARTPTS[remaining_audio];