Skip to content

Commit

Permalink
[autoScripts] Update scripts to current APIs, fix dictionary error me…
Browse files Browse the repository at this point in the history
…ssage on cancel, unify indentation for the sake of better legibility
  • Loading branch information
eumagga0x2a committed Jan 12, 2020
1 parent c73e7dd commit a122720
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 70 deletions.
8 changes: 4 additions & 4 deletions avidemux_plugins/ADM_autoScrips/720p.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
dlgWizard.addControl(mnuDeint);
res=dlgWizard.show()
if res!=1:
exit()
return
source.ar=mnuSourceRatio.index
dest.ar=ADM_image.AR_1_1
deint=mnuDeint.index
Expand All @@ -60,7 +60,7 @@
# Resize
resizer=source.compute_resize(source,dest,1280,[720,720,720],ADM_imageInfo.aspectRatio)
if(resizer is None):
exit()
return
print("Resize to "+str(resizer.width)+"x"+str(resizer.height))
# No need to add black border
resizer.leftright=0
Expand All @@ -84,5 +84,5 @@
###################################
# Container = Mpeg PS/DVD
###################################
adm.setContainer("MKV","forceDisplayWidth=False","displayWidth=1280")
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280", "displayAspectRatio=0")

27 changes: 12 additions & 15 deletions avidemux_plugins/ADM_autoScrips/PSP.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
dlgWizard.addControl(mnuSourceRatio);
res=dlgWizard.show()
if res!=1:
exit()
return
source.ar=mnuSourceRatio.index
dest.ar=1
resizer=source.compute_resize(source,dest,finalSizeWidth,finalSizeHeight,ADM_imageInfo.aspectRatio)
if(resizer is None):
exit()
return
print("Resize to "+str(resizer.width)+"x"+str(resizer.height))
source.apply_resize(resizer)
############################
Expand All @@ -62,22 +62,19 @@
##################################
# Video
##################################
adm.videoCodec("x264", "general.params=CBR=500", "general.threads=99", "general.fast_first_pass=True", "level=30", "vui.sar_height=1", "vui.sar_width=1",
"MaxRefFrames=2", "MinIdr=0", "MaxIdr=250", "i_scenecut_threshold=40", "intra_refresh=False", "MaxBFrame=2", "i_bframe_adaptive=0",
"i_bframe_bias=0", "i_bframe_pyramid=0", "b_deblocking_filter=False", "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=False", "analyze.b_i4x4=True", "analyze.b_i8x8=False", "analyze.b_p8x8=True", "analyze.b_p16x16=False",
"analyze.b_b16x16=False", "analyze.weighted_pred=2", "analyze.weighted_bipred=True", "analyze.direct_mv_pred=3",
"analyze.chroma_offset=0", "analyze.me_method=0", "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=0", "ratecontrol.qp_max=32", "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=0", "ratecontrol.ip_factor=1.000000", "ratecontrol.pb_factor=1.000000", "ratecontrol.aq_mode=1",
"ratecontrol.aq_strength=1.000000", "ratecontrol.mb_tree=True", "ratecontrol.lookahead=40")
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=CBR=500", "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=30", "vui.sar_height=1", "vui.sar_width=1", "MaxRefFrames=2", "MinIdr=0", "MaxIdr=250", "i_scenecut_threshold=40"
, "intra_refresh=False", "MaxBFrame=2", "i_bframe_adaptive=0", "i_bframe_bias=0", "i_bframe_pyramid=0", "b_deblocking_filter=False", "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=False", "analyze.b_p8x8=True", "analyze.b_p16x16=False", "analyze.b_b16x16=False"
, "analyze.weighted_pred=2", "analyze.weighted_bipred=True", "analyze.direct_mv_pred=3", "analyze.chroma_offset=0", "analyze.me_method=0", "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=0", "ratecontrol.qp_max=32"
, "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=0", "ratecontrol.ip_factor=1.000000"
, "ratecontrol.pb_factor=1.000000", "ratecontrol.aq_mode=1", "ratecontrol.aq_strength=1.000000", "ratecontrol.mb_tree=True", "ratecontrol.lookahead=40")

###################################
# Container = MP4
###################################
#
#
adm.setContainer("MP4", "muxerType=1", "useAlternateMp3Tag=True", "forceAspectRatio=False", "aspectRatio=1")

