Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program API video compression interface


May 18, 2021 WeChat Mini Program Development Document


Table of contents


wx.compressVideo(Object object)

The base library 2.11.0 starts to support, and the lower version needs to be compatible.

Compress the video interface. D evelopers can specify compression quality for compression. B itrate, fps, and resolution can be specified when more granular control is required, and these three parameters are ignored when quality is passed in. Information about the original video is available through getVideoInfo.

Parameters

Object object

Property Type The default Required Description
Src string Is The video file path can be between a temporary file path and a permanent file path
quality string Is Compression quality
bitrate number Is Code rate, kbps per unit
Fps number Is Frame rate
resolution number Is Value range relative to the resolution ratio of the original video (0, 1)
success function Whether The interface calls a successful callback function
fail function Whether The interface calls the failed callback function
complete function Whether Callback function at end of interface call (call succeeds, fails are executed)

The legal value of object.quality

Value Description The lowest version
low Low
medium
high High

object.success callback function

Parameters
Object res
Property Type Description
tempFilePath string The compressed temporary file address
size string The compressed size in kB