News:

--

Main Menu

Batch Processing - 2PASS=15 not working

Started by VDD, April 13, 2019, 05:39:55 PM

Previous topic - Next topic

VDD

Hey, folks!

Could you please tell me why the following script is not compressing my files to 15MB?

set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=X.264
set audiocodec=MP3
for %%f in (*.mov) do %avidemux% --output-format H264 --audio-codec %audiocodec% --video-conf 2pass=15 --load "%%f" --save "%%~nf.mp4" --quit

Thanks a lot in advance,
Victor

eumagga0x2a

#1
Neither video encoder "X.264" nor audio encoder "MP3" exists. The correct name for the former is "x264" and the latter "Lame".

Additionally, " --load "%%f"" should come first.

VDD

#2
Thanks a lot, eumagga0x2a!

I tweaked the code by fixing the encoder names and moving LOAD first. Still no luck with 15 MB size. Also, after moving the LOAD part upfront, I am no longer getting any output.

set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=X264
set audiocodec=lame
for %%f in (*.mov) do %avidemux% --load "%%f"--output-format x264 --audio-codec lame --video-conf 2pass=15 --save "%%~nf.mp4" --quit

Thanks!

eumagga0x2a

#3
I've missed that output format is wrong as well. You want MP4

Additionally, now video codec is missing completely. Please just read what you pass to avidemux.exe carefully.

eumagga0x2a

Okay, now finally posting not on a smartphone so that I can read carefully myself too.

The option --video-conf doesn't exist (removed many years ago), you should use the x264 video encoder configuration dialog to setup the desired 2pass configuration. You could save the resulting state of editing as a project script, delete everything except of the video encoder configuration and load it using the --run command line option.

VDD

Appreciate the advice! Unfortunately, now I am completely lost  ??? ??? being a newbie. Below is the code that I compiled using a combo of the above code and the script from the saved project.
From what I can see, it does not understand the RUN command and stops right at it. I can also see that when the application pops up, the video output does not change, while the audio output is set to MP3 (LAME). Somehow I can't reference the video output correctly.

#set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set videocodec=x264
set audiocodec=lame

for %%f in (*.mov) do %avidemux% 
--load "%%f"
--audio-codec %audiocodec%
-- run videoCodec("x264", "useAdvancedConfiguration=True", "general.params=2PASS=15", "general.threads=0", "general.preset=ultrafast", "general.tuning=none", "general.profile=baseline", "general.fast_decode=False", "general.zero_latency=False"
, "general.fast_first_pass=True", "general.blueray_compatibility=False", "general.fake_interlaced=False", "level=-1", "vui.sar_height=1", "vui.sar_width=1", "MaxRefFrames=3", "MinIdr=25", "MaxIdr=250"
, "i_scenecut_threshold=40", "intra_refresh=False", "MaxBFrame=3", "i_bframe_adaptive=1", "i_bframe_bias=0", "i_bframe_pyramid=2", "b_deblocking_filter=True", "i_deblocking_filter_alphac0=0", "i_deblocking_filter_beta=0"
, "cabac=True", "interlaced=False", "constrained_intra=False", "tff=True", "fake_interlaced=False", "analyze.b_8x8=True", "analyze.b_i4x4=True", "analyze.b_i8x8=True", "analyze.b_p8x8=True", "analyze.b_p16x16=False"
, "analyze.b_b16x16=False", "analyze.weighted_pred=2", "analyze.weighted_bipred=True", "analyze.direct_mv_pred=1", "analyze.chroma_offset=0", "analyze.me_method=1", "analyze.me_range=16", "analyze.mv_range=-1"
, "analyze.mv_range_thread=-1", "analyze.subpel_refine=7", "analyze.chroma_me=True", "analyze.mixed_references=True", "analyze.trellis=1", "analyze.psy_rd=1.000000", "analyze.psy_trellis=0.000000", "analyze.fast_pskip=True"
, "analyze.dct_decimate=True", "analyze.noise_reduction=0", "analyze.psy=True", "analyze.intra_luma=11", "analyze.inter_luma=21", "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "ratecontrol.qp_min=10"
, "ratecontrol.qp_max=51", "ratecontrol.qp_step=4", "ratecontrol.bitrate=0", "ratecontrol.rate_tolerance=1.000000", "ratecontrol.vbv_max_bitrate=0", "ratecontrol.vbv_buffer_size=0", "ratecontrol.vbv_buffer_init=1"
, "ratecontrol.ip_factor=1.400000", "ratecontrol.pb_factor=1.300000", "ratecontrol.aq_mode=1", "ratecontrol.aq_strength=1.000000", "ratecontrol.mb_tree=True", "ratecontrol.lookahead=40")
--save "%%~nf.mp4"
--quit#

eumagga0x2a

--run expects the path to the project script file.

VDD

Thanks a lot for helping me get there... Still no luck. I must be doing some silly errors in syntax. Sorry, I am not a programmer.

It stops with the following error: TinyPy:Exception (_tp_dict_get) KeyError: nud...........

Script
set avidemux="C:\Program Files\Avidemux 2.7 VC++ 64bits\avidemux.exe"
set script15="C:\Users\XXX\Desktop\15MB Script.py"
set videocodec=x264
set audiocodec=lame

