简体   繁体   English

将MP4输入流中的章节复制到ffmpeg中的输出流

[英]Copy chapters in MP4 input stream to output stream in ffmpeg

I'm using ffmpeg to copy two MP4 input streams into one output container and I'm having trouble maintaining the chapter indexes from both files into the output stream. 我正在使用ffmpeg将两个MP4输入流复制到一个输出容器中,并且在将两个文件的章节索引维护到输出流中时遇到问题。

I have two files, specified by streams.txt which is in the correct format, that both contain an H.264 video stream, an AC-3 audio stream and an AAC audio stream, and am concatenating the two files using the following ffmpeg command: 我有两个文件,由streams.txt以正确的格式指定,它们都包含H.264视频流,AC-3音频流和AAC音频流,并使用以下ffmpeg命令将这两个文件串联起来:

ffmpeg -f concat -safe 0 -i streams.txt -map 0:0 -map 0:1 -map 0:2 -c:v copy -c:a:0 copy -c:a:1 copy output.mp4

This correctly produces the output file that I want, with both files combined into an output file with all three streams. 这样可以正确生成我想要的输出文件,并且两个文件都合并为具有所有三个流的输出文件。 I am however having trouble adding the chapters from both input files into the output one. 但是,我无法将两个输入文件中的章节添加到输出文件中。 I understand that I'm supposed to use the -map_metadata option, but I'm having trouble with the format of it that doesn't produce the following error message: 我知道我应该使用-map_metadata选项,但是我在使用它的格式时遇到了麻烦,该格式不会产生以下错误消息:

Invalid chapter index 0 while processing metadata maps.

事实证明ffmpeg当前不支持MP4容器的章节串联。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM