【问题标题】:FFMPEG concat cutting audio off after certain clipFFMPEG concat 在某些剪辑后切断音频
【发布时间】:2020-04-11 00:50:49
【问题描述】:

所以我正在使用 FFMPEG 在 Python 中创建多个视频剪辑,然后我试图将它们连接在一起。我创建了多个名为 result1000、result1001 等的视频,然后我创建了一个我想在这些视频之间分层的过渡效果。 result1000、result1001... 等完美结合在一起,但是在它们之间插入过渡效果会导致第一次过渡后的每个剪辑都丢失音频。

创建过渡

ffmpeg -loop 1 -y -i media/templates/bg.png -i media/swoosh_sound.mp3 -shortest -acodec copy -vcodec libx264rgb output/swoosh.mp4

制作视频片段

ffmpeg -loop1 -y -i image_files/image+str(1000+i)+.png -i audio_files/audio+str(1000+i)+.mp3 -shortest -acodec copy -vcodec libx264rgb output/result+str(1000+i)+.mp4

ffmpeg_files.txt 然后看起来像这样

file 'output/result1000.mp4'
file 'output/result1001.mp4'
file 'output/result1002.mp4'
file 'output/result1003.mp4'
file 'output/result1004.mp4'
file 'output/swoosh.mp4'
file 'output/result1005.mp4'
file 'output/result1006.mp4'

我使用的 concat 命令是

ffmpeg -f concat -safe 0 -i ffmpeg_files.txt output/no_bg_out.mp4

在控制台中运行 concat 注释它会说

[mov,mp4,m4a,3gp,3g2,mj2 @ 000001f289b44c40] Auto-inserting h264_mp4toannexb bitstream filter

对于每个 resultXXXX 剪辑,一旦到达过渡剪辑,它就会开始发送垃圾邮件

[mp4 @ 000001aa093ad100] Non-monotonous DTS in output stream 0:1; previous: 13619623, current: 8777816; changing to 13619624. This may result in incorrect timestamps in the output file.

我已经阅读了Here 提到的解决方案,但它们似乎都没有解决我的问题。需要注意的是,所有的视频剪辑都是由.mp3音频文件和.png图像文件创建的。

【问题讨论】:

  • 所有输入必须具有相同的属性。需要查看有关每个输入的信息。显示ffmpeg -i output/result1000.mp4 -i output/result1001.mp4 -i output/result1002.mp4 -i output/result1003.mp4 -i output/result1004.mp4 -i output/swoosh.mp4 -i output/result1005.mp4 -i output/result1006.mp4的完整输出
  • Here you go,把它放在hastebin中,因为它很长。

标签: python ffmpeg


【解决方案1】:

所有属性都必须匹配,但swoosh.mp4 与其他属性不同,音频采样率和通道布局不同。重新编码音频并重试:

ffmpeg -i swoosh.mp4 -c:v copy -c:a libmp3lame -ar 24000 -ac 1 -b:a 32k swoosh2.mp4

【讨论】:

  • 成功了,谢谢!我有另一个剪辑也完全不同,我想知道您是否可以帮助标记重新编码以使其正确。 Heres the output of a working video and the not working video
  • @legit_hacker_2000 添加scale filter。幸运的是 2560x1440 可以完美缩小到 1920x1080,所以很简单:ffmpeg -i beep.mp4 -c:v libx264rgb -vf scale=1920:-1 -c:a libmp3lame -ar 24000 -ac 1 -b:a 32k beep2.mp4
猜你喜欢
  • 1970-01-01
  • 2018-01-30
  • 1970-01-01
  • 1970-01-01
  • 2018-03-16
  • 1970-01-01
  • 2018-03-12
  • 1970-01-01
  • 2016-05-26
相关资源
最近更新 更多