Video source Samsung Galaxy A32.
Avidemux 2.8.1
Windows 10
Consider this Avidemux loading script
#PY <- Needed to identify #
#--automatically built--
adm = Avidemux()
if not adm.loadVideo("K:/videofolder/20221114_100954.mp4"):
raise("Cannot load K:/videofolder/20221114_100954.mp4")
adm.clearSegments()
adm.addSegment(0, 0, 87733000)
adm.markerA = 1032933
adm.markerB = 56011633
adm.setPostProc(3, 3, 0)
adm.setHDRConfig(1, 1, 1, 1, 0)
adm.videoCodec("x265", "useAdvancedConfiguration=False", "general.params=AQ=27", "general.poolThreads=99", "general.frameThreads=0", "general.output_bit_depth=0", "general.preset=veryslow", "general.tuning=none", "general.profile=main"
, "level=-1", "vui.sar_idc=0", "vui.sar_height=1", "vui.sar_width=1", "vui.color_primaries=2", "vui.transfer_characteristics=2", "vui.matrix_coeffs=2", "MaxRefFrames=3", "MinIdr=25", "MaxIdr=250", "i_scenecut_threshold=40"
, "MaxBFrame=3", "i_bframe_adaptive=1", "i_bframe_bias=0", "i_bframe_pyramid=2147483647", "b_deblocking_filter=True", "b_open_gop=False", "interlaced_mode=0", "constrained_intra=False", "b_intra=True"
, "lookahead=40", "weighted_pred=2", "weighted_bipred=True", "rect_inter=False", "amp_inter=False", "limit_modes=False", "cb_chroma_offset=0", "cr_chroma_offset=0", "me_method=3", "me_range=16", "subpel_refine=5"
, "limit_refs=3", "rd_level=3", "psy_rd=1.000000", "rdoq_level=0", "psy_rdoq=0.000000", "fast_pskip=True", "dct_decimate=True", "noise_reduction_intra=0", "noise_reduction_inter=0", "strong_intra_smoothing=True"
, "ratecontrol.rc_method=0", "ratecontrol.qp_constant=0", "ratecontrol.qp_step=4", "ratecontrol.bitrate=0", "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.cu_tree=True", "ratecontrol.strict_cbr=False")
adm.addVideoFilter("swscale", "width=1280", "height=720", "algo=1", "sourceAR=0", "targetAR=0", "lockAR=True", "roundup=0")
adm.addVideoFilter("imageStab", "smoothing=0.500000", "gravity=0.500000", "autoGravity=True", "sceneThreshold=0.500000", "zoom=1.000000", "algo=1", "motionEstimation=0")
adm.addVideoFilter("addBorder", "left=32", "right=32", "top=16", "bottom=16")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"eng")
if adm.audioTotalTracksCount() <= 0:
raise("Cannot add audio track 0, total tracks: " + str(adm.audioTotalTracksCount()))
adm.audioAddTrack(0)
adm.audioCodec(0, "FDK_AAC", "bitrate=56", "afterburner=True", "profile=2", "sbr=False")
adm.audioSetDrc2(0, 0, 1, 0.001, 0.2, 1, 2, -12)
adm.audioSetEq(0, 0, 0, 0, 0, 880, 5000)
adm.audioSetChannelGains(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelDelays(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
adm.audioSetChannelRemap(0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8)
adm.audioSetShift(0, 0, 0)
adm.setContainer("MKV", "forceAspectRatio=False", "displayWidth=1280", "displayAspectRatio=2", "addColourInfo=False", "colMatrixCoeff=2", "colRange=0", "colTransfer=2", "colPrimaries=2")
That give a garbled result:
(https://i.ibb.co/WF7BhfJ/Filter-preview.jpg) (https://ibb.co/TRJPft3)
Time consuming workaround:
- Remove the addBorder filter
- Save losseless video file
- Re-do the video encoding, but this time only addBorder filter activate and with the proper encoding parameters for decent file size
Confirming the issue with left and right borders (looks like messed up image stride). Inserting swsResize in no-op mode (output size = input size) after imageStab works around the issue.
szlldm has fixed the problem caused by an assumption that the stride (number of bytes in computer memory between the start of two consecutive lines of an image) of the image submitted to imageStab filter matches the default one:
[imageStab] fix issue caused by different output stride (https://github.com/mean00/avidemux2/commit/a2ce8007e6637397d5768cca69b2a26e853326e0)
as well as the similar problem with the quadTrans filter. Please try a future nightly build (https://avidemux.org/nightly/).
Thank you for your report.