adm.setContainer("MP4", "muxerType=1", "optimize=1", "forceAspectRatio=False", "aspectRatio=1", "rotation=0", "clockfreq=0")
10 changes: 3 additions & 7 deletions avidemux_plugins/ADM_autoScrips/check24fps.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,10 @@
# end while
total=ntsc+film+other+pal
if(total==0):
gui.displayInfo("Not enough info to check...")
exit(0)

gui.displayInfo("Not enough info to check...")
return
pal=round(0.4+(100*pal)/total)
ntsc=round(0.4+(100*ntsc)/total)
film=round((100*film)/total)
other=round(0.4+(100*other)/total)
gui.displayInfo("Framerate check","Pal ="+str(pal)+"%\nFilm="+str(film)+"%\n Ntsc="+str(ntsc)+"%\nOther="+str(other)+"%")
#


gui.displayInfo("Framerate check","Pal ="+str(pal)+"%\nFilm="+str(film)+"%\n Ntsc="+str(ntsc)+"%\nOther="+str(other)+"%")
39 changes: 19 additions & 20 deletions avidemux_plugins/ADM_autoScrips/dvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
dlgWizard.addControl(mnuDestRatio);
res=dlgWizard.show()
if res!=1:
exit()
return
source.ar=mnuSourceRatio.index
dest.ar=mnuDestRatio.index+1
resizer=source.compute_resize(source,dest,finalSizeWidth,finalSizeHeight,ADM_imageInfo.aspectRatio)
if(resizer is None):
exit()
return
print("Resize to "+str(resizer.width)+"x"+str(resizer.height))
source.apply_resize(resizer)
############################
Expand All @@ -68,33 +68,32 @@
print("We have "+str(tracks)+ " audio tracks.")
if tracks==0:
gui.displayError("Audio","No audio tracks!")
exit()
return
for i in range(0,tracks):
print("Processing track "+str(i))
encoding=adm.audioEncoding(i)
fq=adm.audioFrequency(i)
channels=adm.audioChannels(i)
reencode=False
# 1 check frequency
if(fq != 48000):
adm.audioSetResample(i,48000)
reencode=True
if(not(encoding in supported)):
reencode=True
if(True==reencode):
if(channels!=2):
adm.audioSetMixer(i,"STEREO")
adm.audioCodec(i,"LavAC3","bitrate=224")
print("Processing track "+str(i))
encoding=adm.audioEncoding(i)
fq=adm.audioFrequency(i)
channels=adm.audioChannels(i)
reencode=False
# 1 check frequency
if(fq != 48000):
adm.audioSetResample(i,48000)
reencode=True
if(not(encoding in supported)):
reencode=True
if(True==reencode):
if(channels!=2):
adm.audioSetMixer(i,"STEREO")
adm.audioCodec(i,"LavAC3","bitrate=224")
##################################
# Video
##################################
ff_ar="widescreen=False"
if(resizer.ar==ADM_image.AR_16_9):
ff_ar="widescreen=True"
#
adm.videoCodec("ffMpeg2","params=CQ=2","lavcSettings=:version=2:MultiThreaded=2:me_method=5:_GMC=False:_4MV=False:_QPEL=False:_TRELLIS_QUANT=True:qmin=2:qmax=31:max_qdiff=3:max_b_frames=2:mpeg_quant=1:is_luma_elim_threshold=1:luma_elim_threshold=4294967294:is_chroma_elim_threshold=1:chroma_elim_threshold=4294967291:lumi_masking=0.050000:is_lumi_masking=1:dark_masking=0.010000:is_dark_masking=1:qcompress=0.500000:qblur=0.500000:"+"minBitrate=0:maxBitrate=9500:user_matrix=1:gop_size=18:interlaced=False:bff=False:"+str(ff_ar)+":"+"mb_eval=2:vratetol=8000:is_temporal_cplx_masking=False:temporal_cplx_masking=0.000000:is_spatial_cplx_masking=False:spatial_cplx_masking=0.000000:_NORMALIZE_AQP=False:use_xvid_ratecontrol=False:bufferSize=224:override_ratecontrol=False:dummy=0","matrix=0")
adm.videoCodec("ffMpeg2","params=CQ=2","lavcSettings=:version=2:MultiThreaded=2:_4MV=False:_QPEL=False:_TRELLIS_QUANT=True:qmin=2:qmax=31:max_qdiff=3:max_b_frames=2:mpeg_quant=1:is_luma_elim_threshold=1:luma_elim_threshold=4294967294:is_chroma_elim_threshold=1:chroma_elim_threshold=4294967291:lumi_masking=0.050000:is_lumi_masking=1:dark_masking=0.010000:is_dark_masking=1:qcompress=0.500000:qblur=0.500000:"+"minBitrate=0:maxBitrate=9500:user_matrix=1:gop_size=18:interlaced=False:bff=False:"+str(ff_ar)+":"+"mb_eval=2:vratetol=8000:is_temporal_cplx_masking=False:temporal_cplx_masking=0.000000:is_spatial_cplx_masking=False:spatial_cplx_masking=0.000000:_NORMALIZE_AQP=False:use_xvid_ratecontrol=False:bufferSize=224:override_ratecontrol=False:dummy=0","matrix=0")
###################################
# Container = Mpeg PS/DVD
###################################
adm.setContainer("ffPS","muxingType=2","acceptNonCompliant=False","muxRatekBits=11000","videoRatekBits=9800","bufferSizekBytes=224")

