Author Topic: Batch Processing - 2PASS=15 not working  (Read 596 times)

VDD

  • Newbie
  • *
  • Posts: 5
Batch Processing - 2PASS=15 not working
« on: April 13, 2019, 05:39:55 PM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3304
Re: Batch Processing - 2PASS=15 not working
« Reply #1 on: April 13, 2019, 06:50:21 PM »
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.
« Last Edit: April 13, 2019, 06:53:46 PM by eumagga0x2a »

VDD

  • Newbie
  • *
  • Posts: 5
Re: Batch Processing - 2PASS=15 not working
« Reply #2 on: April 13, 2019, 07:11:44 PM »
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!
« Last Edit: April 13, 2019, 07:27:31 PM by VDD »

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3304
Re: Batch Processing - 2PASS=15 not working
« Reply #3 on: April 13, 2019, 08:28:05 PM »
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.
« Last Edit: April 13, 2019, 08:29:57 PM by eumagga0x2a »

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3304
Re: Batch Processing - 2PASS=15 not working
« Reply #4 on: April 13, 2019, 09:44:55 PM »
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

  • Newbie
  • *
  • Posts: 5
Re: Batch Processing - 2PASS=15 not working
« Reply #5 on: April 13, 2019, 10:56:58 PM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3304
Re: Batch Processing - 2PASS=15 not working
« Reply #6 on: April 13, 2019, 11:06:40 PM »
--run expects the path to the project script file.

VDD

  • Newbie
  • *
  • Posts: 5
Re: Batch Processing - 2PASS=15 not working
« Reply #7 on: April 13, 2019, 11:34:07 PM »
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

  • Moderator
  • Hero Member
  • *****
  • Posts: 3304
Re: Batch Processing - 2PASS=15 not working
« Reply #8 on: April 13, 2019, 11:48:57 PM »
The content of the .py script is invalid. A valid example:

Code: [Select]
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%
« Last Edit: April 13, 2019, 11:54:52 PM by eumagga0x2a »

VDD

  • Newbie
  • *
  • Posts: 5
Re: Batch Processing - 2PASS=15 not working
« Reply #9 on: April 14, 2019, 01:49:11 PM »
Thanks a lot for your help, eumagga0x2a!

I got it to work. Yay!