Issues with Batch Processing - x264 commands not recognized.

Started by pokepud3, April 07, 2017, 08:04:26 PM

Previous topic - Next topic

pokepud3

So I've set this up, and I'm having issues with avidemux reading the x264 options. It'll accept the very slow preset, but then it'll limit b frames to 4 and max refs to 3, it is also missing other options. Almost like it's being overwritten by something else. I have set them to 8 refs and 6 bframes but it doesn't allow it. What can I do to get this to work? I'm not good with scripting, so any help would be helpful. The filters and audio end work great. Using latest version of avidemux. Thanks

set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
for %%f in (*.mp4) do %avidemux% --load "%%f" --run "C:\Users\MiniBot\Desktop\teest\AAC(Faac)MP41.py" --save "%%~nf.mkv" --quit


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

adm = Avidemux()
adm.videoCodec("x264", "general.params=AQ=18", "general.preset=veryslow", "general.tuning=film", "general.profile=high", "MaxRefFrames=8", "MaxBFrame=6", "ratecontrol.aq_mode=2")
adm.addVideoFilter("addLogo", "x=19", "y=390", "alpha=255", "logoImageFile=C:/Users/Desktop/actorimagesmall.png")
adm.addVideoFilter("ssa", "font_scale=1.400000", "line_spacing=0.100000", "subtitleFile=D:/add.ass", "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
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")

pokepud3

And got it working somehow:

Quoteadm = Avidemux()
adm.videoCodec("x264", "useAdvancedConfiguration=True", "general.params=AQ=19", "general.threads=0", "general.preset=veryslow", "general.tuning=film", "general.profile=high", "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=8", "MinIdr=25", "MaxIdr=250"
, "i_scenecut_threshold=40", "intra_refresh=False", "MaxBFrame=6", "i_bframe_adaptive=2", "i_bframe_bias=0", "i_bframe_pyramid=2", "b_deblocking_filter=True", "i_deblocking_filter_alphac0=-1", "i_deblocking_filter_beta=-1"
, "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=False", "analyze.b_p16x16=True"
, "analyze.b_b16x16=True", "analyze.weighted_pred=2", "analyze.weighted_bipred=True", "analyze.direct_mv_pred=3", "analyze.chroma_offset=0", "analyze.me_method=2", "analyze.me_range=24", "analyze.mv_range=-1"
, "analyze.mv_range_thread=-1", "analyze.subpel_refine=10", "analyze.chroma_me=True", "analyze.mixed_references=True", "analyze.trellis=2", "analyze.psy_rd=1.000000", "analyze.psy_trellis=0.150000", "analyze.fast_pskip=True"
, "analyze.dct_decimate=True", "analyze.noise_reduction=150", "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=2", "ratecontrol.aq_strength=1.000000", "ratecontrol.mb_tree=True", "ratecontrol.lookahead=50")
adm.addVideoFilter("addLogo", "x=34", "y=580", "alpha=255", "logoImageFile=C:/Users/MiniBot/Desktop/actorimage.png")
adm.addVideoFilter("ssa", "font_scale=1.400000", "line_spacing=0.100000", "subtitleFile=D:/add.ass", "fontDirectory=c:", "extractEmbeddedFonts=1", "topMargin=0", "bottomMargin=0")
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")

By the way, how would i modify the bat file, so that based on frame height it would use a different batch file?

So basically:
If 480 frame height: Use 480.py, or if 720 then 720.py, or if 1080, then 1080.py. This way i could modify the logo filter location and encode settings per each, and not seperate them into individual folders which for 2000 different folders will be a pain. Thanks.

Jan Gruuthuse

#2
If you have a tool to get the info out of video properties and can export this, set variable or so before you call the avidemux line, the it could be done.
If value or on value you start the line 480.py, 720.py or 1080.py

Easier you create a folder for each kind like
- 480
- 720
- 1080
and put your video files in the respectively folder and process video per folder with its 480.py, 720.py or 1080.py

mediainfo or ffprobe should/could possible provide you with the required info.

mediainfo --Info-Parameters

http://trac.ffmpeg.org/wiki/FFprobeTips