Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: DoctorNull on May 06, 2016, 04:44:03 PM

Title: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 04:44:03 PM
I am using Avidemux 2.6.10 and lately I have 2 problems with the scripting of Avidemux which is now Python based using tinypy.

I am using the following references:
http://hamaluik.com/posts/changing-the-audio-track-of-a-video-with-avidemux/
http://www.avidemux.org/admWiki/doku.php?id=tinypy:gui

1. I have written the following script (I am not proficient in Python so all comments are welcome), but it seems like that after adding the subtitles (*.ass file) to the video (encoding it), the video file size getting MUCH BIGGER than it was before. It happens mostly with *.avi files.

2. I would like to know how is it possible to do that it will encode the list of files in the selected directory, even if it contains several file's types (*.avi / *.mkv / *.mp4 etc.)

adm = Avidemux()
gui = Gui()

def convert(filein):
onlyName = basename(filein)
fileout=filein
subtitle = onlyName[:-3]
dir = dirname(filein) + "/"
subtitle = dir+subtitle+"ass"
if(0 == adm.loadVideo(filein)):
gui.displayError("ops", "cannot load "+filein)
raise
adm.videoCodec("xvid4", "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"
, "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=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.setContainer("AVI", "muxerType=0", "useAlternateMp3Tag=True")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile="+subtitle, "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile=C:/Program Files/Avidemux 2.6 - 64 bits/credits.ass", "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.save("C:/Users/DoctorNull/Desktop/Encoded"+onlyName)


folder = gui.dirSelect("Select the folder with the videos")
list=get_folder_content(folder,"avi")
if(list is None):
raise
for i in list:
convert(i)


EDIT:
In short:
The code takes a subtitles file called "credits" (which located inside the folder of Avidemux),
finds all *.avi files in the chosen folder by the user and checks subtitle files have identical names * .ass video files,
and encodes the subtitles (both "credits" and the matching *.ass named file) into each video file, one after one.

so, for example:
Quoteselected folder: "To Encode"
files in selected folder:
abcd.avi
abcd.ass
efgh.avi
efgh.ass
ijkl.mp4
ijkl.ass

the existing code will relate only to the first 2 files, since they are the only *.avi files.
I want it to encode ALL of the files, both *.avi and *.mp4


I hope what I have requested is possible and really appreciate any help you can provide.
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 06:42:20 PM
general.params=AQ=24 or even higher.
Use one of your avi's. Mark 10 seconds and save with different settings 24, 26, 28, ..
See what is still acceptable for you.
in avidemux QT gui this is controlled in Video Output
[Mpeg4 AVC (x264)]
[ Configure ]
[General]
Rate Control
move the slider to the right to increase the value (general.params=AQ=) and lower video quality.
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 06:46:03 PM
Probably you're looking for this: Sample script : Convert a whole folder (http://avidemux.org/smif/index.php/topic,16140.0.html)
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 06:48:01 PM
You do know you could remux .ass file directly into mkv. That is if your media player does support ass in subtitle track.
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 07:13:27 PM
First, I will begin by saying THANK YOU for the quick answers listed, I do not see it as obvious.

Quote from: Jan Gruuthuse on May 06, 2016, 06:42:20 PM
general.params=AQ=24 or even higher.
Use one of your avi's. Mark 10 seconds and save with different settings 24, 26, 28, ..
See what is still acceptable for you.
in avidemux QT gui this is controlled in Video Output
[Mpeg4 AVC (x264)]
[ Configure ]
[General]
Rate Control
move the slider to the right to increase the value (general.params=AQ=) and lower video quality.
I guess that this section refers to my first issue?
I'd love to keep the quality of the file as is (or at least as close as possible to the source), and still encode the subtitles.
I am able to do this with softwares like VirtualDubMod, but with the script I wrote it looks like something went wrong.
Anyway, I will try to increase slightly the general.params=AQ= parameter and get back to you with an answer.

Quote from: Jan Gruuthuse on May 06, 2016, 06:46:03 PM
Probably you're looking for this: Sample script : Convert a whole folder (http://avidemux.org/smif/index.php/topic,16140.0.html)
If I got it right and it refers to the second issue, that would be lovely. Yet, the file seems to be missing ("404 - Attachment Not Found").
Quote from: Jan Gruuthuse on May 06, 2016, 06:48:01 PM
You do know you could remux .ass file directly into mkv. That is if your media player does support ass in subtitle track.
I could not understand this part. Would you please rephrase?
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 07:38:39 PM
you now are burning subtitle into image.
some players do support subtitle files (internal or external)
mkvtoolnix can take the subtitles (*.ass file)  directly into the mkv container.
A supporting player (like vlc) allows you then to select a subtitle for display.
Could be more the one subtitle (language for expample)
---
sorry for the missing file. Was not aware these were gone.
sample script by mean. you still need to modify
- add extra loop, where you would change the variable ext with the other needed file extensions (mp4, ...)
ext="avi"
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 07:50:31 PM
Quote from: Jan Gruuthuse on May 06, 2016, 07:38:39 PM
you now are burning subtitle into image.
some players do support subtitle files (internal or external)
mkvtoolnix can take the subtitles (*.ass file)  directly into the mkv container.
A supporting player (like vlc) allows you the to select subtitle for display.
could be more the one subtitle (language for expample)

sorry for the missing file. Was not aware these were gone.
see if i can upload one
Replying for each problem mentioned in the original message (so it will be easier to follow):

1. Unfortunately, as far as I can tell, changing the general.params=AQ= parameter does not affect the encoded video file size.
Is there anything else/more that I should change in order to maintain the quality, yet reduce the video file size?

2.I will appreciate it very much if you could recover a file like that. Yet, before you do, let me just clarify:
I want that when I activate the script, it will encode ALL the video files on the selected folder, whether some of them has the same format or not (could be just *.avi but could be also some as *.avi and some as *.mp4)
It should be possible with
if filein.lower().endswith('*.avi'):
   ....
elif filein.lower().endswith('*.mkv'):
   ....
elif filein.lower().endswith('*.mp4'):
   ....

yet I am not sure where or how to do so.



As about encoding the subtitles, I know that some media-players support subtitles, as a matter of fact I use one (VLC), yet the purpose is to implement the subtitles and upload it for others to see it online.

Thanks again, and looking forward to your reply.
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 08:11:43 PM
720p video 0.01 second with
general.params=AQ=20 give me filesize of 178.5 kB
general.params=AQ=24 give me filesize of 145.9 kB
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=24", "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", "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=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")

sorry not familiar any more with windows and batch programming.
I'm a user just as you are, don't have access to servers.
If you have one working for avi, at the end, copy code again:

ext="mp4"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")


need another extention:
ext="flv"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 08:35:21 PM
Quote from: Jan Gruuthuse on May 06, 2016, 08:11:43 PM
720p video 0.01 second with
general.params=AQ=20 give me filesize of 178.5 kB
general.params=AQ=24 give me filesize of 145.9 kB

sorry not familiar any more with windows and batch programming.
I'm a user just as you are, don't have access to servers.
1. That's a shame. I guess I'll wait for someone's else reply about this first issue?



Quote from: Jan Gruuthuse on May 06, 2016, 08:11:43 PMIf you have one working for avi, at the end, copy code again:

ext="mp4"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")


need another extention:
ext="flv"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")

2. As I wrote at the beginning, the code works! IT DOES WORK! in a matter of fact, that's what the code does in short:
QuoteThe code takes a subtitles file called "credits" (which located inside the folder of Avidemux),
finds all *.avi files in the chosen folder by the user and checks subtitle files have identical names * .ass video files,
and encodes the subtitles (both "credits" and the matching *.ass named file) into each video file, one after one.

so, for example:
Quoteselected folder: "To Encode"
files in selected folder:
abcd.avi
abcd.ass
efgh.avi
efgh.ass
ijkl.mp4
ijkl.ass

the existing code will relate only to the first 2 files, since they are the only *.avi files.
I want it to encode ALL of the files, both *.avi and *.mp4
Yet, I am not sure how to fit it to run on all types of video files without creating additional python files in which you change only a few small details?
Would appreciate it if you could adjust the existing code (which appears at the top of the topic) to run on multiple formats (avi/mkv/mp4 etc.)
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 09:00:34 PM
If you have one working for avi, at the end, copy code again:

ext="mp4"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")


need another extention:
ext="flv"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")


If I'm not mistaken these are the control blocks.

Just append to the original.
1st processed are avi's, when that is finished
mp4's will be processed, when that is finished
flv's will be processed

and so for each control block you copy with other file ext

normally you would have some loop in above sample, 3 countx (x = 1, ext = avi; x = 2 , ext = mp4, x = 3, ext = flv) on each increment you would change the ext variable with an other (avi, mp4, flv, ...)
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 09:13:18 PM
Quote from: Jan Gruuthuse on May 06, 2016, 09:00:34 PM
If you have one working for avi, at the end, copy code again:

ext="mp4"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")


need another extention:
ext="flv"
if(folder is None):
    ui.displayError("oops","no folder selected")
    raise
list=get_folder_content(folder,ext)
for i in list:
        convert(i)
print("Done")


If I'm not mistaken these are the control blocks.

Just append to the original.
1st processed are avi's, when that is finished
mp4's will be processed, when that is finished
flv's will be processed

and so for each control block you copy with other file ext

normally you would have some loop in above sample, 3 countx (x = 1, ext = avi; x = 2 , ext = mp4, x = 3, ext = flv) on each increment you would change the ext variable with an other (avi, mp4, flv, ...)
Thank you!
Though, isn't the adm.videoCodec should be "xvid4" for *.avi files and "x264" for *.mp4 / *.mkv files? if so - how to make it work on the same file?
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 09:17:15 PM
That is not input, this is output codec! Avidemux detects input codecs.
All video to mkv with x264!
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 09:20:12 PM
Quote from: Jan Gruuthuse on May 06, 2016, 09:17:15 PM
That is not input, this is output codec! Avidemux detects input codecs.
All video to mkv with x264!
So, basically I do not need to change any settings from AVI to MKV/MP4?
Is it okay the way it is right now as "x264" for both AVI, MKV and MP4?

EDIT: it seems like it takes longer than before now to encode MP4 video file.
The differences I've seen:








OriginalNew (Yours)
general.threads=99general.threads=0
"general.preset=""general.preset=ultrafast"
"general.tuning=""general.tuning=film"
---"general.profile=baseline"
---"general.blueray_compatibility=False"
---"general.fake_interlaced=False"

Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 09:34:25 PM
script searches for video with .avi -> converts to x264 in mkv
script searches for video with .mp4 -> converts to x264 in mkv
script searches for video with .flv -> converts to x264 in mkv

xvid (x263)
adm.videoCodec("xvid4", "params=CQ=2", "profile=244", "rdMode=3", "motionEstimation=3", "cqmMode=0", "arMode=1", "maxBFrame=2", "maxKeyFrameInterval=200", "nbThreads=99", "qMin=2", "qMax=25", "rdOnBFrame=True", "hqAcPred=True"
, "optimizeChrome=True", "trellis=True", "useXvidFCC=False")


you can't mix settings form xvid with x264
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 09:37:48 PM
Quote from: Jan Gruuthuse on May 06, 2016, 09:34:25 PM
script searches for video with .avi -> converts to x264 in mkv
script searches for video with .mp4 -> converts to x264 in mkv
script searches for video with .flv -> converts to x264 in mkv

xvid (x263)
adm.videoCodec("xvid4", "params=CQ=2", "profile=244", "rdMode=3", "motionEstimation=3", "cqmMode=0", "arMode=1", "maxBFrame=2", "maxKeyFrameInterval=200", "nbThreads=99", "qMin=2", "qMax=25", "rdOnBFrame=True", "hqAcPred=True"
, "optimizeChrome=True", "trellis=True", "useXvidFCC=False")


you can't mix settings form xvid with x264
But that's not what I want. I want that:
Is there any way to achieve that on THE SAME (ONE) SCRIPT?
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 06, 2016, 09:45:00 PM
With the same encoding as the source video? Don't think so. It's not recommended to put x264 in to avi for example.
Create sub folder for avi, mp4, mkv
Have one script for each type of extension.
And choose your preferred encoding x264, ...
Most likely the less time consuming for getting the same results. For what you want you probably would need some AI
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 06, 2016, 10:20:33 PM
Quote from: Jan Gruuthuse on May 06, 2016, 09:45:00 PM
With the same encoding as the source video? Don't think so. It's not recommended to put x264 in to avi for example.
Create sub folder for avi, mp4, mkv
Have one script for each type of extension.
And choose your preferred encoding x264, ...
Most likely the less time consuming for getting the same results. For what you want you probably would need some AI
I know it doesn't, that's why I'm asking if there any if/else property that you can use so for MP4 it will set x264 and for AVI it will set XViD settings?
That way, it will know to put the correct settings to each file, yet encode ALL OF THE FILES IN THE FOLDER AT ONCE.

The only reason for that is when I have a lot of video files (100+) to encode, which some of them can be AVI while others are MP4 - and it happens quite often.
Currently, before going to sleep, I activate the AVI script, yet in the morning, I have to activate the MP4 script and lose encoding time between when it finished to encode all of the AVI video files to the time I activate the MP4 script.
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 07, 2016, 05:11:21 AM
perhaps this way:
adm = Avidemux()
gui = Gui()

def convert(filein):
onlyName = basename(filein)
fileout=filein
subtitle = onlyName[:-3]
dir = dirname(filein) + "/"
subtitle = dir+subtitle+"ass"
if(0 == adm.loadVideo(filein)):
gui.displayError("ops", "cannot load "+filein)
raise
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile="+subtitle, "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile=C:/Program Files/Avidemux 2.6 - 64 bits/credits.ass", "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.save("C:/Users/DoctorNull/Desktop/Encoded"+onlyName)


folder = gui.dirSelect("Select the folder with the videos")
list=get_folder_content(folder,"avi")
adm.setContainer("AVI", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec(adm.videoCodec("xvid4", "params=CQ=2", "profile=244", "rdMode=3", "motionEstimation=3", "cqmMode=0", "arMode=1", "maxBFrame=2", "maxKeyFrameInterval=200", "nbThreads=99", "qMin=2", "qMax=25", "rdOnBFrame=True", "hqAcPred=True"
, "optimizeChrome=True", "trellis=True", "useXvidFCC=False"))
if(list is None):
raise
for i in list:
convert(i)
print("Done AVI")

list=get_folder_content(folder,"mp4")
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=24", "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", "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=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")if(list is None):
raise
for i in list:
convert(i)
print("Done MP4")

list=get_folder_content(folder,"mkv")
adm.setContainer("MKV", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=24", "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", "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=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")if(list is None):
raise
for i in list:
convert(i)
print("Done MP4")


The only thing I have no clue on is: "muxerType=0". If this stays same for all type of containers?
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 07, 2016, 08:20:34 AM
Quote from: Jan Gruuthuse on May 07, 2016, 05:11:21 AM
perhaps this way:
adm = Avidemux()
gui = Gui()

def convert(filein):
onlyName = basename(filein)
fileout=filein
subtitle = onlyName[:-3]
dir = dirname(filein) + "/"
subtitle = dir+subtitle+"ass"
if(0 == adm.loadVideo(filein)):
gui.displayError("ops", "cannot load "+filein)
raise
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile="+subtitle, "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile=C:/Program Files/Avidemux 2.6 - 64 bits/credits.ass", "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.save("C:/Users/DoctorNull/Desktop/Encoded"+onlyName)


folder = gui.dirSelect("Select the folder with the videos")
list=get_folder_content(folder,"avi")
adm.setContainer("AVI", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec(adm.videoCodec("xvid4", "params=CQ=2", "profile=244", "rdMode=3", "motionEstimation=3", "cqmMode=0", "arMode=1", "maxBFrame=2", "maxKeyFrameInterval=200", "nbThreads=99", "qMin=2", "qMax=25", "rdOnBFrame=True", "hqAcPred=True"
, "optimizeChrome=True", "trellis=True", "useXvidFCC=False"))
if(list is None):
raise
for i in list:
convert(i)
print("Done AVI")

list=get_folder_content(folder,"mp4")
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=24", "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", "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=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")if(list is None):
raise
for i in list:
convert(i)
print("Done MP4")

list=get_folder_content(folder,"mkv")
adm.setContainer("MKV", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=24", "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", "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=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")if(list is None):
raise
for i in list:
convert(i)
print("Done MP4")


The only thing I have no clue on is: "muxerType=0". If this stays same for all type of containers?

Thank you once again for replying.
I'm not sure about "muxerType=0" either, yet it seems to work so far with all of 3 types (avi, mkv and mp4).
This is my current script, after modifying it a bit:
adm = Avidemux()
gui = Gui()

def convert(filein):
onlyName = basename(filein)
fileout=filein
subtitle = onlyName[:-3]
dir = dirname(filein) + "/"
subtitle = dir+subtitle+"ass"
if(0 == adm.loadVideo(filein)):
gui.displayError("oops", "cannot load "+filein)
raise
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile="+subtitle, "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.addVideoFilter("ssa", "font_scale=1.000000", "line_spacing=0.100000", "subtitleFile=C:/Program Files/Avidemux 2.6 - 64 bits/erel-credits.ass", "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
adm.save("C:/Users/Erel/Desktop/Done/"+onlyName)


folder = gui.dirSelect("Select the folder with the videos")
list=get_folder_content(folder,"avi")
adm.videoCodec("xvid4", "useAdvancedConfiguration=True", "general.params=AQ=22", "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", "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=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.setContainer("AVI", "muxerType=0", "useAlternateMp3Tag=True")
if(list is None):
raise
for i in list:
convert(i)
print("Done with AVI files")



list=get_folder_content(folder,"mp4")
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"
, "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=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.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")
if(list is None):
raise
for i in list:
convert(i)
print("Done with MP4 files")

list=get_folder_content(folder,"mkv")
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"
, "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=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.setContainer("MKV", "muxerType=0", "useAlternateMp3Tag=True")
if(list is None):
raise
for i in list:
convert(i)
print("Done with MKV files")


Yet, it seems like I get an error message after selecting a folder to encode from:
(https://avidemux.org/smif/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FHRME0h2.png&hash=8461b171f7d670cac76adc893e4c40eb58cf3df9)
it refers to line 37, which is the 2nd "raise" argument (I didn't have AVI files while activating it, only MKV). Why is that?
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 07, 2016, 09:28:30 AM
could be you need to insert:
folder = gui.dirSelect("Select the folder with the videos")
before line:
list=get_folder_content(folder,"mp4")
before line:
list=get_folder_content(folder,"mkv")

if still an issue:

You did replace:
adm.setContainer("AVI", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec(adm.videoCodec("xvid4", "params=CQ=2", "profile=244", "rdMode=3", "motionEstimation=3", "cqmMode=0", "arMode=1", "maxBFrame=2", "maxKeyFrameInterval=200", "nbThreads=99", "qMin=2", "qMax=25", "rdOnBFrame=True", "hqAcPred=True"
, "optimizeChrome=True", "trellis=True", "useXvidFCC=False"))

In my opinion you can't pass Mpeg4 AVC (x264) parameters into Mpeg4 ASP (xvid4), what it seem like you are doing.
Try your modified script again, but put above codec block back and see how it goes.

----
still no go, try tracking what is going on:
Start batch from a windows prompt (c:\ ) and set that window properties to stay open and not closed.
Perhaps output there will tell you more.
----
If you calling another script from the running script that could be another issue (info not past from one to another) (py2bc.py)
----
Unfortunately I don't have windows environment to test and see what actually could be going on.
Title: Re: Avidemux 2.6.10 python scripting
Post by: DoctorNull on May 07, 2016, 11:47:04 AM
Quote from: Jan Gruuthuse on May 07, 2016, 09:28:30 AM
could be you need to insert:
folder = gui.dirSelect("Select the folder with the videos")
before line:
list=get_folder_content(folder,"mp4")
before line:
list=get_folder_content(folder,"mkv")

if still an issue:

You did replace:
adm.setContainer("AVI", "muxerType=0", "useAlternateMp3Tag=True")
adm.videoCodec(adm.videoCodec("xvid4", "params=CQ=2", "profile=244", "rdMode=3", "motionEstimation=3", "cqmMode=0", "arMode=1", "maxBFrame=2", "maxKeyFrameInterval=200", "nbThreads=99", "qMin=2", "qMax=25", "rdOnBFrame=True", "hqAcPred=True"
, "optimizeChrome=True", "trellis=True", "useXvidFCC=False"))

In my opinion you can't pass Mpeg4 AVC (x264) parameters into Mpeg4 ASP (xvid4), what it seem like you are doing.
Try your modified script again, but put above codec block back and see how it goes.

----
still no go, try tracking what is going on:
Start batch from a windows prompt (c:\ ) and set that window properties to stay open and not closed.
Perhaps output there will tell you more.
----
If you calling another script from the running script that could be another issue (info not past from one to another) (py2bc.py)
----
Unfortunately I don't have windows environment to test and see what actually could be going on.
I've changed the AVI settings to yours, yet the error stays on the RAISE statement. Couldn't find what's wrong with it. Could you please give it a try?
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 07, 2016, 01:39:46 PM
I don't see it.
There is nothing to try.
I can't test this: I don't have windows

You have working scripts for each of the wanted extensions, work with those until someone comes along and improves this.

Title: Re: Avidemux 2.6.10 python scripting
Post by: EEMcGee on May 10, 2016, 01:37:12 AM
I don't know if this would work for you but you could try making a .bat file with

set avidemux="C:\Program Files\Avidemux 2.6 - 64bits\avidemux.exe"
for %%f in (*.mp4 *.avi) do %avidemux% --load "%%F" --run "your script.py" --save "\output\%%~nF.mp4" --quit

Make a py script for doing whatever you want to the file and put the name of it where I have the py file in the batch.
I believe "\output\%%~nF.mp4" will work to save the files in a sub-directory called output but I'm not sure that is exactly correct.
  The reason to save to a sub-directory is so you don't have to worry about it having a problem with over-writing the mp4 files.

Title: Re: Avidemux 2.6.10 python scripting
Post by: EEMcGee on May 12, 2016, 02:10:39 AM
I believe this would work if you want it processed differently depending on if it is an AVI or MP4

set avidemux="C:\Program Files\Avidemux 2.6 - 64bits\avidemux.exe"
for %%f in (*.mp4 *.avi) do if "%%~nf.avi"%avidemux% --load "%%F" --run "your avi script.py" --save "\output\%%~nF.mp4" --quit else %avidemux% --load "%%F" --run "your mp4 script.py" --save "\output\%%~nF.mp4" --quit

the for command and everything after has to be on one line.

here is a link to a batch command line reference

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/batch.mspx?mfr=true
Title: Re: Avidemux 2.6.10 python scripting
Post by: Jan Gruuthuse on May 12, 2016, 06:35:28 AM
that should work, by the looks of it.