News:

--

Main Menu

job list

Started by simonalain21, March 16, 2024, 09:23:30 AM

Previous topic - Next topic

simonalain21

Bonjour je voudrais savoir si il serais possible de réencoder directement des videos contenue dans un dossier?

je m'explique j'ai 800+ videos a reencoder, j'ai crée mon script placé dans custom ( je suis sous windows ) et je doit a chaque fois ajouté une par une les videos a la jolist et au bout de 20 j'en est marre....
du coup si il y a possibilité d'encoder toute les videos contenue dans un dossier je suis preneur. merci!


eumagga0x2a

Bonjour,

Je recommanderais d'utiliser le script du message https://avidemux.org/smif/index.php/topic,20393.msg96349.html#msg96349 comme point de départ, à personnaliser en fonction de vos besoins.


simonalain21

merci beaucoup je ne suis pas trés fort en script mais je vais essayer de m'en sortir encore une fois merci !

simonalain21

si jamais ce peux servir voici donc le script j'ai fait au mieux je ne suis pas codeur...j'ai eu beaucoup d'erreur au début mais cette version fonctionne parfaitement.

#PY  <- Needed to identify #
adm = Avidemux()
gui = Gui()
# -------- extention recherché--------
ext = "mkv"
# ----------------
sep = "\\"

def processVideo(vidin, outdir):
    if not adm.loadVideo(vidin):
        return 0
# -------- Audio Config  AC3 stéréo +3 db--------       
    adm.audioClearTracks()
    if adm.audioTotalTracksCount() <= 0:
        return 0
    adm.audioAddTrack(0)
    adm.audioCodec(0, "LavAC3")
    adm.audioSetMixer(0, "STEREO");
    adm.audioSetResample(0, 44100)
    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)
    # -------- DB Boost --------
    adm.audioSetNormalize2(0, 2, 30, -30)
# -------- Video Config -------- 
# -------- X264 , 300Mg  --------
    adm.videoCodec("x264", "useAdvancedConfiguration=False", "general.params=2PASS=300", "general.threads=0", "general.preset=medium", "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=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")
# -------- 1920x1080  --------
    adm.setHDRConfig(1, 1, 1, 1, 0)
    adm.addVideoFilter("fitToSize", "width=1920", "height=1080", "algo=1", "roundup=0", "pad=0", "tolerance=0.000000")
# --------  --------
    adm.setContainer("MKV", "forceAspectRatio=False", "displayWidth=1280", "displayAspectRatio=2", "addColourInfo=False", "colMatrixCoeff=2", "colRange=0", "colTransfer=2", "colPrimaries=2")
    return adm.save(outdir + sep + basename(vidin))
# -------- select input directory --------
inputFolder = gui.dirSelect("Select source folder")
if inputFolder is None:
    gui.displayError("Error", "No source folder selected")
    return 0

# -------- read content --------
vidlist = get_folder_content(inputFolder, ext)
if vidlist is None:
    gui.displayError("Error", "No " + ext + " files found in \"" + inputFolder + "\"")
    return 0
# -------- select output directory --------
outputFolder = gui.dirSelect("Select output folder")
if outputFolder is None:
    gui.displayError("Error", "No output folder selected")
    return 0

if(inputFolder == outputFolder):
    gui.displayError("Error","Output folder cannot be the same as the input one")
    return 0

success = 0

for video in vidlist:
    success += processVideo(video, outputFolder)

if not success:
    gui.displayInfo("Warning", "No video files processed")
elif success == 1:
    gui.displayInfo("Finished", "One video out of " + str(len(vidlist)) + " processed")
else:
    gui.displayInfo("Finished", str(success) + " videos out of " + str(len(vidlist)) + " processed")

return success