Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
11th November 2005, 01:16 | #1 | Link |
Registered User
Join Date: Sep 2005
Location: Norwood, MA
Posts: 175
|
REAL Ultimate Guide to x264 and QuickTime!!!
Here is a guide I have compiled for a successful encodes of x264 that will work on QuickTime 7. A lot of people on these boards don't (and shouldn't if they don't need to) care about QuickTime functionality for their H.264/AVC encodes. But if you do care, here is a detailed step-by-step guide for a successful H.264 encode for QT. This guide is for Windows, but the x264 command lines can be used with Mac OS X just as well.
Before we get started, you should know that QuickTime is fussy when it comes to x264 playback. First of all QT doesn't support anything above Main Profile, meaning that it's built in decoder WILL support multipass, max 2 B-Frames, B-References, Adaptive Quant, multiple slices, CABAC, etc. Essentially everything in the Main Profile settings with some exceptions. QuickTime WILL NOT support 8x8 dct and intra prediction, b-pyramids, lossless encoding, etc. As well as anything from the High Profile. That said, you can still get an excellent looking encode if you follow this guide. This guide is assuming that you have a Full Screen (4:3) DVD vob file that is formatted in NTSC (29.970 FPS) and is fully Progressive Scan. Weapons and Gear: DVD Decrypter (get .VOB files from DVD) DGIndex (for .d2v project file and .AC3 dolby audio de-muxer) BeSweet (audio encoding) Nero 7 (Aac.dll and aacenc32.dll) or faac for ACC audio encoding AVIsynth (frame server for almost unlimited ways of editing and processing your video) x264 Full package (for encoding H.264/AVC video) Sharktooth's latest build also comes with the x264 stripped down version of the MeGUI front end MeGUI (Encoding front end that will help you automate the encoding process and edit Command Line parameters. Full Version) MP4Box (tool for muxing audio and video with MPEG-4 compliant container) Now let's begin the 7 (6) simple steps to making a sweet encode that will be playable in QuickTime 7.0.3. 1) Rip the .vob(s) to your hard drive with DVD Decrypter 2) Use DGIndex to make a .d2v project file. Select your .vob file(s) you have, open with DGIndex, press F4, save your .d2v file and you will also get a de-muxed AC3 audio file. 3) Create an AVIsynth script to serve up to x264. if you have some of the extra plugins for AVIsynth, you can certainly use those as well. Here is my example for a NTSC 29.97 FPS Progressive Scan Video this format is ideal, we don't need to do anything except resize and clean: Code:
# LOAD THE PLUGINS LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrainSSE3.dll") # VIDEO SOURCE mpeg2source("C:\VIDEO_TS\test.d2v") # CROP THE IMAGE crop(42,0,636,480) # RESIZE (SHARP) FULLSCREEN SOURCE LanczosResize(512,384) # CLEAN THE PICTURE RemoveGrain(mode=1) Code:
# LOAD THE PLUGINS LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll") LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrainSSE3.dll") # VIDEO SOURCE mpeg2source("C:\VIDEO_TS\test.d2v") # INVERSE TELECLINE OPTIONS Telecide(guide=1).Decimate() # CROP THE IMAGE crop(42,0,636,480) # RESIZE (SHARP) FULLSCREEN SOURCE LanczosResize(512,384) # CLEAN THE PICTURE RemoveGrain(mode=1) Code:
# LOAD THE PLUGINS LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TDeint.dll") LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\BlendBob.dll") LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrainSSE3.dll") # VIDEO SOURCE mpeg2source("C:\VIDEO_TS\test.d2v") # DEINTERLACE OPTIONS TDeint(mode=1,order=1,mtnmode=1) BlendBob() # CROP THE IMAGE crop(42,0,636,480) # RESIZE TO FULLSCREEN 4:3 ASPECT RATIO LanczosResize(512,384) # CLEAN THE PICTURE RemoveGrain(mode=1) 4) Go back and encode the audio now. take the .AC3 dolby de-muxed audio file that was created back in step 2, and transcode it using BeSweet. In my example I use the Nero HE-AAC profile, so you will need to copy Aac.dll and aacenc32.dll from the C:\Program Files\Common Files\Ahead\AudioPlugins\ directory into your BeSweet directory. If you would like to use the Nero AAC Encoder completely independent of Nero 7, then you will also need to add the NeroIPP.dll to your BeSweet directory. That file should be located in the C:\Program Files\Common Files\Ahead\Lib\ directory. The command line that I use for AAC encoding is: Code:
BeSweet.exe -core( -input "test 2_0ch 192Kbps DELAY 0ms.ac3" -output "test T01 2_0ch 192Kbps.m4a" -logfile "test T01 2_0ch 192Kbps DELAY 0ms.log" ) -azid( -n1 -s stereo -c normal -L -3db ) -bsn( -2ch -vbr_streaming -codecquality_high -aacprofile_he ) -ota( -d 0 -g max ) 5) Here is where we set up MeGUI to give ourselves a nice looking x264 video encode in an mp4 container. This part is key, as I have had some problems with certain settings for x264 (as far as QuickTime playback is concerned). I like to use 3-pass encoding, using slow RDO (level 6) to give the best possible looking rip we can make that is still playable in QT. I would post the exact settings that you should use here, but it is up to you on what settings you prefer. Remember that QuickTime is extremely picky on which x264 commands you can actually use out of the Main Profile. You cannot use b-pyramid in QuickTime! Here are my x264 command lines, so that you can make a batch file out of them if you wish. These settings are tested and proven to be 100% QuickTime compatible. About these settings: (pass 1 writes a stats file, pass 3 is also known as Nth pass, which will read the current stats file, and re-write the stats file upon completion of the pass, as well as output to the video file. The pass-2, also known as FINAL pass, will read the stats file and output to your final video .mp4 file. Pass-2 will not update the stats file, so make sure that pass-2 is only used on a final pass!) This is confusing, as the actual order of the passes will go as 1, 3, 2. (First, Nth, Final). To avoid confusion (too late ) you could use the "--pass 3" option for your Nth and your final passes (1, 3, 3). This practice is used in MeGUI under 'Automated 3-Pass' settings. So don't panic if you never see "--pass 2" in your command line when using MeGUI's Automated 3-Pass. Code:
x264.exe --pass 1 --bitrate 839 --stats "test.stats" --bframes 2 --subme 6 --analyse p8x8,b8x8,i4x4,p4x4 --me esa --progress --no-psnr --output NUL "template.avs" x264.exe --pass 3 --bitrate 839 --stats "test.stats" --bframes 2 --subme 6 --analyse p8x8,b8x8,i4x4,p4x4 --me esa --progress --no-psnr --output "test.mp4" "template.avs" x264.exe --pass 2 --bitrate 839 --stats "test.stats" --bframes 2 --subme 6 --analyse p8x8,b8x8,i4x4,p4x4 --me esa --progress --no-psnr --output "test.mp4" "template.avs" 7) Finally! the last step is multiplexing the audio and video feeds together. MP4Box by default likes to mux at an assumed frame rate of 25 fps. We're gonna have to tell it otherwise in our case (NTSC 29.970 FPS). If you used a Teleclined or an Interlaced source that has been decimated, then your source is now 23.97 FPS, so make the appropriate changes to this next command. Here is the command line for muxing the audio and video feeds together on a Progressive source! Code:
MP4Box.exe -fps 29.970 -add "test.mp4" -add "test.m4a" "final_video.mp4" *UPDATE* Despite Sharktooth's strong dislike for QuickTime, he was kind enough to supply us with some useful presets that can be used in MeGUI for full QuickTime compatibility. While the preset settings are 100% compatible with QuickTime, you are not limited to using just those. Remember that you can use up to 2 b-frames, multipass and exhaustive searches in QuickTime too, like my command line examples above. You can find Sharktooth's x264 MeGUI presets available for download here. Q and A:. Q: Why is everyone so obsessed about getting their video to work in QuickTime? A: QuickTime is the ultimate paradox. On the one hand QuickTime doesn't give a crap, but on the other hand, QuickTime can be very careful and precise. Q: I heard that QuickTime totally sucks. What's Apple's problem? A: Whoever told you that is a total liar. Just like other media players, QuickTime can suck OR be totally awesome. Last edited by Randall; 4th December 2006 at 19:19. |
11th November 2005, 01:52 | #2 | Link |
Does it really matter?
Join Date: Jun 2004
Location: Chicago, IL
Posts: 1,542
|
# Video source project file
mpeg2source("C:\VIDEO_TS\test.d2v") # Convert the colorspace from RGB to YV12 ConvertToYV12() umm it already comes out of DGdecode in YV12 so the conversion is not needed. it'll just be a slowdown to the script. |
11th November 2005, 04:08 | #3 | Link |
Registered User
Join Date: Sep 2005
Location: Norwood, MA
Posts: 175
|
Ah thanks. I had never used that step before, but somebody recommended it to me, as the x264 encoder works with YV12 internally.
Also a note to everyone interrested: The problem I was having with inconsistant successful encoding using x264 for QT would only show up when I used RAW format for the video. Since I have switched to using MP4 container as the standard output for the video, I have had 100% success with all of my encodings. As long as you use Main Profile, your encode should work with QuickTime after muxing your MPEG-4 video and AAC audio together with MP4Box. Last edited by Randall; 11th November 2005 at 04:24. |
11th November 2005, 04:26 | #4 | Link |
retired developer
Join Date: Oct 2002
Location: Canada
Posts: 8,978
|
I had some problem with YUV2 sources... best keep it. If the source doesn't need convertion Avisynth will not do it.
__________________
Detritus Software |
11th November 2005, 05:44 | #8 | Link | |
Does it really matter?
Join Date: Jun 2004
Location: Chicago, IL
Posts: 1,542
|
Quote:
|
|
11th November 2005, 06:38 | #10 | Link |
Angel of Night
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
|
We're talking on the order of less than .0000001 fps drop, especially since it will be required for any sources (via avi or ds) not in YV12...
(It's belldandy from OMG, from an artbook. =D) I almost forgot, the other thing it probably needs is a quick ivtc/deinterlacer, commented out by default, if it's going to be a reference for newbies. (Telecide and KernelDeint are good for a basic script like this.) Thanks for figuring out all the options quicktime can decode. Last edited by foxyshadis; 11th November 2005 at 06:41. |
11th November 2005, 11:47 | #13 | Link | ||
Registered User
Join Date: Nov 2001
Posts: 9,770
|
Quote:
the failure here is that --pass 2 doesnt stand for "2nd pass", but for "last pass", which means it doesnt update the .log file (x264 uses by default the .log extension for the stats and not .stats) --pass 3 updates the .log file tough so the order has to be that way: --pass 1 --pass 3 --pass 2 Quote:
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau) I know, that I know nothing (Socrates) MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide) Ogg Theora | Ogg Vorbis use WM9 today and get Micro$oft controlling the A/V market tomorrow for free |
||
11th November 2005, 12:07 | #14 | Link | ||
gone
Join Date: Apr 2004
Posts: 1,706
|
Quote:
Quote:
|
||
11th November 2005, 12:16 | #15 | Link | |
Registered User
Join Date: Nov 2001
Posts: 9,770
|
Quote:
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau) I know, that I know nothing (Socrates) MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide) Ogg Theora | Ogg Vorbis use WM9 today and get Micro$oft controlling the A/V market tomorrow for free |
|
11th November 2005, 13:53 | #16 | Link | |
clueless n00b
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
|
Quote:
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
11th November 2005, 14:11 | #17 | Link | ||
retired developer
Join Date: Oct 2002
Location: Canada
Posts: 8,978
|
Quote:
Quote:
__________________
Detritus Software |
||
11th November 2005, 15:56 | #18 | Link | |
Registered User
Join Date: Sep 2005
Location: Norwood, MA
Posts: 175
|
Quote:
|
|
11th November 2005, 16:03 | #19 | Link | |||
Registered User
Join Date: Sep 2005
Location: Norwood, MA
Posts: 175
|
Quote:
Quote:
Quote:
Last edited by Randall; 11th November 2005 at 16:08. |
|||
11th November 2005, 16:03 | #20 | Link | |
gone
Join Date: Apr 2004
Posts: 1,706
|
Quote:
|
|
|
|