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.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264
Register FAQ Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 26th September 2008, 02:51   #1  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
Direct264 - special x264 CLI build that supports input from DirectShow

I modified the source code of x264 CLI and this build can now encode from any file playable through DirectShow. Life will be quite easier since avisynth is no longer needed.

Download link:
http://sourceforge.net/projects/direct264/

Changelog 2011-08-31
x264
Updated x264 to 2074

Changelog 2011-05-17
x264
Updated x264 to 1995

Changelog 2011-03-25
x264
1) Updated x264 to 1924.
2) AVI output in x264 supports >2G files.

Changelog 2011-01-22
x264:
1) Updated x264 to 1867
2) Added new parameter --dscrop <left:top:right:bottom>. Works under dshow input only. Cropping will be applied after ivtc and before subtitle rendering. It should be slower than --vf crop so recommended only for use with --sub.
3) YV12 will be preferred if internal resizer is used because swscale is slower on NV12 than YV12.
4) Automatically set default fps to 0.8x in --ivtc t and b mode.
CTAACEncoder & dshow2wav:
5) Fixed random crash during encoding.

Changelog 2010-12-27
x264:
1) Updated x264 to 1834
2) DShow interface now supports NV12. It will first try NV12. If failed, try YV12 later. Win7's built-in decoders are compatible with x264.
3) Fixed a bug in deldup filter.
CTAACEncoder:
4) Compatible with unicode filenames when using mp4 output
5) Updated encoder
VSFilter:
6) Updated to svn r2799. Add NV12/NV21 support to csri interface.

Changelog 2010-12-07
x264:
1) Updated x264 to 1794
2) Added new option "--timed-scenecut". With this option scenecut threshold will increase linearly with PTS instead of frame count. This is useful for VFR video.
3) Removed "--swapuv" since x264 now has "--input-csp".
Phase filter:
4) Improved ivtc accuracy. e.g. for AA BC CC pattern. Old filter will leave all 3 frames as is, new filter will drop BC frame.
CTAACEncoder:
5) Use non-DPL matrix for 5.1->2.0 downmix. To enable DPLII matrix, add "-dpl" to command line.

Changelog 2010-07-02
1) Updated x264 to 1659
2) Fixed a crash at very high bitrate (e.g. lossless)
3) Revert default value of keyint_min to keyint / 10
4) Reduce default number of threads on HT CPU
5) Compiled with VS2010

Changelog 2010-04-28
1) Updated x264 to 1564
2) Fixed a seeking bug in CTAACEncoder'

Changelog 2010-04-08
1) Updated x264 to 1523
2) Default keyint is automatically set to fps*10 (specifying --keyint 0 has the same effect)
3) CTAACEncoder no longer needs write a temp file in your TMP path when outputting to mp4/m4a files

Note that "--timecode" and "--timescale" parameters are removed. Use "--tcfile-in" and "--timebase" instead.

Changelog 2010-03-04
1) Updated x264 to 1471
2) Improved DVD .ifo file handling. A modified VTSReaderMod.ax is included, registration of VTSReader.ax is no longer needed.
3) CTAACEncoder will show unicode filename correctly(in 8.3 form) when it contain unsupported characters, and no longer crashes.

Changelog 2010-02-25
1) Updated x264 to 1462
2) Make weightp 2 and b_pyramid normal default for high profile(same as official release), but both disabled for main profile(compatible with PSP). Such workaround will be removed when "device" option is added.
3) Removed unwanted 0s in nal start code for avi muxer.

Changelog 2010-02-08
1) Updated x264 to 1416
2) Fixed bug in MP4 output
3) libx264 compiled by gcc since MSVC might have mis-compilation issues on encoder/analyse.c

Changelog 2010-01-29
1) Updated x264 to 1400 (added lavf input but no ffms input)
2) Improved dshow input's multi-threading performance
3) Fixed a bug of vsfilter in DirectVobSub mode
4) vtsreader.ax and decssfilter.ax are now combined to one dll

Changelog 2009-12-25
1) Fixed incorrect color(inverted UV) in subtitle loaded with --sub parameter
2) vsfilter automatically uses BT709 matrix in RGB->YUV conversion for HD resolution
3) fixed seeking problem in CTAACEncoder
4) Recompiled some modules, reduced executable size

Changelog 2009-12-17
1) Updated x264 to 1376
2) Print video duration before encoding(in hh:mm:ss) if the source video has duration.
3) Print actual timestamp of start time if --starttime is used. This is useful when you need to mux encoded video with audio.
4) Add a new 'd' mode to ivtc. Since field matching should be done before any filter including crop and resize, you have to use phase filter in ffdshow if you need to resize. The 'd' mode allow you to use phase filter in ffdshow and do ivtc in x264 based on phase filter's analyse.
5) CTAACEncoder allows decimals in -T and -E parameters and uses "sample-accurate" seeking. In dshow mode ""sample-accurate" seeking requires correct timestamps from decoders.
6) Fixed incorrect DPL II downmix coeffecients
7) CTAACEncoder no longer fails on unicode mp4 output file names.
8) Fixed 3 incorrect SAR value

Changelog 2009-11-23
1) Updated x264 to 1342 (weightp is turned off in all presets by default)
2) vfr support added to flv output
3) Fixed 2 bugs in x264's progress displaying
4) Automatically fix incorrect DVD sar returned by b0rked decoders (8:9/32:27/16:15/64:45 -> 10:11/40:33/12:11/16:11)

