October 2008 Archives
C++0x is now feature complete
Herb Sutter posts to tell us C++0x is now feature complete. There will now be about a year of bugfixing and clarification, but that’s it: all the features are now known, and their interfaces are solid barring any bugs being found. This means compilers can finally start implementing C++0x at full speed without too much worry of surprises.
The Committee Draft is not yet available, but it is about the same as the September 2008 Working Draft.
Visual Studio 2010 CTP now available
Coinciding with the 2008 PDC, the first Visual Studio 2010 CTP is now available for download. At first glance, it includes a few interesting things for C++:
- Partial C++0x support: lambda expressions, rvalue references, static assertions, and “auto” are now supported.
- Revamped IntelliSense: now faster and more accurate.
- Parallel Pattern Library: a modern C++ library that allows easier and safer use of today’s multi-threaded computing.
I’ll be posting more as I take a closer look at these and other features.
Re-encoding VFR Anime
So I preordered a Pandora, and for the past week have been re-encoding videos and music for playing on it. All goes well, until I discovered my favorite anime uses VFR—Variable Frame Rate. This is usually only seen in anime, which tends to use a low frame rate for slow scenes and a higher frame rate for action sequences and 3D renders.
For whatever reason, all the major video tools are completely dumb when it comes to VFR. They expect a constant framerate and will completely screw up anything VFR. This is such a problem that many raw and fansub groups tend to give up and decimate their encodes to a constant 24fps, noticably sacrificing quality.
But there is a light at the end of the tunnel. After several days of searching and tinkering, I’ve found out how to do it. Here are the steps I’m using—they are definitely still not optimal (though it does produce a perfect encode) so if you know of anything better, let me know.
- If your source is not MKV, you’ll need to convert it. This can be done using mkvmerge from the MKVToolnix package.
- Encode the source like normal with x264.
- Use the mkv2vfr utility from the Haali Media Splitter package to extract a timecode file from the source MKV. This is the important step—the timecode file describes the FPS that different segments of your video run at. The mkvextract program from MKVToolnix has a timecode extraction option that looks cleaner, but seems to produce an incompatible or broken timecode file.
- Mux the new video with the timecode file and the audio. This is also done with mkvmerge. Make sure you specify the timecode file for the video, not the audio.
Here are the exact commands I used:
# 1. Convert MP4 to MKV mkvmerge -o "source.mkv" -a 2 -d 1 -S "source.mp4" --track-order 0:1,0:2 # 2. Encode x264 --crf 26 --ref 8 --mixed-refs --bframes 16 --b-pyramid --direct auto --filter 1:1 --subme 7 --trellis 2 --psy-rd 0.6:0 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --vbv-maxrate 25000 --me umh --threads auto --thread-input --aq-mode 0 --progress --no-psnr --no-ssim --output "output.mkv" "source.avs" # 3. Extract timecodes mkv2vfr "source.mkv" "dummy.avi" "timecodes.txt" # 4. Mux output with timecodes and original audio. mkvmerge -o "muxed.mkv" --timecodes "1:timecodes.txt" -d 1 -A -S "output.mkv" -a 2 -D -S "source.mkv" --track-order 0:1,1:2
With source.avs looking like:
DirectShowSource("source.mkv", audio=false) crop(2, 0, -4, -2) Spline36Resize(800, 432) vecs = last.MVAnalyseMulti(refframes=2, idx=1) last.MVDegrainMulti(vecs, idx=1)
Automatic hyphenation
I’ve just installed Hyphenator—a really cool script which automatically adds soft hyphens to words, which means I can finally justify text. If you’ve got Javascript turned on, you should see nice hyphenated line wrapping in addition to syntax highlighting on code.