Avidemux Forum

Avidemux => Windows => Topic started by: Ceyarrecks on November 30, 2021, 07:21:33 PM

Title: TinyPy: Exception
Post by: Ceyarrecks on November 30, 2021, 07:21:33 PM
 as I am completely ignorant of the Python programming language, the searches of other posts with similar problems have not lead me to an understanding of what my specific problem is in Batch converting .avi to .mkv files.

here is error message:

TinyPy: Exception
Esception: (_tp_dict_get) KeyError: adm
BackTrack:
File: py2bc.py, line 53
File: E:\Temp\Stargate(s)\SG1\MKVConverts.py, line: 3

cmd window displaying:

E:\Temp\Stargate(s)\SG1>set avidemux= "C:\Program Files\DVD\Avidemux 2.7.6\avide
mux.exe"

E:\Temp\Stargate(s)\SG1>set videocodec=Mpeg4 AVC (x264)

E:\Temp\Stargate(s)\SG1>set audiocodec=MP3 (lame)

E:\Temp\Stargate(s)\SG1>for %f in (*.avi) do "C:\Program Files\DVD\Avidemux 2.7.
6\avidemux.exe" --video-codec Mpeg4 AVC (x264) --audio-codec MP3 (lame) --force-
alt-h264 --load "%f" --run MKVConverts.py  --save "%f.mkv" --quit

E:\Temp\Stargate(s)\SG1>"C:\Program Files\DVD\Avidemux 2.7.6\avidemux.exe" --vid
eo-codec Mpeg4 AVC (x264) --audio-codec MP3 (lame) --force-alt-h264 --load "SG1-
Extras-00.avi" --run MKVConverts.py  --save "SG1-Extras-00.avi.mkv" --quit

and, btw, WHY is AviDemux saving with the double extension?! :o

AviDemux 2.7.6 defaults are supposed to be:
Mpeg4 AVC (x264)
MP3 (lame)
Mkv Muxer

However, BAT-initiated instance displays, "Copy" for Audio Output
Also, referenced file: py2bc.py not found anywhere on HD.

here is current edition of .py

#PY  <- Needed to identify #
#--automatically built--adm.setPostProc(3, 3, 0)
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=20", "general.threads=99", "general.preset=", "general.tuning=", "general.profile=", "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")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"und")
adm.audioAddTrack(0)
adm.audioCodec(0, "Lame");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0, 0)
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280", "displayAspectRatio=0")

where i already removed the aforementioned lines from the "Saved Project" of:

adm.loadVideo
adm.clearSegments
adm.addSegment
adm.markerA
adm.markerB

rather feel like i am stumbling around in the dark with a slowly fading glow-in-the-dark map,...
any guidance would be greatly appreciated.


EDIT:
also, were I to want to accomplish the above but with Copy/Copy/Mkv, how would I accomplish that as well?

Title: Re: TinyPy: Exception
Post by: szlldm on November 30, 2021, 08:15:03 PM
The 2.7.6 version is very very ancient old and unsupported. The current release is 2.7.8, while 2.8.0 coming within days (hopefully).
Title: Re: TinyPy: Exception
Post by: eumagga0x2a on November 30, 2021, 10:36:12 PM
Quote from: Ceyarrecks on November 30, 2021, 07:21:33 PME:\Temp\Stargate(s)\SG1>"C:\Program Files\DVD\Avidemux 2.7.6\avidemux.exe" --vid
eo-codec Mpeg4 AVC (x264) --audio-codec MP3 (lame) --force-alt-h264 --load "SG1-
Extras-00.avi" --run MKVConverts.py  --save "SG1-Extras-00.avi.mkv" --quit

No up-to-date version would help here. Almost everything is wrong / contradictory / unnecessary.

If you want to use cmd.exe, why don't using the cli executable from the start on?

If you specify encoder via tinyPy script, don't try to do this on the command line (which fails already because "Mpeg4" is not a valid encoder name). If you don't escape spaces or use quote marks, the space before "AVC" separates arguments (using quotes or escaping the space wouldn't help because "Mpeg4 AVC (x264)" is not a valid encoder name either, but x264 alone would be correct).

The same applies to the audio codec.

--force-alt-h264 is invalid since a decade or so, but harmless as it is ignored.

--load should be placed first.

Quote from: Ceyarrecks on November 30, 2021, 07:21:33 PMand, btw, WHY is AviDemux saving with the double extension?!

Your command line orders it to do so.

You get tinyPy exception because you haven't defined adm before calling its member. It was meant to be

adm = Avidemux()
first, then you can reference it as adm.