Hello,
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 ?
Thanks
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
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 ?
eg.
http://forum.doom9.org/showthread.php?p=1573376#post1573376 -
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
Code:ffprobe.exe -show_frames -of compact=p=0 -f lavfi "movie=\'F:\\\\Movies\\\\Movie name.mkv\',select=gt(scene\,0.4)" > scene-changes.txt
Code:media_type=video|key_frame=1|pkt_pts=47548|pkt_pts_time=47.548000|pkt_dts=47548|pkt_dts_time=47.548000|best_effort_timestamp=47548|best_effort_timestamp_time=47.548000|pkt_duration=N/A|pkt_duration_time=N/A|pkt_pos=8892987|pkt_size=N/A|width=720|height=304|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|tag:lavfi.scene_score=0.490000
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):
http://mavericktse.mooo.com/wordpress/archives/1014
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.