38 changes: 19 additions & 19 deletions avidemux_plugins/ADM_autoScrips/svcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
dlgWizard.addControl(mnuDestRatio);
res=dlgWizard.show()
if res!=1:
exit()
return
source.ar=mnuSourceRatio.index
dest.ar=mnuDestRatio.index+1
resizer=source.compute_resize(source,dest,finalSizeWidth,finalSizeHeight,ADM_imageInfo.aspectRatio)
if(resizer is None):
exit()
return
print("Resize to "+str(resizer.width)+"x"+str(resizer.height))
# Correct so that result is 2/3 D1 i.e. 480xxxx
newW=resizer.width
Expand All @@ -71,31 +71,31 @@
print("We have "+str(tracks)+ " audio tracks.")
if tracks==0:
gui.displayError("Audio","No audio tracks!")
exit()
return
for i in range(0,tracks):
encoding=adm.audioEncoding(i)
fq=adm.audioFrequency(i)
channels=adm.audioChannels(i)
reencode=False
# 1 check frequency
if(fq != 44100):
adm.audioSetResample(i,44100)
reencode=True
if(not(encoding in supported)):
reencode=True
if(channels!=2):
adm.audioSetMixer(i,"STEREO")
reencode=True
if(True==reencode):
adm.audioCodec(i,"TwoLame","bitrate=224")
encoding=adm.audioEncoding(i)
fq=adm.audioFrequency(i)
channels=adm.audioChannels(i)
reencode=False
# 1 check frequency
if(fq != 44100):
adm.audioSetResample(i,44100)
reencode=True
if(not(encoding in supported)):
reencode=True
if(channels!=2):
adm.audioSetMixer(i,"STEREO")
reencode=True
if(True==reencode):
adm.audioCodec(i,"TwoLame","bitrate=224")
##################################
# Video
##################################
ff_ar="widescreen=False"
if(resizer.ar==ADM_image.AR_16_9):
ff_ar="widescreen=True"
#
adm.videoCodec("ffMpeg2","params=CQ=4","lavcSettings=:version=2:MultiThreaded=2:me_method=5:_GMC=False:_4MV=False:_QPEL=False:_TRELLIS_QUANT=True:qmin=2:qmax=31:max_qdiff=3:max_b_frames=2:mpeg_quant=1:is_luma_elim_threshold=1:luma_elim_threshold=4294967294:is_chroma_elim_threshold=1:chroma_elim_threshold=4294967291:lumi_masking=0.050000:is_lumi_masking=1:dark_masking=0.010000:is_dark_masking=1:qcompress=0.500000:qblur=0.500000:minBitrate=0:maxBitrate=2400:user_matrix=1:gop_size=18:interlaced=False:bff=False:"+str(ff_ar)+":mb_eval=2:vratetol=8000:is_temporal_cplx_masking=False:temporal_cplx_masking=0.000000:is_spatial_cplx_masking=False:spatial_cplx_masking=0.000000:_NORMALIZE_AQP=False:use_xvid_ratecontrol=False:bufferSize=112:override_ratecontrol=False:dummy=0","matrix=1")
adm.videoCodec("ffMpeg2","params=CQ=4","lavcSettings=:version=2:MultiThreaded=2:_4MV=False:_QPEL=False:_TRELLIS_QUANT=True:qmin=2:qmax=31:max_qdiff=3:max_b_frames=2:mpeg_quant=1:is_luma_elim_threshold=1:luma_elim_threshold=4294967294:is_chroma_elim_threshold=1:chroma_elim_threshold=4294967291:lumi_masking=0.050000:is_lumi_masking=1:dark_masking=0.010000:is_dark_masking=1:qcompress=0.500000:qblur=0.500000:minBitrate=0:maxBitrate=2400:user_matrix=1:gop_size=18:interlaced=False:bff=False:"+str(ff_ar)+":mb_eval=2:vratetol=8000:is_temporal_cplx_masking=False:temporal_cplx_masking=0.000000:is_spatial_cplx_masking=False:spatial_cplx_masking=0.000000:_NORMALIZE_AQP=False:use_xvid_ratecontrol=False:bufferSize=112:override_ratecontrol=False:dummy=0","matrix=1")

