我正在尝试使用FMPEG键连接两个mp4文件。我需要一个自动的过程,所以我选择了ffmpeg。我将这两个文件转换为.ts
文件,然后将它们连接起来,然后尝试对连接后的.ts
文件进行编码。这些文件是h264
和aac
编码的,我希望保持相同的质量或尽可能接近原始质量。
ffmpeg -i part1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts
ffmpeg -i part2.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part2.ts
cat part1.ts part2.ts > parts.ts
ffmpeg -y -i parts.ts -acodec copy -ar 44100 -ab 96k -coder ac -vbsf h264_mp4toannexb parts.mp4
不幸的是,在编码过程中,我从ffmpeg返回了以下错误消息:
[h264 @ 0x1012600]sps_id out of range
[h264 @ 0x1012600]non-existing SPS 0 referenced in buffering period
[h264 @ 0x1012600]sps_id out of range
[h264 @ 0x1012600]non-existing SPS 0 referenced in buffering period
[NULL @ 0x101d600]error, non monotone timestamps 13779431 >= 13779431kbits/s
av_interleaved_write_frame(): Error while opening file
这发生在编码的中途,这让我认为你不能将两个.ts文件连接在一起并让它工作。
https://stackoverflow.com/questions/7333232
复制相似问题