Guest User

Untitled

a guest
Sep 11th, 2013
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.02 KB | None | 0 0
  1. [quote=ROCKDIE]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. [u][b]i. What you need/prepare:[/b][/u]
  5.  
  6. eac3to: http://madshi.net/eac3to.zip
  7. DecoderPack: http://www.mediafire.com/?mktnzym0yzy
  8. neroAacEnc: http://www.nero.com/eng/downloads-nerodigital-nero-aac-codec.php
  9. AVSPMod: http://amvhell.com/stuff/avspmod/AvsPmod%202.0.5.zip
  10. ffms2-mt: http://code.google.com/p/ffmpegsource/downloads/list
  11. x264: http://komisar.gin.by/
  12. avs2yuv: http://akuvian.org/src/avisynth/avs2yuv/avs2yuv.exe
  13.  
  14. -Guide for using eac3to: http://en.wikibooks.org/wiki/Eac3to/How_to_Use
  15. -Install DecoderPack
  16. -Place neroAacEnc into eac3to folder
  17. -Extract ffms2-mt.7z, copy all the files and paste into Avisynth/Plugins folder
  18. -Place x264.exe, avs2yuv.exe in a same folder.
  19. -Remember to update x264, eac3to, ffms2 frequently
  20.  
  21.  
  22. [u][b]ii. Demux the streams:[/b][/u]
  23.  
  24. -Chapter to chapter.txt
  25. -Video to source.mkv
  26. -Main Audio to audio.dts/audio.ac3 whatever you prefer
  27. -Commentary (if there's one) to commentary.mp4 (AAC 64 kbps)
  28. -Subtitles to language.sup
  29.  
  30. example:
  31.  
  32. [quote]------------------------------------------------------------------------------
  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 [/quote]
  52.  
  53. *For HDTV stream (*TS), use DGIndex for MPEG-2 and DGAVCindex for H264 to index the source
  54.  
  55.  
  56. [u][b]iii. Encoding video track:[/b][/u]
  57.  
  58. a. Use AVSPmod to load the video stream, write the script like this
  59.  
  60. [quote]
  61. FFVideoSource("../source.mkv")[/quote]
  62.  
  63. 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.
  64.  
  65. *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
  66.  
  67. 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:
  68.  
  69. [quote]
  70. FFVideoSource("../source.mkv")
  71. Crop(0,132,0,-132) #Crop all black bars
  72. Spline36Rezise(1280,544) # Resize to 720p if needed
  73. Trim(1300,134500).SelectRangeEvery(3000,300) # For testing only, erase this line when you want to do full encode
  74.  
  75. [/quote]
  76.  
  77. *If your source is interlaced/telecine, you must use deinterlacing/ivtc filter BEFORE Crop/Resize. Check out jase99's SD encoding guide at sdbits
  78. *Use this fomula to determine the right value when resize to 720p(use the closest even number with your result)
  79.  
  80. 1280*Source Height/Source Width = Encode Height
  81. 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)
  82.  
  83. 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)
  84.  
  85. Save your script as "source.avs"
  86.  
  87. c. Open Notepad, write down your x264 settings. You can use this template:
  88.  
  89. [quote]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
  90.  
  91. 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[/quote]
  92.  
  93. 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
  94.  
  95. Save those settings as "encode.bat" and place it in the same folder as source.avs file
  96.  
  97. Note: Explanation of the five most important settings
  98.  
  99. --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.
  100.  
  101. --ref: use as much as you can (but watch out for the L4.1 limit and encoding speed cost)
  102.  
  103. --bframes: check out the consecutive B-frames in your 1st log of your test encode. Example:
  104.  
  105. x264 [info]: consecutive B-frames: 0.8% 1.4% 7.2% 23.0% 19.4% 43.4% 3.6% 1.3%
  106.  
  107. Raise bframes until the last percent is below 5% (for the most significant compression)
  108.  
  109. --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.
  110.  
  111. --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
  112.  
  113. 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). Add FFInfo(cfrtime = false, vfrtime = false) for OSD (current frame and frame type)
  114.  
  115. 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.
  116.  
  117. [u][b]iv. Other stuff:[/u][/b]
  118.  
  119. -Use SupRip for orcing the *sup file. Subtitle Workshop and SubRip for correcting errors
  120. -Use mkvtoolnix for muxing your encode, audio, subtitles and chapter
  121. -AVSP for making screenshots
  122.  
  123. [u][b]v. Tips:[/u][/b]
  124.  
  125. -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.
  126.  
  127. -If you want to shutdown your computer when the encode is finished, add this at the end of your encode.bat:
  128. [quote]cd
  129. C:
  130. shutdown/s[/quote]
  131.  
  132. -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:
  133.  
  134. [quote]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
  135.  
  136. 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
  137.  
  138. 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
  139.  
  140. 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[/quote]
  141.  
  142. -Use these sites for Chapter name:
  143.  
  144. http://video.barnesandnoble.com/dvds/index.asp?
  145. http://allmovie.com/
  146.  
  147.  
  148. [u][b]vi.Thank to:[/b][/u]
  149.  
  150. -Trisyinate for a lot of suggestions
  151. -sub24ox7, ThePHX for help me checking spell errors
  152. -All fellow EbP's members[/quote]
Advertisement
Add Comment
Please, Sign In to add comment