###################################
# Container = Mpeg PS/DVD
Expand Down
10 changes: 5 additions & 5 deletions avidemux_plugins/ADM_autoScrips/vcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
dlgWizard.addControl(mnuDestRatio);
res=dlgWizard.show()
if res!=1:
exit()
return
source.ar=mnuSourceRatio.index
dest.ar=mnuDestRatio.index+1
resizer=source.compute_resize(source,dest,finalSizeWidth,finalSizeHeight,ADM_imageInfo.aspectRatio)
if(resizer is None):
exit()
return
print("Resize to "+str(resizer.width)+"x"+str(resizer.height))
source.apply_resize(resizer)
############################
Expand All @@ -64,8 +64,8 @@
tracks=adm.audioTracksCount()
print("We have "+str(tracks)+ " audio tracks.")
if(tracks!=1):
gui.displayError("Error","Please have only one audio track for VCD!")
exit()
gui.displayError("Error","Please have only one audio track for VCD!")
return
encoding=adm.audioEncoding(0)
fq=adm.audioFrequency(0)
channels=adm.audioChannels(0)
Expand All @@ -88,7 +88,7 @@
if(resizer.ar==ADM_image.AR_16_9):
ff_ar="widescreen=True"
#
adm.videoCodec("ffMpeg2","params=CQ=2","lavcSettings=:version=2:MultiThreaded=2:me_method=5:_GMC=False:_4MV=False:_QPEL=False:_TRELLIS_QUANT=True:qmin=2:qmax=31:max_qdiff=3:max_b_frames=2:mpeg_quant=1:is_luma_elim_threshold=1:luma_elim_threshold=4294967294:is_chroma_elim_threshold=1:chroma_elim_threshold=4294967291:lumi_masking=0.050000:is_lumi_masking=1:dark_masking=0.010000:is_dark_masking=1:qcompress=0.500000:qblur=0.500000:"+"minBitrate=0:maxBitrate=9500:user_matrix=1:gop_size=18:interlaced=False:bff=False:"+str(ff_ar)+":"+"mb_eval=2:vratetol=8000:is_temporal_cplx_masking=False:temporal_cplx_masking=0.000000:is_spatial_cplx_masking=False:spatial_cplx_masking=0.000000:_NORMALIZE_AQP=False:use_xvid_ratecontrol=False:bufferSize=224:override_ratecontrol=False:dummy=False","matrix=0")
adm.videoCodec("ffMpeg2","params=CQ=2","lavcSettings=:version=2:MultiThreaded=2:_4MV=False:_QPEL=False:_TRELLIS_QUANT=True:qmin=2:qmax=31:max_qdiff=3:max_b_frames=2:mpeg_quant=1:is_luma_elim_threshold=1:luma_elim_threshold=4294967294:is_chroma_elim_threshold=1:chroma_elim_threshold=4294967291:lumi_masking=0.050000:is_lumi_masking=1:dark_masking=0.010000:is_dark_masking=1:qcompress=0.500000:qblur=0.500000:"+"minBitrate=0:maxBitrate=9500:user_matrix=1:gop_size=18:interlaced=False:bff=False:"+str(ff_ar)+":"+"mb_eval=2:vratetol=8000:is_temporal_cplx_masking=False:temporal_cplx_masking=0.000000:is_spatial_cplx_masking=False:spatial_cplx_masking=0.000000:_NORMALIZE_AQP=False:use_xvid_ratecontrol=False:bufferSize=224:override_ratecontrol=False:dummy=False","matrix=0")
###################################
# Container = Mpeg PS/DVD
###################################
Expand Down

0 comments on commit a122720

Please sign in to comment.