Blu­ray en­co­ding

A word of in­tro­duction

It’s now about 8 mon­ths since I star­ted my „en­co­der ca­reer“ in a group rip­ping anime DVDs known as Ani­me­corpx (ACX). I work for them as an en­co­der and what we do is ba­si­cally rip­ping anime DVDs re­le­a­sed in the USA to make them ac­ces­si­ble for the rest of the world, where you ca­n’t buy them. But I actu­ally hate DVDs. They have low qua­lity vi­deo, cle­a­ning their image up is pain and they ge­ne­rally suck. It came out I’m not the only one in ACX who ha­tes low res and that shitty image of DVDs. It was shitsu, my Swiss colle­a­gue, who actu­ally made me think about an op­tion, that I could en­code BDs and that it mi­ght not be as im­possi­ble as I thou­ght it is. As I star­ted some re­search on this to­pic, I found out, that it’s not di­f­ficult at all. However, it requi­res so­mewhat di­f­fe­rent ap­pro­ach and di­f­fe­rent tools, so it took me a while to get into it and I re­lied on other gu­i­des and blog po­sts scat­ter on mul­tiple pages. That’s why I de­ci­ded I should write so­me­thing sim­ple to follow about en­co­ding BDs.

Note that this text as­su­mes some le­vel of knowledge about en­co­ding.

Get­ting BD

I’ll leave get­ting sour­ces up to you, and I also won’t co­ver how to copy fi­les from BD disk to HDD, since I’ve ne­ver done it. What you should get for your en­co­ding is di­rec­tory with sub­di­rec­to­ries such as Au­x­data, Cli­pinf, Meta, Pla­y­list and STREAM (STREAM is the one you re­ally need, equi­va­lent to VIDEO on DVDs). Note that BD sour­ces, de­pen­ding on disk, have from 25 to 50 GB, so what you re­ally need (even more than power­ful CPU) is disk space.


Lo­a­ding to Avi­synth

First, le­t’s look on vi­deo en­co­ding. It’s pretty easy, you will usu­ally find one .m2ts file per epi­sode (or mo­vie), so you can for­get about DGIn­dex and cre­a­ting some fi­les as d2v. Look to STREAM dir, you­’ll find lo­ads of .m2ts fi­les. As in DVDs, look for those big ones, size in gi­ga­by­tes or tens of GB (mo­vies have on main file e.g 40 GB, epi­so­dic anime usu­ally 4 to 6 GB per epi­sode, one file per epi­sode). Good thing is, you can load them to avi­synth di­rectly, so di­rect­show­source will do:

directshowsource("c:\path\STREAM\00032.m2ts", fps=23.9759856527702, audio=false)

Ha­ving set fps is pro­ba­bly not cru­cial, but I keep it there for sa­fety pur­po­ses as well as audio=false, but you won’t get any from it any­way.


Now frame (image) size. If you rip a live-action mo­vie, you­’ll pro­ba­bly want to keep full HD, but as for anime, note that al­most no anime has re­so­lu­tion of fHD and is ei­ther ups­ca­led di­rectly or, in bet­ter case, drawn with „thic­ker li­nes“. Me­ans that you can re­size it to 720p wi­thout any loss of de­tails. You will pro­ba­bly want to shar­pen it be­fore re­size too (ne­ver do it af­ter­wards!), so it lo­oks bet­ter. Add line with shar­pe­ner and re­si­zer like this:

MSharpen(strength=90) #or whatever shapener you use; don't use Warpsharp.
LanczosResize(1280, 720)

Be ca­re­ful about ratio, if you are crop­ping image (do that be­fore re­size), you­’ll have to worry about ratio di­ver­gence af­ter crop­ping and you may get to pretty ri­dicu­lous di­mensi­ons, but try to keep the di­ver­gence be­low 1% (or you will break Steins Gate!). For these pur­po­ses, you can use AVSP­mod (links @ the end of ar­ticle).

And that’s pretty much it, at le­ast for avi­synth!


Now you will load your AVS script to en­co­der. Now, we’re in mo­dern ti­mes, so do not use con­stant bit­rate! For­get about con­stant si­zes, that do­es­n’t mat­ter any­more, and use that –crf op­tion in x264 en­co­der. That’ll keep the qua­lity con­stant ad you won’t have pro­blems with in­su­f­fi­ci­ent bit­rate in gra­iny or other bit­rate gre­edy parts. 2‑pass en­co­ding mi­ght do, but still I don’t see any re­a­son why to use it. Va­lues of CRF mi­ght di­f­fer on what you­’re en­co­ding, anime in 720p should be in 17–19 range if you don’t want com­press ar­ti­facts. Ge­ne­rally ap­plies a rule that higher re­so­lu­tion you have, higher CRF va­lue you may use to ma­in­tain the qua­lity. For fHD it’s in 19–21 range, even more so­me­ti­mes. So you­’re en­co­der line (in CLI in­ter­face) will be like this (for anime):

x264.exe --profile high --crf 18.5 --preset medium --tune animation --output ..\encoded\video.mp4 skript.avs

