Log in

View Full Version : Best presets for automatic batch encode using x264


Livesms
14th March 2011, 22:26
Need an advice for best preset (s) for batch video encoding.
Used to encode captured from TV or recorded with cam MPEG1/2 video to xvid (simultaneously filter it with avisynth denoise/deinterlace/resize) with henryho_hk's avs2qxvid.bat [AVS to Quality XviD] (http://forum.doom9.org/showthread.php?t=119500)
Very useful and convenient tool for Automatic preset selection through 3% compressibility test and automatic encoding.

Now I need to setup something like henryho_hk's avs2qxvid.bat [AVS to Quality XviD] (http://forum.doom9.org/showthread.php?t=119500) for X264.
Need advice for best presets (params sections) for automatic encode
- -tv - captured from analog TV - 704*576*25fps (both interlaced and deinterlaced) - filtered and resized to 512*384 / 576*432 or smth like that resolution - for TV video notices
- -cam - recorded with digital video cam - 704*576*25fps (both interlaced and deinterlaced) - filtered and resized to 768*432 or smth like that resolution
- -dvdrip for DVD rips reencode with near DVD resolutions
- -hdrip - for HDRip with near DVD resolutions
- -hd - for HD video reencode with HD and FullHD video resolutions

I would like to combine all suggested presets to one batch file to set only bitrate/bit_per_pixel/videofile_size and parameters set (preset) type - like (-tv / -cam / -DVDRIP / HDRip / HD ) and encode every video file in batch mode with.
for example
rem encode.bat
call avs2x264.bat -tv 1200kbps VGA_1:1 PRO news20110103.avs
call avs2x264.bat -tv 1200kbps VGA_1:1 PRO news20110104.avs
call avs2x264.bat -cam 1200kbps VGA_1:1 TFF Waterfalls.avs
call avs2x264.bat -cam 0.25bppx VGA_1:1 TFF SilentLake.avs
call avs2x264.bat -tv 1200kbps VGA_1:1 PRO news20110103.avs
call avs2x264.bat -HD 4480MB VGA_1:1 PRO UFO.avs

Livesms
14th March 2011, 22:32
Why do you want to select bitrate/bit_per_pixel/videofile_size manually instead of using constant quality -type encoding?
i prefer to select the total size of encoded video for archive video or video which can be shared with somebody else - and preferred size traditionally is 350MB - 700MB - 1400MB - 4480MB
For personal video TV notices i select constant bitperpixel parameter - 0.25bppx - 0.3bppx is enough for most captured or recorded video.
512*384*25p with 0.25bppx has 1228,8 kbit/s for video stream.

Personally, I'd just pick a suitable CRF value (like 20) and the slowest preset that I have time for. (No need to go beyond --preset slower though, IMO.) Additionally --tune animation is good for clean cel animation and --tune film is ok for most live action sources.

I'm new to x264, so I don't know what does CRF mean. Can't find it in first page Encoding Video for Blu-Ray using H264/AVC (http://forum.doom9.org/showthread.php?p=1399419#post1399419) topic.
--tune animation and --tine film seems to be good param for cartoon video encoding.

Can you share you presets.
And what can you tell about these examples
2.2 EXAMPLES

Progressive

