Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: TheInvoker on July 08, 2022, 09:08:56 PM

Title: Keep filters
Post by: TheInvoker on July 08, 2022, 09:08:56 PM
Hello
is it possible to keep filters even after loading a new file?
i don't want to set filters every time if are the same.
Title: Re: Keep filters
Post by: eumagga0x2a on July 08, 2022, 10:04:51 PM
This is easily possible, but not automatically as Avidemux cannot know whether the filter chain for one video fits another.

Configure a set of filters, save project, then paste into a text file with ending ".py" below the lines

#PY  <- Needed to identify #

adm = Avidemux()
ed = Editor()
if not ed.nbSegments():
    return

all the lines from your saved project starting with "adm.addVideoFilter", then move the resulting file into the "custom" subdirectory of your Avidemux profile (%appdata%\avidemux\).

After the next start of Avidemux, you should be able to run this script via the "Custom" menu.
Title: Re: Keep filters
Post by: TheInvoker on July 08, 2022, 10:32:04 PM
explain better

i can do
project script ----> save as project
and i save a py file

inside there is this

#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
if not adm.loadVideo("D:/Telefilm/Lucifer.1x13.Riportami.All.Inferno.ITA.ENG.1080p.BDMux.x264-LittleLinX.GiuseppeiCV (1).mkv"):
    raise("Cannot load D:/Telefilm/Lucifer.1x13.Riportami.All.Inferno.ITA.ENG.1080p.BDMux.x264-LittleLinX.GiuseppeiCV (1).mkv")
adm.clearSegments()
adm.addSegment(0, 80000, 2529600000)
adm.markerA = 0
adm.markerB = 2529600000
adm.setHDRConfig(1, 1, 1, 1, 0)
adm.videoCodec("x264", "useAdvancedConfiguration=False", "general.params=CBR=1500", "general.threads=0", "general.preset=fast", "general.tuning=none", "general.profile=high", "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", "vui.overscan=0", "vui.vidformat=5", "vui.fullrange=False"
, "vui.colorprim=2", "vui.transfer=2", "vui.colmatrix=2", "vui.chroma_loc=0", "MaxRefFrames=3", "MinIdr=20", "MaxIdr=20", "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.addVideoFilter("swscale", "width=1280", "height=720", "algo=1", "sourceAR=0", "targetAR=0", "lockAR=True", "roundup=0")
adm.addVideoFilter("waveletSharp", "strength=0.250000", "radius=2.000000", "cutoff=10.000000", "highq=False")
adm.addVideoFilter("eq2", "contrast=1.000000", "brightness=0.000000", "saturation=0.970000", "gamma=1.090000", "gamma_weight=1.000000", "rgamma=1.000000", "bgamma=0.910000", "ggamma=0.940000")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"ita")
adm.setSourceTrackLanguage(1,"und")
if adm.audioTotalTracksCount() <= 0:
    raise("Cannot add audio track 0, total tracks: " + str(adm.audioTotalTracksCount()))
adm.audioAddTrack(0)
adm.audioCodec(0, "copy")
adm.audioSetDrc2(0, 0, 1, 0.001, 0.2, 1, 2, -12)
adm.audioSetEq(0, 0, 0, 0, 0, 880, 5000)
adm.audioSetChannelGains(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelDelays(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelRemap(0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8)
adm.audioSetShift(0, 0, 0)
if adm.audioTotalTracksCount() <= 1:
    raise("Cannot add audio track 1, total tracks: " + str(adm.audioTotalTracksCount()))
adm.audioAddTrack(1)
adm.audioCodec(1, "copy")
adm.audioSetDrc2(1, 0, 1, 0.001, 0.2, 1, 2, -12)
adm.audioSetEq(1, 0, 0, 0, 0, 880, 5000)
adm.audioSetChannelGains(1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelDelays(1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelRemap(1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8)
adm.audioSetShift(1, 0, 0)
adm.setContainer("MKV", "forceAspectRatio=False", "displayWidth=1280", "displayAspectRatio=2", "addColourInfo=False", "colMatrixCoeff=2", "colRange=0", "colTransfer=2", "colPrimaries=2")

wait maybe i did it but i don't know if i have to keep the things after adm.addvideofilters
Title: Re: Keep filters
Post by: eumagga0x2a on July 08, 2022, 11:53:07 PM
Based on your project script, the result should look like

#PY  <- Needed to identify #

adm = Avidemux()
ed = Editor()
if not ed.nbSegments():
    return
adm.addVideoFilter("swscale", "width=1280", "height=720", "algo=1", "sourceAR=0", "targetAR=0", "lockAR=True", "roundup=0")
adm.addVideoFilter("waveletSharp", "strength=0.250000", "radius=2.000000", "cutoff=10.000000", "highq=False")
adm.addVideoFilter("eq2", "contrast=1.000000", "brightness=0.000000", "saturation=0.970000", "gamma=1.090000", "gamma_weight=1.000000", "rgamma=1.000000", "bgamma=0.910000", "ggamma=0.940000")

Quote from: TheInvoker on July 08, 2022, 10:32:04 PMwait maybe i did it but i don't know if i have to keep the things after adm.addvideofilters

It depends entirely on your needs.
Title: Re: Keep filters
Post by: TheInvoker on July 09, 2022, 07:49:21 AM
ok i deleted them.
alll i need to keep is the addvideofilter
thanks