如何通过循环播放视频中每 x 秒的最后一秒来使音频静音?

如何通过循环播放视频中每 x 秒的最后一秒来使音频静音?

更新:

Баяр Гончикжапов 的灵感来自这个帖子,尝试过:

ffmpeg -i input.mp4 -af "volume=volume=0:enable ='gte(mod(t\,20)\,15)'" -c:v copy -c:a aac -b:a 192K output.mp4

帖子已解决,谢谢。

编辑:

我尝试了以下命令但无法做到。

ffmpeg -i input.mp4 -filter_complex "loop=loop=3:size=75:start=25" -c:a copy -t 30 output.mp4

还有其他方法可以做到这一点吗?

非常感谢您的帮助。

答案1

-f 连接

bash 脚本:

#!/bin/bash
f="input 4.mkv"
DUR=$(ffprobe -v 0 -show_entries format=duration -of default=nw=1:nk=1 "$f")
echo $DUR
DUR=${DUR%.*}
ITS=0
OTS=20
IT2=19
l="list.txt"
echo "ffconcat version 1.0" > $l
while (( $OTS < $DUR )); do
  echo "file '$f'" >> $l
  echo "inpoint $ITS" >> $l
  echo "outpoint $OTS" >> $l
  for i in $(seq 1 5); do
    echo "file '$f'" >> $l
    echo "inpoint $IT2" >> $l
    echo "outpoint $OTS" >> $l
  done
  ITS=$OTS
  ((OTS=$ITS+20))
  ((IT2=$OTS-1))
done
echo "file '$f'" >> $l
echo "inpoint $ITS" >> $l
cat $l
ffmpeg -f concat -safe 0 -i $l -y output.mp4
mpv output.mp4

powershell脚本:

$f = "input 4.mkv"
$DUR = ffprobe -v 0 -show_entries format=duration -of default=nw=1:nk=1 "$f"
$DUR
$ITS = 0
$OTS = 20
$IT2 = 19
$l = "list.txt"
"ffconcat version 1.0" | Out-File -encoding ASCII $l
while ( $OTS -lt $DUR ) {
  $s += "file '$f'
inpoint $ITS
outpoint $OTS
"
  (1..5).foreach{
    $s += "file '$f'
inpoint $IT2
outpoint $OTS
"
  }
  $ITS = $OTS
  $OTS = $ITS + 20
  $IT2 = $OTS - 1
}
$s += "file '$f'
inpoint $ITS
"
$s | Out-File -encoding UTF8 -append $l
Get-Content $l
ffmpeg -f concat -safe 0 -i $l -y output.mp4
ffplay output.mp4

相关内容