SHARE
TWEET

Untitled

mft39anton Jun 14th, 2019 224 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. In this guide I don't explain some basic stuff since GrandDK's guide has them all. Feel free to ask me anything you don't understand, and ofc any feedbacks, suggestions to complete the guide are always welcome.
  2.  
  3.  
  4. i. What you need/prepare:
  5.  
  6. eac3to: http://madshi.net/eac3to.zip
  7. DecoderPack: http://hdbits.org/forums/viewtopic?topicid=41825
  8. AVSPMod: http://forum.doom9.org/showthread.php?t=153248
  9. ffms2: https://github.com/FFMS/ffms2/releases
  10. x264: http://komisar.gin.by/, http://download.videolan.org/pub/x264/binaries/win64/
  11. avs2yuv: http://akuvian.org/src/avisynth/avs2yuv/avs2yuv.exe
  12.  
  13. -Guide for using eac3to: http://en.wikibooks.org/wiki/Eac3to/How_to_Use
  14. -Install DecoderPack
  15. -Place neroAacEnc into eac3to folder
  16. -Extract ffms2-mt.7z, copy all the files and paste into Avisynth/Plugins folder
  17. -Place x264.exe, avs2yuv.exe in a same folder.
  18. -Remember to update x264, eac3to, ffms2 frequently
  19.  
  20.  
  21. ii. Demux the streams:
  22.  
  23. -Chapter to chapter.txt
  24. -Video to source.mkv
  25. -Main Audio to audio.dts/audio.ac3 whatever you prefer
  26. -Commentary (if there's one) to commentary.mp4 (AAC 64 kbps)
  27. -Subtitles to language.sup
  28.  
  29. example:
  30.  
  31. Quote
  32. ------------------------------------------------------------------------------
  33. M2TS, 1 video track, 4 audio tracks, 8 subtitle tracks, 3:16:09, 24p /1.001
  34. 1: Chapters, 19 chapters
  35. 2: h264/AVC, 1080p24 /1.001 (16:9)
  36. 3: DTS Master Audio, English, 5.1 channels, 24 bits, 48kHz
  37.   (core: DTS, 5.1 channels, 24 bits, 1509kbps, 48kHz)
  38. 4: DTS Master Audio, English, 5.1 channels, 24 bits, 48kHz
  39.   (core: DTS, 5.1 channels, 24 bits, 1509kbps, 48kHz)
  40. 5: AC3 Surround, English, 2.0 channels, 224kbps, 48kHz, dialnorm: -27dB
  41. 6: AC3 Surround, English, 2.0 channels, 224kbps, 48kHz, dialnorm: -27dB
  42. 7: Subtitle (PGS), English
  43. 8: Subtitle (PGS), English
  44. 9: Subtitle (PGS), English
  45. 10: Subtitle (PGS), English
  46. 11: Subtitle (PGS), French
  47. 12: Subtitle (PGS), French
  48. 13: Subtitle (PGS), Spanish
  49. 14: Subtitle (PGS), Spanish
  50.  
  51. eac3to  D:\SOURCE\Apocalypse.Now.2001.Redux.2In1.BluRay.1080p.DTS-HD.MA5.1-CHDBits 1) 1: D:\Apocalypse.Redux\chapter.txt 2: D:\Apocalypse.Redux\source.mkv 3: D:\Apocalypse.Redux\audio.ac3 5: D:\Apocalypse.Redux\commentary.mp4 -64 7: D:\Apocalypse.Redux\eng1.sup 9: D:\Apocalypse.Redux\eng2.sup 11: D:\Apocalypse.Redux\fre.sup 13: D:\Apocalypse.Redux\spa.sup
  52.  
  53.  
  54.  
  55. *For HDTV stream (*TS), use DGIndex for MPEG-2 and DGAVCindex for H264 to index the source
  56.  
  57.  
  58. iii. Encoding video track:
  59.  
  60. a. Use AVSPmod to load the video stream, write the script like this
  61.  
  62. Quote
  63.  
  64. FFVideoSource("../source.mkv")
  65.  
  66.  
  67.  
  68. and then hit F5, ffms will index the source file. AVSPmod will look like it gonna crash, but you need to leave it there since it's indexing the source file. About 5 minutes later in your folder will have an index file (source.mkv.index), just leave it there.
  69.  
  70. *For HDTV source, use AvsPmod and load the index file you created above(d2v, dga). It will use  MPEG2Source or AVCSource depend on your cap
  71.  
  72. b. Crop and resize the source if you want, then trim out the openning/credit and add the script for testing. Your AVS will look like this:
  73.  
  74. Quote
  75.  
  76. FFVideoSource("../source.mkv")
  77. Crop(0,132,0,-132) #Crop all black bars
  78. Spline36Rezise(1280,544) # Resize to 720p if needed
  79. Trim(1300,134500).SelectRangeEvery(3000,300) # For testing only, erase this line when you want to do full encode
  80.  
  81.  
  82.  
  83.  
  84. *If your source is interlaced/telecine, you must use deinterlacing/ivtc filter BEFORE Crop/Resize. Check out jase99's SD encoding guide at sdbits
  85. *Use this fomula to determine the right value when resize to 720p(use the closest even number with your result)
  86.  
  87. 1280*Source Height/Source Width = Encode Height
  88. 720*Source Width/Source Height = Encode Width (use when you encounter 4:3 source, or source that have large blackbar at right and left side)
  89.  
  90. Trim(Start Frame, End Frame) means you only keep the frame numbers you specify, this is useful to select a range of frames within the movie. SelectRangeEvery(3000,300) means every 3000 frames you take 300 frames for the test sample (ie your testing sample will have 1/10 movie length)
  91.  
  92. Save your script as "source.avs"
  93.  
  94. c. Open Notepad, write down your x264 settings. You can use this template:
  95.  
  96. Quote
  97. D:\avs2yuv source.avs -o - | D:\x264.exe --demuxer y4m --pass 1 --bitrate X --stats ".stats" --level 4.1 --ref X --bframes X --b-adapt 2 --direct auto --deblock -3:-3 --aq-strength X --no-mbtree --output NUL - 2> pass1.log
  98.  
  99. D:\avs2yuv source.avs -o - | start /b /low D:\x264.exe --demuxer y4m --pass 2 --bitrate X --stats ".stats" --level 4.1 --ref X --no-fast-pskip --bframes X --direct auto --deblock -3:-3 --subme 10 --trellis 2 --psy-rd X:X --me tesa --aq-strength X --no-dct-decimate --no-mbtree --output "encode.mkv" - 2> pass2.log
  100.  
  101.  
  102.  
  103. If your CPU is not good enough, you can set subme 9 and me umh, which is minimum standard at HDBits. Depending on the source, you can change those settings: bitrate, ref, bframes, aq-strength, psy-rd. Leave all other settings alone as the are advanced and this is only a beginner tutorial. Sometime you need to use other settings though (like ipratio, pbratio, qcomp, zones...) but this template can do a good job for most sources. Check out for other settings here: http://mewiki.project357.com/wiki/X264_Settings
  104.  
  105. Save those settings as "encode.bat" and place it in the same folder as source.avs file
  106.  
  107. Note: Explanation of the five most important settings
  108.  
  109. --bitrate: well it's pretty obvious. Use your eyes checking comparison between test encode/source and choose what bitrate you should use, not just looking at the quants. The more grainy and colorful the film is the more bitrate it will need. With Animation and CGI stuff if your encode doesn't have enough bitrate it will cause a lot of banding in the background/low details areas. Use the tool called Bitrate Calculator(in MeGUI) if you want to set a specific file size for your encode (DVD5, DVD9) for example.
  110.  
  111. --ref: use as much as you can (but watch out for the L4.1 limit and encoding speed cost)
  112.  
  113. --bframes: check out the consecutive B-frames in your  1st log of your test encode. Example:
  114.  
  115. x264 [info]: consecutive B-frames:  0.8%  1.4%  7.2% 23.0% 19.4% 43.4%  3.6%  1.3%
  116.  
  117. Raise bframes until the last percent is below 5% (for the most significant compression)
  118.  
  119. --psy-rd: useful for all material, especially grainy movie (don't even think about disabling it!).  I recommend  this range 0.8--->1.2 for film and 0.5--->0.8 for animation. I personally don't recommend using the second value (psy-trellis) as it will often sharpen and will add progressively more artifacts to the image the higher the value. Choose what you think it's best for your source.
  120.  
  121. --aq strength: Set the strength of AQ bias towards low details areas. Example: The face of a character is considered a complex detail area, while the background behind them (sky, dark shadow..etc) is consider low details area. Lower value than default value(1.0) will make his face looks better while the background will look bad compared to the source, and vice versa. For the best pq benefit, I recommend 0.7--0.9 for film, 0.5-0.7 for grainy movie, 0.9-1.1 for animation
  122.  
  123. d. Run encode.bat file to do the test encode. When the test encode is finished, use AVSPmod to load the source.avs file and the encode.mkv file then compare them (use ffmpegsource2 for the test encode, it's easier to compare).
  124. Add FFInfo(cfrtime = false, vfrtime = false) for OSD (current frame and frame type)
  125. or FFInfo(cfrtime=false, vfrtime=false, colorspace=false, colorrange=false, cropping=false, sar=false, version=false) to show only frame number and frame type (since versio 2.21).
  126.  
  127. If you think your test encode is good, then erase "Trim(Start Frame,End Frame).SelectRangeEvery(3000,100)" in your source.avs file and run encode.bat again to do full encode.
  128.  
  129. iv. Other stuff:[/b]
  130.  
  131. -Use SupRip for orcing the *sup file. Subtitle Workshop and SubRip for correcting errors
  132. -Use mkvtoolnix for muxing your encode, audio, subtitles and chapter
  133. -AVSP for making screenshots
  134.  
  135. v. Tips:[/b]
  136.  
  137. -In AVSPmod, go to Options/Extension-template and edit what decoder you want to use as default decoder for *MKV. From now on, when you load the source file, AvsP will use that decoder instead of DirectShowSource.
  138.  
  139. -If you want to shutdown your computer when the encode is finished, add this at the end of your encode.bat:
  140.  
  141. Quote
  142. cd
  143. C:
  144. shutdown/s
  145.  
  146.  
  147.  
  148. -If you want to do a lot of test encodes for various sources, or encode the whole tvshow season in queue. You need to add absolute address to your input/output settings and the local of x264, avs2yuv. For example:
  149.  
  150. Quote
  151. D:\avs2yuv D:\Glee\01\source.avs -o - | D:\x264.exe --demuxer y4m --pass 1 --bitrate 5500 --stats "D:\Glee\01\.stats" --level 4.1 --ref 9 --bframes 7 --b-adapt 2 --direct auto --deblock -3:-3 --threads 12 --aq-strength 0.8 --no-mbtree --output NUL - 2> D:\Glee\01\pass1.log
  152.  
  153. D:\avs2yuv D:\Glee\01\source.avs -o - | start /b /low D:\x264.exe --demuxer y4m --pass 2 --bitrate 5500 --stats "D:\Glee\01\.stats" --level 4.1 --ref 9 --no-fast-pskip --bframes 7 --direct auto --deblock -3:-3 --subme 9 --trellis 2 --psy-rd 0.95:0.0 --me umh --threads 12 --aq-strength 0.8 --no-dct-decimate --no-mbtree --output "D:\Glee\01\encode.mkv" - 2> D:\Glee\01\pass2.log
  154.  
  155. D:\avs2yuv D:\Glee\02\source.avs -o - | D:\x264.exe --demuxer y4m --pass 1 --bitrate 5500 --stats "D:\Glee\02\.stats" --level 4.1 --ref 9 --bframes 7 --b-adapt 2 --direct auto --deblock -3:-3 --threads 12 --aq-strength 0.8 --no-mbtree --output NUL - 2> D:\Glee\02\pass1.log
  156.  
  157. D:\avs2yuv D:\Glee\02\source.avs -o - | start /b /low D:\x264.exe --demuxer y4m --pass 2 --bitrate 5500 --stats "D:\Glee\02\.stats" --level 4.1 --ref 9 --no-fast-pskip --bframes 7 --direct auto --deblock -3:-3 --subme 9 --trellis 2 --psy-rd 0.95:0.0 --me umh --threads 12 --aq-strength 0.8 --no-dct-decimate --no-mbtree --output "D:\Glee\02\encode.mkv" - 2> D:\Glee\02\pass2.log
  158.  
  159.  
  160.  
  161. -Use these sites for Chapter name:
  162.  
  163. http://video.barnesandnoble.com/dvds/index.asp?
  164. http://allmovie.com/
  165.  
  166.  
  167. vi.Thank to:
  168.  
  169. -Trisyinate for a lot of suggestions
  170. -sub24ox7, ThePHX for help me checking spell errors
  171. -All fellow EbP's members
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top