sb3*_*b3k 5 audio video ffmpeg
我一直在尝试使用此处记录的 FFMPEG concat 协议连接多个 MP4 剪辑 (h264,aac) 。剪辑成功连接,但日志中有多个错误,包括:
此外,随着更多剪辑的添加,音频和视频似乎略微不同步 - 尽管在某些播放器(Quicktime 和 Chrome HTML5)上更明显。
这是我正在使用的代码,任何提示将不胜感激!
将每个视频转换为临时文件
ffmpeg -y -i <input file> -vcodec libx264 -acodec aac -f mpegts -bsf:v h264_mp4toannexb -mpegts_copyts 1 <temp file>
连接临时文件
ffmpeg -i concat <input1|input2 ...> -map 0 -vcodec copy -aprofile aac_low -acodec aac -strict experimental -cutoff 15000 -vbsf aac_adtstoasc -b:a 32k <output file>
由于您要对音频和视频进行编码,因此只需使用 concat 解复用器:
创建一个文本文件,其中包含要加入的文件列表
file 'input1'
file 'input2'
file 'input3'
...
Run Code Online (Sandbox Code Playgroud)
然后运行
ffmpeg -f concat -i textfile -map 0 \
-vcodec libx264 \
-aprofile aac_low -acodec aac -strict experimental -cutoff 15000 -b:a 32k <output file>
Run Code Online (Sandbox Code Playgroud)