Be pre­pa­red that en­co­ding a mo­vie mi­ght take like 10 or more hours; I on my dual core In­tel Centrino2 laptop en­code a mo­vie for 8 to 16 hours (de­pends on re­size, shar­pen, some other cle­a­ning, –pre­set op­tion used). Be sure to have you com­pu­ter well co­o­led. :P

Some ethics

Have you ever seen a mo­vie BD rip from THO­RA­nime fan­sub group? Well, their mo­vies have like 12GB (so­me­ti­mes less, i know). That’s about at le­ast 3 ti­mes more than a fHD BD rip in h264 co­dec with two au­dios each 300MB should have. Always try to keep your mo­vies (their fi­nals size with au­dio and eve­ry­thing) un­der GB, so it can fit DVD. (Not that many pe­o­ple burn them on DVD, but it’s a good rule to stick to.) Full HD epi­sode should­n’t ex­ceed 500 MB or so. As for 720p, try to stick with 3 GB resp. 350 MB li­mit, if possi­ble. (Not ap­pli­ca­ble to live action stuff, al­though 8 GB should be enough for any­thing up to 2.5 hours of pla­y­time.)


Up to here, it was pretty much the same as any other en­co­ding. Now, for ex­tracting of stre­ams from BD you will need a tool called Hd­BrStre­a­mE­x­trac­tor (down­load be­low).

Work with Hd­BrStre­a­mE­x­trac­tor

It’s pretty sim­ple – load a path to you STREAM fol­der to it (In­put) and path where you want it to spill out the ex­trac­ted stre­ams (Out­put) and click „Fe­a­tu­res“. It’ll show you the fi­les in fol­der with their len­gths, so you can easily re­co­gnize, which file is the one you need. Clic­king on it will re­sult to dis­pla­y­ing stre­ams in the file in the list be­low, where you can cho­ose which stre­ams and in which for­mat you want to ex­tract (see pic be­low). Note that chapters are also a stream and even­tual sub­tit­les need to be ex­trac­ted this way too. Au­dio for­mats are a bit above this ar­ticle’s frame, but usu­ally you can use AC3 or THD and then en­code it to AAC/AC3. Always try to take stre­ams with highest possi­ble chan­nel count, or ex­tract both (e.g. 5.1 and 2.0) if possi­ble.

Ex­traction may take even half an hour, so be pa­ti­ent, it’s ten ti­mes bi­g­ger than DVD. As for au­dio transco­ding, try using Me­GUI or FooBar2000. Then pro­ved use­ful to me.


Now you have your sub­title stream ex­trac­ted into some strange .sup file, what to do with it? Re­mem­ber SubRip? Well, the­re’s SupRip for BDs (down­load be­low). It’s in some ways smar­ter than SubRip, in some ways more stu­pid, but you­’ll get over it.

Load the .sub file and just write in the let­ters for each let­ter in the image (yea, subs are sto­red in BDs same way as in DVDs). Good thing is that you can con­t­rol the out­put for the whole line, bad thing is you ca­n’t edit the ma­t­rix as you could in SubRip and you don’t have such good OCR auto-correct en­gine there ei­ther. (Actu­ally, I still use this fe­a­ture of SubRip for sub­tit­les out­put­ted from SupRip.)

Well, and that’s it. Edit sub­tit­les‘ style, mux to­ghe­ther and you­’re done. Not that hard, is­n’t it?


As with any­thing, you mi­ght en­coun­ter some pro­blems. Since I ha­ve­n’t en­coun­te­red any yet, I ca­n’t write here any­thing, sorry. I will try ad­ding here (or to a new post) is­sues that I or my ACX colle­ges will stum­ble on. Also, ple­ase, if you en­coun­ter any is­sues, try sha­ring you ex­pe­ri­en­ces here in com­ments! It mi­ght help other. If you won’t be able to find so­lu­tion, you can also use com­ments to ask for help.


Hd­BrStre­a­mE­x­trac­tor and SupRip in one pack – you will find Hd­BrStre­a­mE­x­trac­tor in /eac3to317 di­rec­tory, SupRip is in its own. There are also some other tools in /eac3to317 di­rec­tory, you may play around with them, I don’t re­mem­ber any­more what they do.

You can find en­co­ding tools in my ear­lier gu­ide here, but I ha­ve­n’t transla­ted that one to En­g­lish yet, sorry. Down­load links are at the end as here.


I wan­ted to write it shor­ter, but when I write, I write long… Hope it hel­ped you a bit and shall you en­coun­ter any is­sues, share them in com­ments. Thanks.

Ver­sion 1.0., re­vi­sion 2.

3 thoughts on “Blu­ray en­co­ding

  1. I have no­ti­ced you don’t mo­ne­tize your web­site, don’t
    waste your traf­fic, you can earn ad­di­ti­o­nal cash every month be­cause you­’ve got high qua­lity con­tent.
    If you want to know how to make ex­tra $$$, search for:
    Mer­ti­so’s tips best ad­sense al­ter­na­tive

  2. I see you don’t mo­ne­tize your blog, don’t waste your traf­fic, you can earn ex­tra bucks
    every month. You can use the best ad­sense al­ter­na­tive for any type of web­site (they ap­prove all web­si­tes), for more de­tails sim­ply search in go­o­o­gle:
    bo­or­fe’s tips mo­ne­tize your web­site

Napsat komentář

Vaše emailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *