How to add chapters into mp4/mkv file using ffmpeg?

家住魔仙堡 提交于 2019-12-06 03:28:26

The ffmetadata format allows you to add chapters to a file.

Have a look at https://ffmpeg.org/ffmpeg-formats.html#Metadata-1 for an example.

cippu_lux

Sorry maybe I'm not clear, and editing the answer I have messed up worst. I'm not English.

Like Alex Zubkov I want add chapters to video with ffmpeg via cmd.

The instruction in the page linked by MRousse don help me at all, but help me to solve 1st problem:

  1. Problem file was not in UTF-8.
  2. Problem was not unix.

So I take the file from the video with ffmpeg -i input.mkv -f ffmetadata metafile

I left the file without extension and edited with notepad++, as visible in this pic


that are unix.

If I create a new file with notepad++ it is like this


and not work, maybe was because I'm on windows and not on linux.

This is the file used for add chapters:

;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1
START=0
END=180
title=chapter \#1
[CHAPTER]
TIMEBASE=1/1
START=181
END=350
title=chapter \#2
[CHAPTER]
TIMEBASE=1/1
START=351
END=600
title=chapter \#3

With this I insert the chapter in the video file:

ffmpeg -i "input.mp4" -i meta -map_metadata 1 -codec copy output[with_meta].mp4

This solved the problem I have. Hope now I'm more clear, or I've not understood the question and I'm sorry.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!