Avidemux Forum

Participate => Documentation & Tips => Topic started by: Jan Gruuthuse on June 05, 2018, 06:54:35 AM

Title: Project Script
Post by: Jan Gruuthuse on June 05, 2018, 06:54:35 AM
Frequently using the same settings to apply on your videos?
Save as project and edit the project file so you can use this Project in Avidemux menu Custom.
Title: save Project Script
Post by: Jan Gruuthuse on June 05, 2018, 06:56:28 AM
- Load a common used video into avidemux.
- Make your standard required settings for your workflow like video, audio, filters ...
- Save the project: Avidemux menu: File: Project Script: use a descriptive name so you recognize what the project does.
Title: Edit Project Script
Post by: Jan Gruuthuse on June 05, 2018, 06:58:32 AM
load your saved project file into an ascii editor like file++, gedit:
#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
adm.loadVideo("/media/Work/720p4audioTracks3sat.ts")
adm.clearSegments()
adm.addSegment(0, 0, 37930000)
adm.markerA = 0
adm.markerB = 37930000
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"und")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280", "displayAspectRatio=0")
Title: remove reference to loaded video Project Script
Post by: Jan Gruuthuse on June 05, 2018, 07:03:11 AM
remove this block = reference to loaded video when you saved the script

adm.loadVideo("/media/Work/720p4audioTracks3sat.ts")
adm.clearSegments()
adm.addSegment(0, 0, 37930000)
adm.markerA = 0
adm.markerB = 37930000


so it does not load the video when you apply the script from custom

save the script.
Title: Project Script place into Avidemux Custom
Post by: Jan Gruuthuse on June 05, 2018, 07:06:11 AM
Linux: in the hidden folder: ~/.avidemux6/custom create these folders (could be any name you want)
Audio
Screen
In these you can copy your saved/edited projects of repetitive settings you need to perform like these 2:
ac3T2toT0: dolby track from track 2 to track 0, most of German satellite FTA HD are like this, except phoenix.
3satHDac3: similar as above but has has 4 audio tracks instead of 3
After avidemux restart these are now available in avidemux main menu -> Custom

Windows: something similar should be possible in %APPDATA%/avidemux6/custom Still need confirmation this is the correct folder
Avidemux 2.6.8  custom on Windows 7 (http://avidemux.org/smuf/index.php/topic,16395.msg72203.html#msg72203)

see samples bellow
Title: audio: ac3T2toT0
Post by: Jan Gruuthuse on June 05, 2018, 07:15:10 AM
/custom/Audio

#PY  <- Needed to identify #
#--automatically built--
# ard HD exchange audio tracks from position
# hr, mdr, ndr, swr, ...
# source video: xp1000

adm = Avidemux()
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"deu")
adm.setSourceTrackLanguage(1,"deu")
adm.setSourceTrackLanguage(2,"deu")
adm.audioAddTrack(2)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.audioAddTrack(0)
adm.audioCodec(1, "copy");
adm.audioSetDrc(1, 0)
adm.audioSetShift(1, 0,0)
adm.audioAddTrack(1)
adm.audioCodec(2, "copy");
adm.audioSetDrc(2, 0)
adm.audioSetShift(2, 0,0)
adm.setContainer("ffTS", "acceptNonCompliant=False", "vbr=True", "muxRateInMBits=10")


switches ac3 3rd track (2) to 1st track (0) and track (0) to track (2)
Title: audio: 3satHDac3
Post by: Jan Gruuthuse on June 05, 2018, 07:15:53 AM
/custom/Audio

#PY  <- Needed to identify #
#--automatically built--
# 3sat HD exchange audio tracks from position
# source video: xp1000, xp1000s, TM6900HDsuper
# 2015 June

