AyumiLove Ordered Chapter Guide

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)
Script Example:
DirectShowSource(“demo.mkv”)
#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.

Essential Notes

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

20 thoughts on “AyumiLove Ordered Chapter Guide

  1. Ayumilove

    @Neno: You’re welcome 🙂

  2. neno

    Thanks encoding works after installing K-Lite Codec Pack 9.2.0 🙂
    “latest codecs installed” ty for this

  3. Ayumilove

    @Neno: Run Megui, Under the Input Tab (there are 3 tabs in Megui: INPUT/QUEUE/LOG), click the button with 3 dots […] for the Video Encoding > AviSynth Script. Then select your .avs (avisynth script) file, and click OK/OPEN. You won’t be able to listen any audio, only video preview. Make sure you have the latest codecs installed.

  4. neno

    U mean I should use the input tab when I open megui with the avs script?
    but the audio is not included and I still got grey screen

  5. Ayumilove

    @Neno: It’s possible. I tested on my 10bit video, and it works. I tried on UTW but get color-pixel distortion with grayscale from 10bit to 10bit only with One-Click but not Auto-Encode AviSynth. AviSynth somehow converts the 10bit to 8bit, then back to 10bit preventing those issues from occurring.

  6. neno

    Erm,is there any way to trim 10 bit mkvs?

  7. Ayumilove

    @Neno: UTW 720p are encoded with 10bit (not the normal 8bit) so if you try to use Megui One-Click, it will have issue such as grayscale video or tons of pixelation or color distortion or all of them.

  8. neno

    When I opened the script under the input tab I got something like this http://puu.sh/WIHG

  9. Ayumilove

    @Neno: That would work. I usually rename the filename to something short like demo.mkv to avoid encoding issue when Megui tries to read the file.

  10. Ayumilove

    @Neno: Try using Megui Auto-Encode.

  11. neno

    I used megui and one click encoder

  12. Ayumilove

    @Neno: What tools and video are you using? Could you upload a sample and I test it out?

  13. neno

    When I used DirectShowSource, the video I encoded was grey screened throughout and audio is not trimmed

  14. Ayumilove

    @Neno: Press Yes to add ConvertToYV12() to the script.

  15. neno

    I got this message while encoding
    The colorspace of your clip is not in YV12…
    Do you want me to add ConvertToYV12() to the end of your script ?
    Should I press yes or no?

  16. Ayumilove

    @Neno:

    Use DirectShowSource(“demo.mkv”) as this will combine both audio and video together. So when you use trim (aka cut), it affects both video and audio.

  17. neno

    the avs I used FFVideoSource(“demo.mkv”) I added it at the input tab and converted the video but the audio starts from 0:00 of the source

  18. Ayumilove

    Hi Neno,
    What do you mean by audio remains the same? When you use Avisynth Script, you can trim the video and audio together. (Trim = Cut)

  19. neno

    This “Encoding Video Audio to make file smaller” part I can only cut up the video but the audio remains the same