Simple Command line usage with Tinpy Project

Started by Jan Gruuthuse, May 22, 2016, 06:52:08 AM

Previous topic - Next topic

Jan Gruuthuse

passing settings to avidemux command line can easily be done using Tinypy Project.

Jan Gruuthuse

- load similar kind of video you want to to process this way in avidemux 2.6.12 GUI
- select and modify the needed parameters
-- Video Output
--- [Copy] -> [Mpeg4 AVC (x264)
-- Audio Output
--- [Copy] -> [AAC (lav)
see below for additional audio track info

when all settings are made, from
Avidemux Menu -> File -> Tinypy Project -> Save As Project. Use a recognizable file name (making sense what it does)

in this instance I used the name 'x264-aac(lav)' you find it back with the extension .py

Jan Gruuthuse

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

adm = Avidemux()
adm.loadVideo("/home/user/Videos/720p4audioTracks3satá´´á´°.ts")
adm.clearSegments()
adm.addSegment(0, 0, 37930000)
adm.markerA = 0
adm.markerB = 37930000
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=20", "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=-1", "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=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.audioClearTracks()
adm.setSourceTrackLanguage(0,"und")
adm.setSourceTrackLanguage(1,"und")
adm.setSourceTrackLanguage(2,"und")
adm.setSourceTrackLanguage(3,"und")
adm.audioAddTrack(0)
adm.audioCodec(0, "LavAAC");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.audioAddTrack(1)
adm.audioCodec(1, "copy");
adm.audioSetDrc(1, 0)
adm.audioSetShift(1, 0,0)
adm.audioAddTrack(2)
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("AVI", "odmlType=1")

Jan Gruuthuse

#3
remove this block (references to the actual loaded video from your tinypy script:)
adm.loadVideo("/home/user/Videos/720p4audioTracks3sat.ts")
adm.clearSegments()
adm.addSegment(0, 0, 37930000)
adm.markerA = 0
adm.markerB = 37930000

Don't do this with a word processor! use editor like Notepad++
Once your done, save the tinypy script. should be similar to:
#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=20", "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=-1", "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=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.audioClearTracks()
adm.setSourceTrackLanguage(0,"und")
adm.setSourceTrackLanguage(1,"und")
adm.setSourceTrackLanguage(2,"und")
adm.setSourceTrackLanguage(3,"und")
adm.audioAddTrack(0)
adm.audioCodec(0, "LavAAC");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.audioAddTrack(1)
adm.audioCodec(1, "copy");
adm.audioSetDrc(1, 0)
adm.audioSetShift(1, 0,0)
adm.audioAddTrack(2)
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("AVI", "odmlType=1")

Jan Gruuthuse

syntax in batch could be:
set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
for %%f in (*.avi) do %avidemux% --load "%%f" --run "x264-aac(lav).py" --save "%%f.mp4" --quit


C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe must reflect your actual situation, where avidemux is situated!

Jan Gruuthuse

additional audio track info
keep in mind if Audio Output (x track(s)) indicates more then 1 track, you need to make settings for each Audio Track via:
Avidemux Menu -> Audio -> Select Track -> Audio Tracks Configuration
select/ deselect Track 1,2,3 or 4 [v]/[ ]
- select/add in Track 0,1,2,3 or 4 the wanted track
- select in [Unknown] language label for the track
- select in [copy] the require coded ([AAC (lav)]
- select in [Configure] possible parameter to change
- select in [Filters] possible parameter to change

Jan Gruuthuse

avidemux3_cli.exe --help
avidemux.exe --help
would reveal possible settings that can be used:
Command line possible arguments :
    --append, append video  (one arg )
    --audio-codec, set audio codec (MP2/MP3/AC3/NONE (WAV PCM)/TWOLAME/COPY)  (one arg )
    --avisynth-port, set avsproxy port accordingly  (one arg )
    --help, print this  ( no arg )
    --info, show information about loaded video and audio streams  ( no arg )
    --list-audio-languages, list all available audio langues  ( no arg )
    --load, load video or workbench  (one arg )
    --nogui, Run in silent mode  ( no arg )
    --output-format, set output format (AVI|OGM|ES|PS|AVI_DUAL|AVI_UNP|...)  (one arg )
    --quit, exit avidemux  ( no arg )
    --slave, run as slave, master is on port arg  (one arg )
    --reuse-2pass-log, reuse 2pass logfile if it exists  ( no arg )
    --run, load and run a script  (one arg )
    --save, save video  (one arg )
    --save-jpg, save a jpeg  (one arg )
    --save-raw-audio, save audio as-is   (one arg )
    --save-uncompressed-audio, save uncompressed audio  (one arg )
    --set-audio-language, Set language of an active audio track {track_index} {language_short_name}  (two args )
    --var, set var (--var myvar=3)  (one arg )
    --video-codec, set video codec (x264/...)  (one arg )

Jan Gruuthuse

Please do take note of the menu change: You now only have Project Script (run or save) (tinypy project)