0

I'm creating an application built with the electron framework (to run html5 apps). I want to open m4v files from the webplayer, but i also need the video chapters. Electron should have an API to open the video file like a simple text file, so how are those chapters formatted? Do anyone know a javascript method or library to extract those info?

Also if anyone has a reference to a good documentation about this format, i would be happy to analyse it myself.

Thank you very much in advance!

Drago96
  • 1,265
  • 10
  • 19

1 Answers1

0

Found a way to do it myself, so I'll post it here to help future readers. This is not done using only javascript and rely on third part tools that you should find online. If someone has a better answer I'll be glad to read it!

You should find a tool that is able to extract the chapters from videos that works as standalone from the console. Then you can start the standalone as a child process and get the output. I used ffprobe in my test.

Example code

const child_process = require("child_process");

var output = child_process.execSync("./tools/ffprobe -show_chapters path_to_video.mp4");
var string = Utf8ArrayToStr(output);

Here i downloaded a standalone of the ffprobe program and put it in the tools folder inside my project directory. Then i start that program as a child process and get the output. The output is in utf8 array, so i had to convert it. A function to translate utf8 array to string can be found in this stack overflow question. After that, you should just parse the output as your program requires.

Community
  • 1
  • 1
Drago96
  • 1,265
  • 10
  • 19