adm = Avidemux()
adm.videoCodec("Copy")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"deu")
adm.setSourceTrackLanguage(1,"deu")
adm.setSourceTrackLanguage(2,"deu")
adm.setSourceTrackLanguage(3,"deu")
adm.audioAddTrack(2)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.audioAddTrack(0)
adm.audioCodec(1, "copy");
adm.audioSetDrc(1, 0)
adm.audioSetShift(1, 0,0)
adm.audioAddTrack(1)
adm.audioCodec(2, "copy");
adm.audioSetDrc(2, 0)
adm.audioSetShift(2, 0,0)
adm.audioAddTrack(3)
adm.audioCodec(3, "copy");
adm.audioSetDrc(3, 0)
adm.audioSetShift(3, 0,0)
adm.setContainer("ffTS", "acceptNonCompliant=False", "vbr=True", "muxRateInMBits=10")
Title: screen: 0768x432vdpauResize
Post by: Jan Gruuthuse on June 05, 2018, 07:18:21 AM
/custom/Screen

#PY  <- Needed to identify #
#--automatically built--
# 16:9 768*432
adm = Avidemux()
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=23", "general.threads=0", "general.preset=ultrafast", "general.tuning=film", "general.profile=baseline", "general.fast_decode=False", "general.zero_latency=False"
, "general.fast_first_pass=True", "level=41", "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=0", "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("vdpauResize", "targetWidth=768", "targetHeight=432")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"eng")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280")


output sample on YouTube: 720p to 768x432 (https://www.youtube.com/watch?v=d6s93dqVUPs)
Title: screen: 0854x480 Sony Xperia M
Post by: Jan Gruuthuse on June 05, 2018, 07:21:46 AM
/custom/Screen

#PY  <- Needed to identify #
#--automatically built--
# 16:9 854*480
# Sony Xperia M

adm = Avidemux()
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=23", "general.threads=0", "general.preset=ultrafast", "general.tuning=film", "general.profile=baseline", "general.fast_decode=False", "general.zero_latency=False"
, "general.fast_first_pass=True", "level=41", "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=0", "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("vdpauResize", "targetWidth=854", "targetHeight=480")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"eng")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MKV", "forceDisplayWidth=False", "displayWidth=1280")


output sample on YouTube: Sony Xperia M (https://www.youtube.com/watch?v=LhpZrZ4GdW0)
Title: Re: Project Script
Post by: Jan Gruuthuse on June 05, 2018, 08:16:27 AM
feel free to post your own general saved project script that you apply in the same way ;)
explain briefly what it does. thanks.
Title: Script generating in LibreOffice Calc
Post by: signy13 on April 29, 2020, 06:01:52 AM
I spend some time with adding de-logo scripts to remove some annoying logos which appear in movies recorded from TV. Because recordings is usually longer than the actual movie, it is convenient to cut just a part of the recording. Doing it with many movies is tedious so I created a sheet for LibreOffice Calc which generates:
Usage of the cutting part:
Preparation of the de-logo part of the sheet:
Usage of the de-logo part:
Colour convention in the sheet:

After long time of using LibreOffice Calc for generating this script I found much easier way how to do this de-logo thing just with function getCurrentPts() (which works only in the newest Avidemux):
#PY  <- Needed to identify #
# Inserts 2 de-logo filters, based on current position in video

adm = Avidemux()
ed = Editor()

# Timestamps for filter A (Begin, End)
ts_ab = int(ed.getCurrentPts() / 1000)
ts_ae = ts_ab + 5240
# Timestamps for filter B (Begin, End)
ts_bb = ts_ab + 298
ts_be = ts_ab + 5240

adm.addVideoFilter("partial", "filterName=mpdelogo2", "startBlack="+str(ts_ab), "endBlack="+str(ts_ae), "xoff=748", "yoff=372", "lw=29", "lh=24", "band=0", "show=False")

adm.addVideoFilter("partial", "filterName=mpdelogo2", "startBlack="+str(ts_bb), "endBlack="+str(ts_be), "xoff=750", "yoff=395", "lw=106", "lh=70", "band=0", "show=False")