Below are some of my notes for encoding smaller video files using order chaptering. Order Chaptering is to reduce the video bloatness by removing opening/ending video clips of the original video into a separate file. Then use a Chapter.xml file to link all the files together.
Chapter Ordering Pros
Chapter Ordering allows you to encode smaller video file size in shorter time frame since you do not need to repetitively encode opening and ending for each episode. With smaller video size, you can increase the bitrate or CRF value to improve video quality. For example, 10bit CRF28 with opening ending results in 100 MB video (24 min anime video) whereas 10bit CRF25 without opening ending gives 100 MB video size with the advantage of less blockiness in both slow and fast motion action scenes, plus retains more detail in background or sharper outlines on objects.
Chapter Ordering Cons
Its a little bit time consuming since you need to readjust the subtitles timing and recreate a chapter file for each episode. Also need to pay attention to the input file FPS to avoid video audio synchronization issue.
STEP1 – Muxing Video and Audio without Subtitle and Fonts
This step is essential if you do not wish to hardsub fansub’s subtitle to the video. Hardsub means permanently burning the subtitle to the video whereas softsub is to overlay subtitle on top of the video. Soft sub gives users the ability to hide or switch subtitle (if there are 2 or more subtitle like Japanese / English / Chinese / Spanish) for the particular video. This step basically creates a copy of the original video without subtitle (.ass / .srt) and font attachments (.ttf).
1. Run MKVMerge.exe
2. Under Input Tab, click Add and select your .mkv file
3. Tick/Check only video (Example: .h264) and audio (Example: .aac)
4. Select the video from the list and view Format Specific Options Tab.
5. Set the FPS rate to the expected value (Example: 24000/1001 = 23.976)
[NOTE] Use MediaInfo to check the expected video framerate (FPS)! If you have 2 FPS showing different values, choose 1 of them based on your experience.
6. Under Attachment Tab, click DISABLE ALL to unselect any font attachment.
7. Click Start Muxing.
STEP 2 – Encoding Video Audio to make file smaller
This can be also called transcoding or compressing video file to become smaller while retaining quality. I use this method to save more hard disk space. More space for more videos! Encoding a video requires a long time (2-3 hours with Intel Core 2 Duo) or shorter time (same time as video length or shorter with Intel 2nd/3rd Generation CPU of I5/I7)
1. Run MEGUI.exe
2. Under Input Tab, Load AviSynth Script (.avs)
#You can state the video file itself if .avs is in the same location as video.
#Otherwise, set it to its destination like DirectShowSource(“c:\demo.mkv”)
Trim (0,912) + Trim (3071,31769) + Trim(33928,34035)
#Prologue + Episode + Preview
#Use Trim to cut OPENING/ENDING or join PROLOGUE+EPISODE+PREVIEW
For Video Encoding Settings: Ayumilove Megui x264 Encoding Settings Guide
STEP 3 – Edit Subtitle to fit into those OPENING/ENDING/PROLOGUE/etc
Use Subtitle Editor to change the timeframe of your subtitles .ass/ssa/etc. I recommend to use AegiSubs since it allows you to view the video, play the audio and edit the subtitle in real time. You will need to create 3 subtitles, each for OPENING, ENDING and EPISODE (PROLOGUE + MAIN + PREVIEW). The next time you want to make for the other episode, you just need to do only the episode since you have done the OPENING and ENDING.
STEP 4 – Create Chapter.xml using Megui Chapter Tool
It would be best to use th3k31 Chapter Tool (From Minitheater.org) as it allows you to edit more conveniently in terms of setting the starting-ending frames of your prologue, opening, episode, ending and preview. It also does the linking for you (using SUID – segment unique identification), linking your episode with your opening video and ending video. After creating the chapter tool, use mmg (MkvToolnix) to add the chapter into the .mkv video file.
STEP 5 – Use MKVMerge or Megui MKV Muxer to join everything
Run either programs, best to use MKVToolnix to attach special fonts for OPENING/ENDING Karaoke scenes.
In order for OP and ED to work, all 3 files must be:
1) Same Video Resolution (Example: 1280×720)
2) Audio Tracks are encoded same format (different bitrate does not matter).
3) The tracks in the MKV (video container) are ordered the same.
Example: (Video, Audio, Subtitle = VAS) for OP, ED and Episode.