[How to use it]
This is a modified x264 build. A new demuxer "dshow" is added while the "ffms2" demuxer is removed. It also adds several new features.
Usage is quiet simple:
1) Put "dump.ax" from the archive into windows\system32 or the same directory of "x264.exe" and "CTAACEncoder.exe".
2) "dshow" is the default demuxer, so any video file that playable via directshow can be opened by x264. The command line is the same as using "ffms" or "lavf" as demuxer.
3) "CTAACEncoder.exe" encodes any audio streams in A/V files to aac files. Run it without parameters to see the full help. It uses Winamp plug-in to encode so enc_aacplus.dll and libmp4v2.dll is needed. A copy of modified enc_aacplus.dll is included. If there is any license issues plz let me know.
4) "dshow2wav.exe" decodes any audio stream in A/V files and output wav pcm to stdout. Use cmdline "dshow2wav.exe inputfile [aid]".
5) To directly encode DVD titles (both video and audio):
-- Find the .IFO file in VIDEO_TS folder on your DVD. Commonly the first title is VTS_01_0.IFO.
-- Encode it.

[New parameters in x264.exe]
If not mentioned, all following parameters are only available with dshow input
2) --deldup minfps[:lthresh[:mbthresh[:mbmax[:cthresh]]]] : This will enable a near-duplicate frame removal prefilter. See explanation below.
3) --smoothts : Adjust timestamps so that video plays smoothly. If you are encoding soft-telecined DVD titles, this option will turn 20fps/30fps/20fps... sequence to 24fps. Not needed for latest ffdshow.
4) --starttime hh:mm:ss.ssss, --endtime hh:mm:ss.ssss : Encoding will start or stop at the specified position.
5) --sub subfile : Add a subtitle file to the video. Need a patched vsfilter.dll.
6) --ivtc <mode>: Enable field matching/ivtc function in dshow input mode. See description below.
8) --versioninfo : Write SEI version information and encoding settings to H264 bitstream. Disabled by default. This option is available with all input and output.
9) --timed-scenecut : Scenecut threshold increase linearly with PTS instead of frame count, useful for VFR video.

Before you start to encode, make sure of following issues
1) Proper demuxers and decoders are installed. I recommend using ffdshow + haali/gabest spliiter + real alternative(if you want to encode realmedia files). Some commercial codecs do not work well in software mode. You can test your files in mplayer2 or graphedit(not WMP or mpc-hc!).
2) x264 only accepts YUV 4:2:0. If your decoder do not support YV12, set "Raw video" in "ffdshow video decoder configuration -> codecs" to "all supported" and check "YV12" in "output".
3) If you need to hardcode embedded mkv subtitles, register vsfilter.dll. Use --sub for external subtitles.
4) If you need to use avisynth filters, do not write a ".avs" script, just add it in ffdshow. Anyway some filters are not working in this mode.

[Deldup prefilter]
What is deldup prefilter?
* This is one part of my IVTC filter.
* For static and slow-motion scenes, this will remove duplicate frames so the encoding speed and encoded size will be significantly improved.

How does deldup work?
* It compare the the current frame and the last encoded frame, calculating the SAD of each 16x16 block and the whole image. If all of them are below provided threshold, the current frame is considered a duplicate frame and dropped.
* Codes are optimized with MMX, it is supposed to be quite fast.

How to use it?
In x264 cmdline, use "--deldup minfps[:lthresh[:mbthresh[:mbmax[:cthresh]]]]" to enable deldup prefilter.
* minfps: float. Indicate the minimum fps. If the interval between two frames exceeds 1/minfps sec., it will skip SAD checking.
* lthresh: float. The maximum SAD for Y plane will be set to W*H*lthresh. A negative lthresh will turn luma checking off. Default is 0.4.
* mbthresh,mbmax: integer. if the number of 8x8 blocks with SAD larger than mbthresh exceeds mbthresh, it will be considered a non-duplicate frame. Default is 400,80.
* cthresh: float. The maximum SAD for U and V plane will be set to W*H*cthresh. A negative cthresh will turn chroma checking off. Default is 0.6.

[Phase filter]
This is a field matching filter aiming at IVTC and fixing wrong field order.

To use it with --ivtc <mode> in x264:
Currently there are four ivtc modes: a, t, b, d
--ivtc a: Only field matching is applied with field order set to auto. Deldup filter is not automatically enabled. This mode is used solely for correcting wrong field order.
--ivtc t: Both field matching and deldup are applied with field order set to tff. Deldup is enabled with parameter 24:1:400:80:2 and will be dynamically changed according to Phase's matching result. You can also manually raise deldup's parameters if your video contains heavy noise.
--ivtc b: Same as t mode except field order set to bff.
--ivtc d: Use phase filter as ffdshow's DScaler plug-in. Field order is auto-detected. Useful when you need post-processing in ffdshow(e.g. resize) after ivtc.

Note that with ivtc turned on height must be mod4.

To use it in ffdshow:
1) Install ffdshow and put FLT_Phase.dll somewhere
2) Open ffdshow's Video decoder configuration
3) Check DScaler filter, click "..." behind "Filter", find FLT_Phase.dll and select it
4) If you need to IVTC, select "Odd only" for Top-Field-First and "Even only" for Bottom-Field-First. This should improve accuracy.
5) Do not use other filters before phase, especially cropping, resizing and deinterlacing.

Last edited by roozhou; 23rd September 2011 at 02:39.
roozhou is offline   Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:06.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.