News:

--

Main Menu

Avidemux 2.6.10 python scripting

Started by DoctorNull, May 06, 2016, 04:44:03 PM

Previous topic - Next topic

Jan Gruuthuse

#15
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

DoctorNull

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

Jan Gruuthuse

#17
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?

DoctorNull

#18
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:

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?

Jan Gruuthuse

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.

DoctorNull

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?

Jan Gruuthuse

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.


EEMcGee

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.


EEMcGee

#23
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

Jan Gruuthuse

that should work, by the looks of it.