I have a lot of videos in MKV and I would like to add chapters to them. But I want to add chapters every time a scene ends. This is usually indicated by a black frame. I know there are software out there that can create frames automatically every x seconds/frames but as I have already said I have a lot of videos and I want chapters to begin at the transition of new scenes which happens and a black frame. So:
1. Is there a software that can do that automatically.
2. If there's no software, is there a software that can detect all black frames and report their frame number ?
+ Reply to Thread
Results 1 to 7 of 7
AVIDemux can detect black frames, but there's nothing that will let you add chapters, or export frames. Try it and see how many false positives you get before you decide automatic chapters would be a good idea.
and... oh, it doesn't do MKV's very well... um, echo, I remux my files into TS files using TSMuxer and load the TS files into AVIDemux to find chapter positions.
is there a software that can detect all black frames and report their frame number ?
That's cool actually, I could probably write a Powershell script that could take that AVISynth output and build an MKVToolNix chapter xml file out of it, complete with 'End Times', or I could just settle for OGG But from experience, there's still the problem of false positives, black frames aren't the exclusive domain of ad breaks. Plus, since audio tends to stretch into the black frames rather than just stop with the video you'd need a script that checks the Audio too to make sure it captures a silent/black frame. If you intend to fix the chapters afterwards then you might as well do the whole thing manually with AVIDemux, but if you just want a quick hack-job then the AVISynth scripts would be the solution.
As a side note:
ffprobe could be used
ffprobe.exe -show_frames -of compact=p=0 -f lavfi "movie=\'F:\\\\Movies\\\\Movie name.mkv\',select=gt(scene\,0.4)" > scene-changes.txt
Analyzing that scene-changes.txt file a mkv chapter file could be created.
Alternatively ffmpeg also has two filters blackdetect and blackframe which might also be interesting,..
see: http://www.ffmpeg.org/ffmpeg-all.html#blackframe and http://www.ffmpeg.org/ffmpeg-all.html#blackdetect
=> rudimentary scene or black frame detection isn't that complicated and doesn't necessarily require Avisynth
If the video is silent for the duration of the black frame, there is a semi-auto way of chapter creation in AviUtl:
Under the Window/Display menu, there is an item called "Chapter Editing". Open it...
(1) The minimum duration of silence to trigger the addition of chapter (as number of frames)
(2) Lower threshold allows the inclusion of faint sound/BG noise, use High threshold to find absolute silence
(3) Adjust the chapter point to the nearest scene change (may or may not work as intend)
(4) Click the button to begin processing
(Optional) Click on the Name field to change the chapter's name
When done, follow the instruction here (from step 4):
To encode the video with chapters.
You may also try to save that chapter file and mux it back to video using MKVMerge... but I haven't tried that myself and can't guarantee if the chapter format is compatible.