1080p (http://www.x264bluray.com/home/1080i-p)
720p (http://www.x264bluray.com/home/720p-encoding)
576p (http://www.x264bluray.com/home/576p-pal)
480p (http://www.x264bluray.com/home/480p-ntsc)

Interlaced

1080i (http://www.x264bluray.com/home/1080i)
576i (http://www.x264bluray.com/home/576i-pal)
480i (http://www.x264bluray.com/home/480i-ntsc)

nm
14th March 2011, 22:48
i prefer to select the total size of encoded video for archive video or video which can be shared with somebody else - and preferred size traditionally is 350MB - 700MB - 1400MB - 4480MB

I don't think those "preferred sizes" really matter anymore. Who archives backups on CDs or DVDs when HDDs are cheaper, smaller and so much easier to use?

For personal video TV notices i select constant bitperpixel parameter - 0.25bppx - 0.3bppx is enough for most captured or recorded video.
512*384*25p with 0.25bppx has 1228,8 kbit/s for video stream.

CRF would give you more stable quality over the whole video collection.

I'm new to x264, so I don't know what does CRF mean. Can't find it in first page Encoding Video for Blu-Ray using H264/AVC topic.

That topic is just about Blu-ray-specific parameters, not about x264 in general. Take a look at this reference: http://mewiki.project357.com/wiki/X264_Settings


Can you share you presets.

I did, but repetition is the mother of learning, I guess :)

SD live action:
--crf 20 --preset slow --tune film

SD animation:
--crf 20 --preset slow --tune animation

I usually increase CRF (drop quality) a notch or two for HD and higher framerates. I don't need compatibility with Blu-ray players or other devices, so I haven't felt the need to use VBV or limit the settings more than what the selected preset does.

Blue_MiSfit
14th March 2011, 23:53
^^ what he said

Do you really burn CDs or DVDs anymore? Why? Hard Drives are vastly cheaper, and are the perfect answer if you have an HTPC or media streamer

Bits per pixel is completely and utterly meaningless. Stop using it. It doesn't take source complexity into consideration at all.

CRF encoding is the way to go, unless you insist on hitting a specific file size / streaming bitrate. Add VBV to the equation if you're targeting a hardware decoder.

Here's an example that should work file for 1080p encodes for most new-ish hardware devices (lifted straight from Wikipedia's specs for H.264 HP@L4.1

--crf 20 --tune film --vbv-maxrate 62500 --vbv-bufsize 62500

Derek

henryho_hk
18th March 2011, 12:19
While HDD are really cheap, we do meet occasions with size considerations (such as portable devices). Hence, it is still much preferred if there would be some kind of compressibility test or size prediction so that we can roughly predict the size of CRF encodes ... or roughly tell whether the target bitrate of a 2-pass encode is "reasonable".

nm
18th March 2011, 13:16
While HDD are really cheap, we do meet occasions with size considerations (such as portable devices). Hence, it is still much preferred if there would be some kind of compressibility test or size prediction so that we can roughly predict the size of CRF encodes

Take 2 % of the source with SelectRangeEvery(600,12) and encode with CRF 18 (or whatever value you want to target). Multiply the size of the output by 50 to estimate the size of the full encode. It should be within 10 % of the estimated size, at least.

You might also want to read this discussion for more accurate calculations: http://forum.doom9.org/showthread.php?t=116773

Livesms
18th March 2011, 13:25
as for CD/2CD/DVD filesize order - all in all, but I prefer some order in video files - so filesize should be in some order to :)

CFR will not give as much quality on the same size as 2pass encode.

Is there any recommendation for bit-per-pixel / sec for x264 video encoding.
For Xvid video encode recommended to keep bppx/sec 0.25-0.3 for quality encodes. And what for x264 ?

nm
18th March 2011, 13:34
as for CD/2CD/DVD filesize order - all in all, but I prefer some order in video files - so filesize should be in some order to :)

But quality doesn't have to be in order?

CFR will not give as much quality on the same size as 2pass encode.

Sure it will!

Is there any recommendation for bit-per-pixel / sec for x264 video encoding.

As Blue_MiSfit said, bits-per-pixel is not a good metric for any video encoding, including Xvid.

nurbs
18th March 2011, 17:24
CFR will not give as much quality on the same size as 2pass encode.
To quote Dark Shikari (http://forum.doom9.org/showpost.php?p=1373437&postcount=2396):
Given the same amount of encoding time, CRF is superior to 2-pass at the same bitrate. Given the same settings rather than the same time, they're effectively identical within margin of error. My recent tests show that CRF generally has a very slight edge, albeit the difference is so small that you'd have to have OCD to care.
IIRC he also posted somewhere else that you can get a slight advantage for two-pass over CRF if you use --slow-firstpass at the cost of almost doubling your encoding time.