August 12, 2020, 09:59:38 am

News:

--


Project Script

Started by Jan Gruuthuse, June 05, 2018, 06:54:35 am

Previous topic - Next topic

Jan Gruuthuse

June 05, 2018, 06:54:35 am Last Edit: June 05, 2018, 07:56:59 am by Jan Gruuthuse
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.

Jan Gruuthuse

- 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.

Jan Gruuthuse

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")

Jan Gruuthuse

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.

Jan Gruuthuse

June 05, 2018, 07:06:11 am #4 Last Edit: June 05, 2018, 07:50:52 am by Jan Gruuthuse
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

see samples bellow

Jan Gruuthuse

June 05, 2018, 07:15:10 am #5 Last Edit: June 05, 2018, 08:12:52 am by Jan Gruuthuse
/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)

Jan Gruuthuse

June 05, 2018, 07:15:53 am #6 Last Edit: June 05, 2018, 07:49:56 am by Jan Gruuthuse
/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")

Jan Gruuthuse

June 05, 2018, 07:18:21 am #7 Last Edit: June 05, 2018, 07:50:16 am by Jan Gruuthuse
/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

Jan Gruuthuse

June 05, 2018, 07:21:46 am #8 Last Edit: June 05, 2018, 07:50:24 am by Jan Gruuthuse
/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

Jan Gruuthuse

feel free to post your own general saved project script that you apply in the same way ;)
explain briefly what it does. thanks.

signy13

April 29, 2020, 06:01:52 am #10 Last Edit: May 02, 2020, 05:48:27 pm by signy13
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:

  • a script for cutting a movie according A and B markers (this segment is widen by a constant shift).

  • a script for two de-logo concurrent scripts.


Usage of the cutting part:

  • Load movie and set markers A and B in Avidemux.

  • Save a TinyPy project script into a file.

  • Open the script in text editor and copy markers A and B.

  • Open the sheet in attachment and paste values into cells B5 and B6.

  • Copy output cells B8:B10 and paste them into the script (after adm.clearSegments()).

  • Run the updated project script in Avidemux.


Preparation of the de-logo part of the sheet:

  • Get time for start and end for each concurrent de-logo filters (in this example there are just two of them, one for arrow and one for text which appears nearby the arrow after arrows shows) and paste it into cells B15:C16.

  • Relative time distance is counted in E15:F16 (start point is B15).

  • Adjust filter parameters in cells K21:K22 (an easy way is to set filters in Avidemux, save it as a project script and copy values from this script).


Usage of the de-logo part:

  • Open your movie and set Video output codec.

  • Find start of the first filter in Avidemux and copy its time.

  • Save TinyPy script as a file.

  • Open sheet in attachment and paste values into cell B21.

  • Copy output cells B26:B26 into the script (before adm.audioClearTracks()).

  • Run the updated script in Avidemux.

  • If position of de-logo filters is different for different movies check and adjust position in Avidemux.


Colour convention in the sheet:

  • Greyed cells are calculated or have basic settings.

  • Cells for inserting values (when the sheet is used) have white background.

  • Output text is blue.



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")