Invoking resize filter from the command line for batch usage

Started by apache, June 26, 2013, 09:40:51 PM

Previous topic - Next topic

apache

I've been attempting to figure out how to do a batch resize for all of the files in a folder to a certain size in the Windows environment and I haven't been able to find anything that would let me do the entire directory in a batch.  Is there an easy way to define the video resize filter as a filter set to be called from the command line?

Jan Gruuthuse

probably:
load video, set codecs: audio and video, apply the resize video. Now from Main Menu: File: Tinypy Project: Save as Project.
You should end up with a file givenname.py. Edit this file and delete reference to loaded video and markers.
Save this project file. This project file can now be used from command line.
More details can be found here: 2.6 audio track switching in job.py
If this would not work with avidemux_cli.exe try with avidemux.exe. (GUI) Check the program names for exact name, don't have windows.

apache

so would a py file with these contents work for that?

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

adm = Avidemux()

adm.clearSegments()

adm.videoCodec("x264", "general.params=AQ=20", "general.threads=99", "general.fast_first_pass=True", "level=31", "vui.sar_height=1", "vui.sar_width=1", "MaxRefFrames=2", "MinIdr=100", "MaxIdr=500", "i_scenecut_threshold=40", "MaxBFrame=2", "i_bframe_adaptive=0", "i_bframe_bias=0", "i_bframe_pyramid=0", "b_deblocking_filter=False", "i_deblocking_filter_alphac0=0", "i_deblocking_filter_beta=0", "cabac=True", "interlaced=False", "analyze.b_8x8=True", "analyze.b_i4x4=False"
, "analyze.b_i8x8=False", "analyze.b_p8x8=False", "analyze.b_p16x16=False", "analyze.b_b16x16=False", "analyze.weighted_pred=0", "analyze.weighted_bipred=False", "analyze.direct_mv_pred=0", "analyze.chroma_offset=0", "analyze.me_method=0", "analyze.mv_range=16", "analyze.subpel_refine=7", "analyze.chroma_me=False", "analyze.mixed_references=False", "analyze.trellis=1", "analyze.psy_rd=0.000000", "analyze.psy_trellis=0.000000", "analyze.fast_pskip=True", "analyze.dct_decimate=False", "analyze.noise_reduction=0", "analyze.psy=True"
, "analyze.intra_luma=21", "analyze.inter_luma=21", "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "ratecontrol.qp_min=0", "ratecontrol.qp_max=0", "ratecontrol.qp_step=0", "ratecontrol.bitrate=0", "ratecontrol.vbv_max_bitrate=0", "ratecontrol.vbv_buffer_size=0", "ratecontrol.vbv_buffer_init=0", "ratecontrol.ip_factor=0.000000", "ratecontrol.pb_factor=0.000000", "ratecontrol.aq_mode=0", "ratecontrol.aq_strength=0.000000", "ratecontrol.mb_tree=False", "ratecontrol.lookahead=0")
adm.addVideoFilter("swscale", "width=960", "height=540", "algo=2", "sourceAR=1", "targetAR=1")
adm.audioClearTracks()
adm.audioAddTrack(0)
adm.audioCodec(0, "copy");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")


With a batch file like this:


set avidemux="D:\Program Files\Avidemux 2.6\avidemux_cli.exe"
set videocodec=FFmpeg4
set audiocodec=COPY
set container=MP4
set output=MP4
for %%f in (*.mp4) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --load "%%f" --run test3.py --force-alt-h264  --save "%%f.s.mp4" --quit 


Jan Gruuthuse

Quote from: apache on June 28, 2013, 10:18:29 PM
so would a py file with these contents work for that?

With a batch file like this:


set avidemux="D:\Program Files\Avidemux 2.6\avidemux_cli.exe"
set videocodec=FFmpeg4
set audiocodec=COPY
set container=MP4
set output=MP4
for %%f in (*.mp4) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --load "%%f" --run test3.py --force-alt-h264  --save "%%f.s.mp4" --quit 


You're setting codecs in the project file, would not need to set these in batch file:

set avidemux="D:\Program Files\Avidemux 2.6\avidemux_cli.exe"
for %%f in (*.mp4) do %avidemux% --load "%%f" --run "c:\test3.py --save "%%f.s.mp4" --quit 


test3.py is best referenced to its path where it is.