Log in

View Full Version : AvsP macro - Encode with x264


vdcrim
12th December 2011, 20:48
This is an AvsP (http://forum.doom9.org/showthread.php?t=153248) macro to encode the Avisynth script in the current tab with x264. It prompts for the encoding settings and pipes the video data to x264 using avs4x264 (http://forum.doom9.org/showthread.php?t=162656). It started as a quick and dirty script, now it has become kind of a poor man's GUI.

http://i.imgur.com/zBoGg.png (http://i.imgur.com/zBoGg.png)

Features:

CRF and 2-pass ABR encoding mode, progressive and interlaced.
Use x264 64-bit with Avisynth 32-bit.
Check consistency between avs output color depth and x264 input-depth parameter.
Read x264 parameters from commentaries on the script.
Calculate an adequate SAR from MeGUI DAR info or a specific comment in the script, if present.
Add zones parameter based on commentaries on lines with Trims.
Search for an existing QP and timecode file in the script directory with the same name as the avs.
Alias feature for setting the YCbCr to RGB flags.
Set "start" shell command options (process priority, start minimized).
Not display any window while encoding and notify at the end.
Save the x264 logs and a copy of the Avisynth script.
Close the current tab and/or preview tabs on its right.

AvsP macro (http://www.mediafire.com/download.php?a21bapyro31nuat) (check for latest version (https://github.com/vdcrim/AvsP-macros/blob/master/Encode with x264.py))

In order to use it, you need to place the script in the "AvsPmod\macros" directory, and avs4x264mod and x264 in "AvsPmod\tools" or set a custom path. Be sure to open the script with your text editor to check the complete documentation.

Changelog:
- minor changes and some cleanup
- fix "Additional parameters" field. It needed to start with a space
- improved interface with recent updates in AvsPmod
- default values can be set now from the prompt
- add 2-pass ABR mode
- add scan type option
- add DAR to the prompt. It can also be read from the avs now, like "# DAR 16:9" or "# DAR 1.85"
- add Blu-ray compatible and open-GOP switches to the prompt
- x264 parameters can now be read from the avs, like "# x264 parameters --crf 17 --aq-strength 1.2"
- zones can now be read from lines with Trims in the avs, like "Trim(0,100) # zones crf=20"
- improve RGB / YCbCr flags alias feature
- add option to archive the encoding log and a copy of the avs
- add option to run the encoding without a window and notify at the end
- add option to close the current tab and/or preview tabs on its right
- fix Python 2.6 compatibility
- add support for Dither_out (Dither v1.22.0+)

mastrboy
13th December 2011, 17:01
That's quite the nice idea :)

Floatingshed
22nd January 2012, 22:37
I just get the error... "return outside function" line 113
Any ideas?

vdcrim
22nd January 2012, 23:24
I just get the error... "return outside function" line 113
Any ideas?
You are probably starting the script directly with your local Python interpreter. Instead, you have to select it from the macro menu in AvsPmod.

ANGEL_SU
23rd January 2012, 00:35
@Floatingshed
You need to update to AvsPmod 2.2.0 or later. In previous version, you can not use 'return' outside function but use nested if-else statement.

Floatingshed
23rd January 2012, 15:35
Thanks. My mistake, not using the correct version of AvsPmod. How do I set the interlaced tff/bff flags?

Oh, another error... Missing "Dither_convey_yuv4xxp16_on_yvxx()" or incorrect input color depth..

vdcrim
23rd January 2012, 16:33
How do I set the interlaced tff/bff flags?

Just use the "Additional parameters" field (--tff or --bff). I didn't include a specific field for these flags because I don't encode interlaced myself. I just fixed a minor bug with this field btw, see first post.

Missing "Dither_convey_yuv4xxp16_on_yvxx()" or incorrect input color depth..
That means that you left the "Input color depth" as 16 bit (the default), but didn't call the Dither_convey_yuv4xxp16_on_yvxx() function from the Dither package.

So, if what you really wanted was to output 8 bit video, set that field to 8. If you want to output high bit depth video, but with other solution than the Dither package (http://forum.doom9.org/showthread.php?p=1386559), set check_depth = False in the macro preferences (first lines of the script).

dadix
27th January 2012, 08:53
Exactly what I was looking, thank you.

How to change input format from 640x720 to 1280x720? (--input-res 1280x720 not works)
My source is mp4.

vdcrim
29th January 2012, 20:18
How to change input format from 640x720 to 1280x720? (--input-res 1280x720 not works)
My source is mp4.

What do you mean? avs4x264mod takes care by itself of passing the correct --input-res value to x264 regardless of input bit depth, so just make sure that you're using the latest avs4x264mod (http://forum.doom9.org/showthread.php?t=162656) and not the original avs4x264.

dadix
30th January 2012, 18:16
Thanks for the kind reply, vdcrim . I will do.

vdcrim
8th June 2012, 20:24
New version (see first post). It finally does all I need it to, so this will probably be the last update. AvsPmod 2.3.0+ is required now.

DrZine
24th August 2013, 20:27
I am trying out the Dither_out support you added to the git hub, but the macro doesn't seem to work for me. AvsPmod is throwing an error, Error in macro: invalid syntax (<string>, line 2). I would try to fix this myself, except: 1) I don't know the first thing about python and 2) Looking at the code it doesn't look like there was a single change to the code at line 2. The older v4 of the macro still works fine for me when I revert the changes. For now I'll just use the older way of passing a 16 bit stacked clip instead of using Dither_out.

aldix
25th August 2013, 02:01
Very nice job. Have you had any thoughts of building in distributed encoding as e.g. RipBot?