for %%f in (*.mov) do %avidemux%  --load "%%f" --audio-codec %audiocodec% --video-codec MP4 --run %script15%
--save "%%~nf.mp4"
--quit

PY file
"x264", "useAdvancedConfiguration=True", "general.params=2PASS=15", "general.threads=0", "general.preset=ultrafast", "general.tuning=none", "general.profile=baseline", "general.fast_decode=False", "general.zero_latency=False"
, "general.fast_first_pass=True", "general.blueray_compatibility=False", "general.fake_interlaced=False", "level=-1", "vui.sar_height=1", "vui.sar_width=1", "MaxRefFrames=3", "MinIdr=25", "MaxIdr=250"
, "i_scenecut_threshold=40", "intra_refresh=False", "MaxBFrame=3", "i_bframe_adaptive=1", "i_bframe_bias=0", "i_bframe_pyramid=2", "b_deblocking_filter=True", "i_deblocking_filter_alphac0=0", "i_deblocking_filter_beta=0"
, "cabac=True", "interlaced=False", "constrained_intra=False", "tff=True", "fake_interlaced=False", "analyze.b_8x8=True", "analyze.b_i4x4=True", "analyze.b_i8x8=True", "analyze.b_p8x8=True", "analyze.b_p16x16=False"
, "analyze.b_b16x16=False", "analyze.weighted_pred=2", "analyze.weighted_bipred=True", "analyze.direct_mv_pred=1", "analyze.chroma_offset=0", "analyze.me_method=1", "analyze.me_range=16", "analyze.mv_range=-1"
, "analyze.mv_range_thread=-1", "analyze.subpel_refine=7", "analyze.chroma_me=True", "analyze.mixed_references=True", "analyze.trellis=1", "analyze.psy_rd=1.000000", "analyze.psy_trellis=0.000000", "analyze.fast_pskip=True"
, "analyze.dct_decimate=True", "analyze.noise_reduction=0", "analyze.psy=True", "analyze.intra_luma=11", "analyze.inter_luma=21", "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "ratecontrol.qp_min=10"
, "ratecontrol.qp_max=51", "ratecontrol.qp_step=4", "ratecontrol.bitrate=0", "ratecontrol.rate_tolerance=1.000000", "ratecontrol.vbv_max_bitrate=0", "ratecontrol.vbv_buffer_size=0", "ratecontrol.vbv_buffer_init=1"
, "ratecontrol.ip_factor=1.400000", "ratecontrol.pb_factor=1.300000", "ratecontrol.aq_mode=1", "ratecontrol.aq_strength=1.000000", "ratecontrol.mb_tree=True", "ratecontrol.lookahead=40"

eumagga0x2a

#8
The content of the .py script is invalid. A valid example:

adm = Avidemux()
adm.videoCodec("x264", "useAdvancedConfiguration=False", "general.params=AQ=20", "general.threads=0", "general.preset=veryfast", "general.tuning=none", "general.profile=baseline", "general.fast_decode=False", "general.zero_latency=False"
, "general.fast_first_pass=True", "general.blueray_compatibility=False", "general.fake_interlaced=False", "level=-1", "vui.sar_height=1", "vui.sar_width=1", "MaxRefFrames=3", "MinIdr=25", "MaxIdr=250"
, "i_scenecut_threshold=40", "intra_refresh=False", "MaxBFrame=3", "i_bframe_adaptive=1", "i_bframe_bias=0", "i_bframe_pyramid=2", "b_deblocking_filter=True", "i_deblocking_filter_alphac0=0", "i_deblocking_filter_beta=0"
, "cabac=True", "interlaced=False", "constrained_intra=False", "tff=True", "fake_interlaced=False", "analyze.b_8x8=True", "analyze.b_i4x4=True", "analyze.b_i8x8=True", "analyze.b_p8x8=True", "analyze.b_p16x16=False"
, "analyze.b_b16x16=False", "analyze.weighted_pred=2", "analyze.weighted_bipred=True", "analyze.direct_mv_pred=1", "analyze.chroma_offset=0", "analyze.me_method=1", "analyze.me_range=16", "analyze.mv_range=-1"
, "analyze.mv_range_thread=-1", "analyze.subpel_refine=7", "analyze.chroma_me=True", "analyze.mixed_references=True", "analyze.trellis=1", "analyze.psy_rd=1.000000", "analyze.psy_trellis=0.000000", "analyze.fast_pskip=True"
, "analyze.dct_decimate=True", "analyze.noise_reduction=0", "analyze.psy=True", "analyze.intra_luma=11", "analyze.inter_luma=21", "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "ratecontrol.qp_min=10"
, "ratecontrol.qp_max=51", "ratecontrol.qp_step=4", "ratecontrol.bitrate=0", "ratecontrol.rate_tolerance=1.000000", "ratecontrol.vbv_max_bitrate=0", "ratecontrol.vbv_buffer_size=0", "ratecontrol.vbv_buffer_init=1"
, "ratecontrol.ip_factor=1.400000", "ratecontrol.pb_factor=1.300000", "ratecontrol.aq_mode=1", "ratecontrol.aq_strength=1.000000", "ratecontrol.mb_tree=True", "ratecontrol.lookahead=40")


edit: Additionally, you mix up video codec and container. It should be --output-format MP4 --video-codec %videocodec%

VDD

Thanks a lot for your help, eumagga0x2a!

I got it to work. Yay!