|
How to generate the highest quality, most standards-compliant...
|
|
Friendo
Newbie
|
1. September 2008 @ 18:05 |
Link to this message
|
...transcoded Blu-Ray backups in the world:
I've discovered the following information while trying to recode a bunch of Blu-Ray titles from their 20+GB, 1080p selves to 4GB, 720p variants that can be successfully burned to DVD+R discs. If you follow these instructions, you can achieve this with rather spectacular results.
As a prerequisite, of course, you need to install AnyDVD to gain unencrypted access to the .m2ts files on your Blu-Ray disc. The main title of your movie will generally be stored in one large .m2ts file.
Nero Recode uses the infamous Ateme h.264 encoder, which is closed source, proprietary, and produces decisively higher quality output than x264. Unfortunately, and this is nothing to do with Ateme, Nero Recode itself (like many video processing applications) is a bug ridden piece of shit. It is impossible to directly encode m2ts files to mp4 files using Recode, despite the fact that the m2ts files appear in the "Import Files" dialog.
It is very occasionally possible (as with A Scanner Darkly) to rename an .m2ts file to .mp4 and recode it directly using Nero. This is because Nero -does- have the ability to parse the ts format, it just has issues with some of the streams.
There are some movies, such as The Shining, that successfully recode using that method in 1 pass mode, but freeze after a few minutes in 2 pass mode. It is sometimes possible to successfully encode these in 2 pass mode by using the "Trim Movie" button to reduce the length of the film by 1 second.
Yet another possibility that has worked for me once or twice is to use tsMuxer to convert the .m2ts file to a .ts file, rename the .ts file to .mp4, and import that in Recode.
None of these methods are going to work if you rename your m2ts file, import it in Recode, and find an oddball frame rate such as 22.976. At this point, it's safe to say your h.264 stream is not going to be correctly parsed by Recode. If you attempt it, you will get one seriously jerky-ass movie. In this case, the following may be useful:
To copy the video track:
You cannot extract the h.264 track from the m2ts file, place it in another container format, and encode it with Recode. You will get the exact same result. You need to use a *very recent* version of mencoder to transcode it to another format, and then import the resulting file in Recode. It's important to note that you also cannot just transcode your h.264 stream to another h.264 stream; you will also get the same result. There are two possibilities:
If you have a shit house full of disk space, you can copy your stream to a raw-video AVI file. This is your lossless option, and will achieve identical results as if Nero Recode didn't suck and was able to handle your m2ts file directly. For a 1080p Blu-Ray title, excluding sound which you don't need at this step, this will generally result in a 580Mbps video stream, which translates to 71MB per second, 4.1GB per minute, and 415GB for a 100 minute feature film. This is a viable and recommended option for those of you with a 1TB+ drive with a lot of free space.
mencoder file.m2ts -ovc raw -nosound -o file.avi
If you do not have half a terabyte of free disk space, your second best option is to encode with XviD with fixed_quant=1. The difference in picture quality between this and raw video is negligible, especially if you're planning to scale it down later to 720p. The main difference will be the occasional bead of sweat on an actor's face that is just a shade or two fainter than in the original video. This method will generally result in 10:1 compression versus raw video; a 60Mbps stream, or between 1x and 2x the size of your original m2ts file. Just be prepared to let mencoder run all night.
mencoder file.m2ts -ovc xvid -xvidencopts fixed_quant=1 -nosound -o file.avi
Now you can import file.avi in Nero Recode, and recode it to file.mp4. I recommend you manually tweak the cropping, disable it if it's some small value like 2 or 4 or 8, use Lanczos resampling if you're scaling your video, and use the "Best" encoder quality. And, of course, use 2 pass! For the purposes of my exercise, I generally scale the video to 1280x720 (or 1280x544 for letterboxed) and use something around 4Mbps.
Of course, unless you're encoding Charlie Chaplin or some shit, you're not done yet. You need to copy the audio track. For most movies, I can successfully rename the original .m2ts file to .mp4, accepting the fact that the video is not going to copy correctly, set the video quality options to the bare minimum, crop it to some tiny 60x60 postage stamp or whatever, use 1 pass, use the default options for 5.1 audio or 128kbps for stereo, and generate a second .mp4 file for your audio.
Sometimes, for whatever reason, Nero Recode -really- doesn't like your movie, and refuses to do even this. There is also the possibility that you want to save time; I think this method is faster. The following works for DTS tracks:
1. Run tsMuxerGUI, which is itself pretty buggy but I'm too lazy to create a meta file for tsMuxer myself. Check the "demux" box near the bottom of the window now. Click "add" and open your original .m2ts file. Uncheck every track except the first audio track, which is probably DTS-HD. Click "Start muxing". This will generate a .dts file.
2. Run the following command to convert your .dts file to a multichannel .wav file:
tranzcode file.dts /mch
This does a pretty good job, but unfortunately doesn't support the lossless capability of DTS-HD. Only the lossy portion of the track will be copied. No utilities seem to fully support DTS-HD at the time of this writing. That's not to say your results will be bad; 1.5Mbps lossy DTS sounds pretty ok.
3. Use the Nero command line AAC encoder to convert your .wav file to an .aac file:
neroAacEnc -br 229376 -2pass -if file(multichn).wav -of file.aac
This encodes the AAC file using variable bit rate with a 224kbps target. This would be the default in Nero Recode as well.
If you want subtitles, don't let Nero do them for you. The standard subtitle format for mp4 files is "ttxt", or timed text. Nero uses its own proprietary format. ttxt is a UTF8 text format, as opposed to the bitmap format stored in your m2ts file (or used by Nero). Unfortunately the only player at the time of this writing that currently supports ttxt is the VLC Media Player. I'm sure others will follow suit. If you're not willing to wait, you can store your subtitles in a separate file, such as SRT or the newer SSA. These are supported by ffdshow as well as most other apps.
Either way, you are going to need to rip the subtitle track from your m2ts file and do OCR on it. To rip the subtitle track by itself, you need an old version of Xport, xport096.
xport -hj file.m2ts 1 1 1 1
This will generate a file called bits0001.sup. You can load this file in SupRip to convert it to a text-based format. Unfortunately, SupRip's OCR is quite shitty, and you could easily spend an hour manually fixing all its mistakes in Notepad. For this reason, I often skip this step.
Now that you have all the tracks you need - h.264, aac, and possibly .srt - you can simply load them in YAMB to mux them into a single mp4 file.
Congratulations, you just did the highest quality Blu-Ray transcode that is currently possible. It will be at least a couple years before it gets much better than this :) Hopefully Ahead will clean up their act so all these steps are no longer necessary.
Good luck!
-MyFutureSelfnMe, aka Friendo
The following software was referred to in this post:
Nero Recode 3 [part of Nero 8]: http://www.nero.com
SlySoft AnyDVD: http://static.slysoft.com/SetupAnyDVD.exe
tsMuxer: http://www.smlabs.net/tsMuxer/tsMuxeR_1.8.4(b).zip
MPlayer/MEncoder [requires 7zip]: http://voxel.dl.sourceforge.net/sourcefo...p4-svn-27323.7z
Tranzcode 0.40 beta: http://hlava.org/data/Tranzcode_v0.40(beta).rar
Nero Reference AAC Encoder: http://ftp6.nero.com/tools/NeroDigitalAudio.zip
XPort 0.96: http://downloads.hdfrance.fr/chilly996/xport_0.96.zip
SupRip: http://exar.ch/suprip/suprip-1.01.rar
YAMB: http://yamb.unite-video.com/Yamb-2.0.0.8.zip
|
|