Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- i. What you need/prepare:
- eac3to: http://madshi.net/eac3to.zip
- DecoderPack: http://hdbits.org/forums/viewtopic?topicid=41825
- AVSPMod: http://forum.doom9.org/showthread.php?t=153248
- ffms2: https://github.com/FFMS/ffms2/releases
- x264: http://komisar.gin.by/, http://download.videolan.org/pub/x264/binaries/win64/
- avs2yuv: http://akuvian.org/src/avisynth/avs2yuv/avs2yuv.exe
- -Guide for using eac3to: http://en.wikibooks.org/wiki/Eac3to/How_to_Use
- -Install DecoderPack
- -Place neroAacEnc into eac3to folder
- -Extract ffms2-mt.7z, copy all the files and paste into Avisynth/Plugins folder
- -Place x264.exe, avs2yuv.exe in a same folder.
- -Remember to update x264, eac3to, ffms2 frequently
- ii. Demux the streams:
- -Chapter to chapter.txt
- -Video to source.mkv
- -Main Audio to audio.dts/audio.ac3 whatever you prefer
- -Commentary (if there's one) to commentary.mp4 (AAC 64 kbps)
- -Subtitles to language.sup
- example:
- Quote
- ------------------------------------------------------------------------------
- M2TS, 1 video track, 4 audio tracks, 8 subtitle tracks, 3:16:09, 24p /1.001
- 1: Chapters, 19 chapters
- 2: h264/AVC, 1080p24 /1.001 (16:9)
- 3: DTS Master Audio, English, 5.1 channels, 24 bits, 48kHz
- (core: DTS, 5.1 channels, 24 bits, 1509kbps, 48kHz)
- 4: DTS Master Audio, English, 5.1 channels, 24 bits, 48kHz
- (core: DTS, 5.1 channels, 24 bits, 1509kbps, 48kHz)
- 5: AC3 Surround, English, 2.0 channels, 224kbps, 48kHz, dialnorm: -27dB
- 6: AC3 Surround, English, 2.0 channels, 224kbps, 48kHz, dialnorm: -27dB
- 7: Subtitle (PGS), English
- 8: Subtitle (PGS), English
- 9: Subtitle (PGS), English
- 10: Subtitle (PGS), English
- 11: Subtitle (PGS), French
- 12: Subtitle (PGS), French
- 13: Subtitle (PGS), Spanish
- 14: Subtitle (PGS), Spanish
- 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
- *For HDTV stream (*TS), use DGIndex for MPEG-2 and DGAVCindex for H264 to index the source
- iii. Encoding video track:
- a. Use AVSPmod to load the video stream, write the script like this
- Quote
- FFVideoSource("../source.mkv")
- 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.
- *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
- 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:
- Quote
- FFVideoSource("../source.mkv")
- Crop(0,132,0,-132) #Crop all black bars
- Spline36Rezise(1280,544) # Resize to 720p if needed
- Trim(1300,134500).SelectRangeEvery(3000,300) # For testing only, erase this line when you want to do full encode
- *If your source is interlaced/telecine, you must use deinterlacing/ivtc filter BEFORE Crop/Resize. Check out jase99's SD encoding guide at sdbits
- *Use this fomula to determine the right value when resize to 720p(use the closest even number with your result)
- 1280*Source Height/Source Width = Encode Height
- 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)
- 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)
- Save your script as "source.avs"
- c. Open Notepad, write down your x264 settings. You can use this template:
- 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
- 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
- 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
- Save those settings as "encode.bat" and place it in the same folder as source.avs file
- Note: Explanation of the five most important settings
- --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.
- --ref: use as much as you can (but watch out for the L4.1 limit and encoding speed cost)
- --bframes: check out the consecutive B-frames in your 1st log of your test encode. Example:
- x264 [info]: consecutive B-frames: 0.8% 1.4% 7.2% 23.0% 19.4% 43.4% 3.6% 1.3%
- Raise bframes until the last percent is below 5% (for the most significant compression)
- --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.
- --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
- 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)
- 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).
- 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.
- iv. Other stuff:[/b]
- -Use SupRip for orcing the *sup file. Subtitle Workshop and SubRip for correcting errors
- -Use mkvtoolnix for muxing your encode, audio, subtitles and chapter
- -AVSP for making screenshots
- v. Tips:[/b]
- -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.
- -If you want to shutdown your computer when the encode is finished, add this at the end of your encode.bat:
- Quote
- cd
- C:
- shutdown/s
- -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:
- 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
- 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
- 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
- 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
- -Use these sites for Chapter name:
- http://video.barnesandnoble.com/dvds/index.asp?
- http://allmovie.com/
- vi.Thank to:
- -Trisyinate for a lot of suggestions
- -sub24ox7, ThePHX for help me checking spell errors
- -All fellow EbP's members
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement