java.lang.Object | |
↳ | com.ksyun.media.shortvideo.kit.KSYTranscodeKit |
Trancode: Demux -> Decode -> Encode -> Mux.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
float | DEFAULT_IFRAME_INTERVAL | ||||||||||
int | ERROR_DECODER_FAILED | ||||||||||
int | ERROR_DEMUXER_FAILED | ||||||||||
int | ERROR_PUBLISHER_FAILED | ||||||||||
int | INFO_DECODER_STARTED | ||||||||||
int | INFO_DECODER_STOPPED | ||||||||||
int | INFO_DEMUXER_STARTED | ||||||||||
int | INFO_DEMUXER_STOPPED | ||||||||||
int | INFO_PUBLISHER_ABORTED | ||||||||||
int | INFO_PUBLISHER_COMPLETED | ||||||||||
int | INFO_PUBLISHER_STARTED |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected int | mAudioChannels | ||||||||||
public FilePublisher.PubListener | mFilePublisherListener |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
KSYTranscodeKit() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | getAudioBitrate() | ||||||||||
float | getProgress() | ||||||||||
int | getVideoBitrate() | ||||||||||
int | getVideoCodecId() | ||||||||||
int | getVideoEncodeMethod() | ||||||||||
int | getVideoEncodeProfile() | ||||||||||
float | getVideoFps() | ||||||||||
void | release() | ||||||||||
void |
setAudioBitrate(int bitrate)
Set audio bitrate in bps.
| ||||||||||
void |
setAudioChannels(int channels)
Set audio channel number.
| ||||||||||
void |
setAudioEncodeProfile(int profile)
Set audio encode profile.
| ||||||||||
void |
setAudioKBitrate(int kBitrate)
Set audio bitrate in kbps.
| ||||||||||
void |
setAudioSampleRate(int sampleRate)
Set audio sample rate while streaming.
| ||||||||||
void |
setEnableMp4FastStart(boolean enable)
Run a second pass moving the index (moov atom) to the beginning of the mp4 file.
| ||||||||||
void |
setEncodeMethod(int encodeMethod)
Set encode method for both video and audio.
| ||||||||||
void | setIFrameInterval(float interval) | ||||||||||
void |
setOnErrorListener(KSYTranscodeKit.OnErrorListener onErrorListener)
Set onErrorListener.
| ||||||||||
void |
setOnInfoListener(KSYTranscodeKit.OnInfoListener onInfoListener)
Set OnInfoListener.
| ||||||||||
void | setScaleMode(int scaleMode) | ||||||||||
void |
setTargetResolution(int width, int height)
Set transcode target resolution.
| ||||||||||
void |
setVideoBitrate(int bitrate)
Set video bitrate in bps, and disable video bitrate auto adjustment.
| ||||||||||
void |
setVideoCodecId(int codecId)
Set codec id to video encoder.
| ||||||||||
void |
setVideoCrf(int crf)
set Constant Rate Factor
| ||||||||||
void |
setVideoDecodeMethod(int decodeMethod)
Set decode method for video.
| ||||||||||
void |
setVideoEncodeMethod(int encodeMethod)
Set encode method for video.
| ||||||||||
void |
setVideoEncodeProfile(int profile)
Set encode profile to video encoder.
| ||||||||||
void |
setVideoFps(float fps)
Sets video fps.
| ||||||||||
void |
setVideoKBitrate(int kBitrate)
Set video bitrate in kbps, and disable video bitrate auto adjustment.
| ||||||||||
void | start(String srcUrl, String desUrl) | ||||||||||
void | stop() |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | setAudioParams() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Set audio bitrate in bps.
bitrate | audio bitrate in bps. |
---|
IllegalArgumentException |
---|
Set audio channel number.
default value : 1
channels | audio channel number, 1 for mono, 2 for stereo, 0 for input config. |
---|
IllegalArgumentException |
---|
Set audio encode profile.
profile | profile to set. |
---|
Set audio bitrate in kbps.
kBitrate | audio bitrate in kbps. |
---|
IllegalArgumentException |
---|
Set audio sample rate while streaming.
default value 44100
sampleRate | sample rate in Hz. |
---|
IllegalArgumentException |
---|
Run a second pass moving the index (moov atom) to the beginning of the mp4 file. This operation can take a while, and will not work in various situations such as fragmented output, thus it is not enabled by default.
enable | true to enable, false to disable |
---|
Set encode method for both video and audio.
Must not be set while encoding.
default value:ENCODE_METHOD_SOFTWARE
encodeMethod | Encode method. |
---|
IllegalStateException | |
IllegalArgumentException | |
IllegalStateException |
interval | I frame interval |
---|
Set onErrorListener.
onErrorListener | error callback |
---|
Set OnInfoListener.
onInfoListener | info callback |
---|
Set transcode target resolution.
The set resolution would take effect immediately if compose started.
The set width and height must not be 0 at same time. If one of the params is 0, the other would calculated by the actual preview view size to keep the ratio of the preview view.
width | streaming width. |
---|---|
height | streaming height. |
IllegalArgumentException |
---|
Set video bitrate in bps, and disable video bitrate auto adjustment.
bitrate | video bitrate in bps |
---|
IllegalArgumentException |
---|
Set codec id to video encoder.
codecId | video codec id to set. |
---|
IllegalArgumentException |
---|
set Constant Rate Factor
Set decode method for video.
Must not be set while decoding.
decodeMethod | Decode method. |
---|
IllegalStateException | |
IllegalArgumentException | |
IllegalStateException |
Set encode method for video.
Must not be set while encoding.
encodeMethod | Encode method. |
---|
IllegalStateException | |
IllegalArgumentException | |
IllegalStateException |
Set encode profile to video encoder.
Only valid in ENCODE_METHOD_SOFTWARE and ENCODE_METHOD_SOFTWARE_COMPAT mode.
profile | encode profile mode to be set, default value VideoEncodeFormat#ENCODE_PROFILE_LOW_POWER |
---|
Sets video fps.
fps | the fps |
---|
Set video bitrate in kbps, and disable video bitrate auto adjustment.
kBitrate | video bitrate in kbps |
---|
IllegalArgumentException |
---|