diff --git a/content/.DS_Store b/content/.DS_Store index 77f5fd6..a539752 100644 Binary files a/content/.DS_Store and b/content/.DS_Store differ diff --git a/content/en/.DS_Store b/content/en/.DS_Store index 1bd3684..e0d211b 100644 Binary files a/content/en/.DS_Store and b/content/en/.DS_Store differ diff --git a/content/en/docs/.DS_Store b/content/en/docs/.DS_Store new file mode 100644 index 0000000..6b1458c Binary files /dev/null and b/content/en/docs/.DS_Store differ diff --git a/content/en/docs/bmf/.DS_Store b/content/en/docs/bmf/.DS_Store new file mode 100644 index 0000000..684391d Binary files /dev/null and b/content/en/docs/bmf/.DS_Store differ diff --git a/content/en/docs/bmf/api/.DS_Store b/content/en/docs/bmf/api/.DS_Store new file mode 100644 index 0000000..3a9a4d1 Binary files /dev/null and b/content/en/docs/bmf/api/.DS_Store differ diff --git a/content/en/docs/bmf/api/api_in_cpp/api_in_go/_index.md b/content/en/docs/bmf/api/api_in_cpp/api_in_go/_index.md new file mode 100644 index 0000000..ba26b54 --- /dev/null +++ b/content/en/docs/bmf/api/api_in_cpp/api_in_go/_index.md @@ -0,0 +1,143 @@ +--- +title: 'API In Go' +linkTitle: 'API In Go' +weight: 3 +--- +## Normal mode (refer to normalMode) +### func NewBMFGraph(mode BMFGraphMode, option interface{}) *BMFGraph + +Para: +- mode: Enumeration type, the operation mode of BMF, with the following options: + - Normal mode (most commonly used) + - Server pre-built mode + - Generator generator mode + - SubGraph subgraph mode + - Update Dynamic addition and deletion of streaming scenarios +- option: interface{} type, global Parameter of BMF, usually can be filled with null value nil + +Return: +- *BMFGraph: structure pointer type, global Graph pointer + +### func (g *BMFGraph) Decode(decodePara interface{}, controlStream *BMFStream) *BMFNode + +Para: +- decodePara: interface{} type, decoding module Parameters, can be represented by map[string]interface{} data structure +- controlStream: structure pointer type, usually empty nil + +Return: +- *BMFNode: structure pointer type, pointer to decoding node + +### func (n *BMFNode) Stream(id interface{}) *BMFStream +Para: + +- id: integer, representing the stream number of the node (the stream number usually starts from 0) + +Return: +- *BMFStream: structure pointer type, pointer to stream structure + +### func (g *BMFGraph) Encode(videoStream *BMFStream, audioStream *BMFStream, encoderPara interface{}) *BMFNode + +Para: +- videoStream: structure pointer type, the structure pointer of the video stream +- audioStream: structure pointer type, structure pointer of audio stream +- encoderPara: interface{} type, encoding module Parameters, can be represented by map[string]interface{} data structure + +Return: +- *BMFNode: structure pointer type, coded node pointer + +### func (g *BMFGraph) Module(inputs []*BMFStream, moduleName string, moduleType BMFModuleType, modulePath string, moduleEntry string, option interface{}, preModule *BMFModuleInstance) *BMFNode + +Para: +- inputs: The slice structure of the BMFStream structure pointer, representing all input streams of the module +- moduleName: string type, module name +- moduleType: enumerated type, with the following options: + -Python + -Cpp + - Go +- modulePath: string type, the path where the module file is located +- moduleEntry: string type, module entry +- option: interface{} type, module Parameter +- preModule: structure pointer of BMFModuleInstance, preload module, nil if no + +Return: +- *BMFNode: structure pointer type, the pointer of the corresponding node of the module + +### func (g *BMFGraph) Run(needMerge bool) *CBMFGraph + +Para: +- needMerge: Boolean type, whether to merge the ffmpeg filter nodes in the graph, usually true + +Return: +- *CBMFGraph: structure pointer type, which is a pointer to the encapsulation structure of the C language graph object + +### func (bgp *CBMFGraph) Close() error + +Return: +- error: error type, when the C graph structure is empty, an error will be reported + +## preload mode (refer to premoduleMode) +### func NewCBMFModule(moduleName string, option interface{}, moduleType BMFModuleType, modulePath, moduleEntry string) (*CBMFModule, error) + +Para: +- moduleName: string type, module name +- option: interface{} type, module Parameter +- moduleType: enumerated type, with the following options: + -Python + -Cpp + - Go +- modulePath: string type, the path where the module file is located +- moduleEntry: string type, module entry + +Return: +- *BMFModuleInstance: structure pointer type, which is a pointer to the encapsulation structure of the C language module object +- error: error type, when the C graph structure is empty, an error will be reported + +### func (s *BMFStream) Module(inputs []*BMFStream, moduleName string, moduleType BMFModuleType, modulePath string, moduleEntry string, option interface{}, preModule *CBMFModule) *BMFNode + +Note: The difference between this interface and the Module interface in normal mode is that the caller is BMFStream instead of BMFGraph. +When the caller is BMFStream, the stream corresponding to the caller will be merged with other streams in inputs, and they will be used as the input stream of the module together. + +## Sync mode (see syncMode & syncModeSerial) +### func NewModulefunctor(name, tp, path, entry string, option interface{}, ninputs, nooutputs int32) (*Modulefunctor, error) + +Para: +- name: string type, Module name +- tp: string type, Module type (python, c++, go) +- Path: string type, corresponding to the path of the module implementation file +- entry: string type, module entry +- ninputs: int32 type, specifies the number of input streams +- nooutputs: int32 type, specifies the number of output streams + +Return: +- *Modulefunctor: the instantiated Modulefunctor +- error: error message, default is nil +### func (self *Modulefunctor) Execute(inputs []*Packet, cleanup bool) (bool, error) + +Para: +- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed +- cleanup : bool type, controls whether to clear all un-fetch results + +Return: +- bool: Whether the operation is successful, 1 is success, 0 is failed +- error: error message, default is nil +### func (self *Modulefunctor) Fetch(index int) ([]*Packet, error) + +Para: +- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed +- cleanup : bool type, controls whether to clear all un-fetch results + +Return: +- []*Packet: packet list processed by Sync mode module +- error: error message, default is nil +### func (self *Modulefunctor) Call(inputs []*Packet) ([]*Packet, error) + +Para: +- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed + +Return: +- []*Packet: packet list processed by Sync mode module +- error: error message, default is nil +### func deleteModulefunctor(o *Modulefunctor) + +Para: +- o: *Modulefunctor, pointing to the Modulefunctor instance that will be free \ No newline at end of file diff --git a/content/en/docs/bmf/api/api_in_cpp/audio_frame/_index.md b/content/en/docs/bmf/api/api_in_cpp/audio_frame/_index.md index dff631d..c5cfb2b 100644 --- a/content/en/docs/bmf/api/api_in_cpp/audio_frame/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/audio_frame/_index.md @@ -7,11 +7,11 @@ weight: 1 [//]: <> (REF_MD: classbmf__sdk_1_1AudioFrame.html) - [公共成员函数](#public-member-functions) | [静态公共成员函数](#static-public-member-functions) # bmf_sdk::AudioFrame Class Reference + [Public Member Functions](#public-member-functions) | [Static Public Member Functions](#static-public-member-functions) # bmf_sdk::AudioFrame Class Reference audio_frame.h - ## 公有成员函数 + ## Public Member Functions [AudioFrame](#audioframe-15) ()=default @@ -106,7 +106,7 @@ bool [operator<=](https://babitmf.github.io/docs/bmf/api/api_in_cpp/sequenceda - ## 静态共有成员函数 + ## Static Public Member Functions static [AudioFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/audio_frame/) [make](#make-13) (int samples, uint64_t [layout](#layout) , bool [planer](#planer) =true) @@ -117,7 +117,7 @@ static [AudioFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/audio_fra static [AudioFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/audio_frame/) [make](#make-33) (const TensorList &data, uint64_t [layout](#layout) , bool [planer](#planer) =true) - ## 其它继承成员 + ## Additional Inherited Members ![img](/img/docs/closed.png) @@ -129,7 +129,7 @@ virtual void [set_private_data](https://babitmf.github.io/docs/bmf/api/api_in_ virtual const OpaqueData & [private_data](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#private_data) (int key) const -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  AudioFrame() [1/5] @@ -186,7 +186,7 @@ bmf_sdk::AudioFrame::AudioFrame ( const TensorList & data, bool planer = true ) ``` -## 成员函数文档 +## Member Function Documentation ###  clone() @@ -200,8 +200,7 @@ bmf_sdk::AudioFrame::AudioFrame ( const TensorList & data, ``` AudioFrame & bmf_sdk::AudioFrame::copy_props( const AudioFrame &from ) ``` -复制来自 `from` 的所有额外 prop(由成员 func set_xxx 设置,(如需要可深度复制)。 -**Parameters** +copy all extra props(set by member func set_xxx) from `from` (deepcopy if needed), **Parameters** - **from** diff --git a/content/en/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md b/content/en/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md index 1b29d54..80e91bf 100644 --- a/content/en/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md @@ -7,13 +7,13 @@ weight: 2 [//]: <> (REF_MD: classbmf__sdk_1_1BMFAVPacket.html) - [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-member-functions) | [静态公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#static-public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-attributes) # bmf_sdk::BMFAVPacket Class Reference + [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-member-functions) | [Static Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#static-public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-attributes) # bmf_sdk::BMFAVPacket Class Reference bmf_av_packet.h! ! - ## 公有成员函数 + ## Public Member Functions [BMFAVPacket](#bmfavpacket-15) ()=default @@ -111,14 +111,14 @@ bool [operator<=](https://babitmf.github.io/docs/bmf/api/api_in_cpp/sequenceda - ## 静态公有成员函数 + ## Static Public Member Functions static [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) [make](#make) (int size, Options &&...opts) - ## 公共属性 + ## Public Attributes int64_t [offset_](#offset_) @@ -126,7 +126,7 @@ int64_t [offset_](#offset_) int [whence_](#whence_) - ## 其它继承成员 + ## Additional Inherited Members ![img](/img/docs/closed.png) @@ -138,7 +138,7 @@ virtual void [set_private_data](https://babitmf.github.io/docs/bmf/api/api_in_ virtual const OpaqueData & [private_data](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#private_data) (int key) const -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  BMFAVPacket() [1/5] @@ -182,9 +182,10 @@ bmf_sdk::BMFAVPacket::BMFAVPacket ( BMFAVPacket && ) ``` bmf_sdk::BMFAVPacket::BMFAVPacket ( const Tensor & data ) ``` -构建一个新的 [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) 对象。 +Construct a new [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) object. + **Parameters** - - **data**:连续张量数据,仅限 cpu + - **data** contiguous tensor data, cpu only @@ -196,14 +197,15 @@ bmf_sdk::BMFAVPacket::BMFAVPacket ( int size, const TensorOptions & options = kUInt8 ) ``` -构建一个新的 [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) 对象。 +Construct a new [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) object. + **Parameters** - **size** - - **options**:参考 [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) + - **options** ref [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) -## 成员函数文档 +## Member Function Documentation ###  copy_props() @@ -211,8 +213,7 @@ bmf_sdk::BMFAVPacket::BMFAVPacket ( int size, ``` BMFAVPacket & bmf_sdk::BMFAVPacket::copy_props( const BMFAVPacket &from ) ``` -从`from`复制所有额外的 props(由成员函数 set_xxx 设置)(如果需要则进行深复制) -**Parameters** +copy all extra props(set by member func set_xxx) from `from` (deepcopy if needed), **Parameters** - **from** @@ -244,7 +245,7 @@ const Tensor& bmf_sdk::BMFAVPacket::data ( ) const ``` void* bmf_sdk::BMFAVPacket::data_ptr ( ) ``` -返回底层数据的原始指针 +return raw pointer of underlying data **Returns** @@ -264,7 +265,7 @@ const void* bmf_sdk::BMFAVPacket::data_ptr ( ) const ``` int64_t bmf_sdk::BMFAVPacket::get_offset ( ) const ``` -获取当前数据偏移量,即文件的 write pointer 偏移量 +get the current data offset which is file write pointer offset **Returns** @@ -275,7 +276,8 @@ int64_t bmf_sdk::BMFAVPacket::get_offset ( ) const ``` int bmf_sdk::BMFAVPacket::get_whence ( ) const ``` -获取来自 mode 的数据。whence == SEEK_SET, from begin; whence == SEEK_CUR, current +get the data whence which is mode. whence == SEEK_SET, from begin; whence == SEEK_CUR, current + **Returns** @@ -302,7 +304,7 @@ static **Parameters** - **size** - - **opts**:参考 [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) + - **opts** ref [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) @@ -323,7 +325,7 @@ static ``` int bmf_sdk::BMFAVPacket::nbytes ( ) const ``` -底层数据的字节数 +number of bytes of underlying data **Returns** @@ -334,7 +336,7 @@ int bmf_sdk::BMFAVPacket::nbytes ( ) const ``` bmf_sdk::BMFAVPacket::operator bool ( ) const ``` -检查 [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) 是否已定义。 +check if [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) if defined **Returns** @@ -358,7 +360,7 @@ bmf_sdk::BMFAVPacket::operator bool ( ) const ``` void bmf_sdk::BMFAVPacket::set_offset ( int64_t offset ) ``` -设置当前数据偏移量,即文件的 write pointer 偏移量 +set the current data offset which is file write pointer offset **Returns** @@ -369,12 +371,12 @@ void bmf_sdk::BMFAVPacket::set_offset ( int64_t offset ) ``` void bmf_sdk::BMFAVPacket::set_whence ( int whence ) ``` -设置数据来源,即 mode。whence == SEEK_SET, from begin; whence == SEEK_CUR, current +set the data whence which is mode. whence == SEEK_SET, from begin; whence == SEEK_CUR, current **Returns** -## 成员函数文档 +## Member Data Documentation ###  offset_ diff --git a/content/en/docs/bmf/api/api_in_cpp/decode_module/_index.md b/content/en/docs/bmf/api/api_in_cpp/decode_module/_index.md new file mode 100644 index 0000000..c168178 --- /dev/null +++ b/content/en/docs/bmf/api/api_in_cpp/decode_module/_index.md @@ -0,0 +1,84 @@ +--- +title: 'Built-in Decode Module' +linkTitle: 'Built-in Decode Module' +weight: 4 +--- + + +This is a module capability discrption about BMF build-in decoder. The module can be used by BMF API such as [bmf.decode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#decode) by providing json style "option" to config such as the 3rd parameter below: + + +``` +bmf.decode( + {'input_path': input_video_path} +) + +``` +Details: + + - module name: c_ffmpeg_decoder + + - loglevel: to set the loglevel of ffmpeg library it can be "quiet","panic","fatal","error","warning","info","verbose","debug","trace" + + - map_v: video stream index for decoder, exp. 0, which mean choose No.0 stream as video stream to be decode. + + - map_a: audio stream index for decoder, exp. 1, which mean choose No.1 stream as audio stream to be decode. + + - start_time: decode start time in seconds, exp. 1, which mean just decode the frame after 1 second, similar as -ss in ffmpeg command. + + - end_time: decode end time, exp. 1, which mean just decode the frame before 1 second, just as -to in ffmpeg command. + + - durations: decode multiple group of duration frames/samples, such as [1.1, 4, 6.5, 9, 12.3, 15]. + + - fps: decode the frame as the fps set . + + - video_time_base: video stream time base, exp. 1/1000, set the video stream timebase as 1/1000. + + - skip_frame: skip frame, exp. 32, make decoder discard processing depending on the option value, just as -skip_frame in ffmpeg commnad. AVDISCARD_NONE = -16, ///< discard nothing AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi AVDISCARD_NONREF = 8, ///< discard all non reference AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames AVDISCARD_NONINTRA= 24, ///< discard all non intra frames AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes AVDISCARD_ALL = 48, ///< discard all + + - video_codec: video codec name, exp. libx264, set the specific codec for video stream. it will be stream copy when it set to be "copy" + + - overlap_time, which is used in decode live stream, if the live stream cut off, if the next packet pts is overlap smaller than overlap time, we will remove the overlap packet. default value is 10 + + - cut_off_time, which is used in decode live stream ,if the live stream cut off, when the next packet pts is larger than last pts + cut_off_time, we will adjust pts to avoid large cut off. else we use the packet pts. + + - cut_off_interval.which is used in decode live stream ,if the live stream cut off, when the next packet pts is larger than last pts + cut_off_time, we will adjust pts to avoid large cut off. else we use the packet pts. + + - vframes: set the number of video frames to output + + - aframes: set the number of audio frames to output + + - copyts: copy timestamps + + - max_width_height: set the max width or height limitation of input frame. Once it's enabled, frame will be dropped by default or it will throw exp according to "limit_hits" + + - max_limit_hits: set the max number of limit hits, once exceeded the exp will be threw + + - hwaccel: hardware accelete exp. cuda. + - extract_frames: support extract frames with given fps and device. + + - audio_codec: audio codec name, exp. aac, set the specific codec for audio stream. + + - dec_params: set the decode codec parameters, such as "threads": 1 + + - autorotate: to enable/disable autorotate for the input video if needed, it's enabled by default + + - s: video size, exp. "1280:720". + + - pix_fmt: pixel format, exp. "rgba". + + - input_path: decode input file,exp. "1.mp4". + + - push_raw_stream: enable raw stream push mode, exp. 1 + + - channels: audio channels (required for audio push mode) + + - sample_rate: audio sample rate (required for audio push mode) + + - sample_fmt: audio sample format (used for audio push mode - optional) + + - orig_pts_time: keep the original pts time of inputstream in the frame + + +### Build-in Decode Module + diff --git a/content/en/docs/bmf/api/api_in_cpp/encode_module/_index.md b/content/en/docs/bmf/api/api_in_cpp/encode_module/_index.md new file mode 100644 index 0000000..8ffbc8b --- /dev/null +++ b/content/en/docs/bmf/api/api_in_cpp/encode_module/_index.md @@ -0,0 +1,150 @@ +--- +title: 'Built-in Encode Module' +linkTitle: 'Built-in Encode Module' +weight: 5 +--- + +This is a module capability discrption about BMF build-in encoder. The module can be used by BMF API such as [bmf.encode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#encode) by providing json style "option" to config such as the 3rd parameter below: + + +``` +bmf.encode( + video['video'], + audio_stream, + { + "output_path": output_path, + "video_params": { + "codec": "h264", + "width": 320, + "height": 240, + "crf": 23, + "preset": "veryfast" + }, + "audio_params": { + "codec": "aac", + "bit_rate": 128000, + "sample_rate": 44100, + "channels": 2 + } + } +) + +``` +Details: + + - module name: c_ffmpeg_encoder + + - null_output: to make encoder as a null sink in some cases. "null_output": 1 + + - output_path: output file path, exp. out.mp4, which can indicate the output format of the file similiar as ffmpeg. + + - adjust_pts: will adjust the pts start from 0 when it's enabled + + - format: similiar as the "-f" in ffmpeg command line to specify the demux/mux format. exp. +``` +{ + "format": "flv", + "output_path": rtmp://docker.for.mac.host.internal/rtmplive +} + +``` + + + - output_prefix: specify the output directory path + + - push_output: decide whether to mux the result and where to output the results, available value is 0/1/2. 0: write muxed result to disk, 1: write muxed result to the output queue, 2: write unmuxed result to the output queue. +``` +"push_output": 1 + +``` + + + - avio_buffer_size: set avio buffer size, when oformat is image2pipe, this paramter is useful, exp. +``` +"avio_buffer_size": 16384 + +``` + + + - mux_params: specify the extra output mux parameters, exp. +``` +"format": "hls", +"mux_params": { + "hls_list_size": "0", + "hls_time": "10", + "hls_segment_filename": "./file%03d.ts" +} + +``` + + + - video_params: video codec related parameters which similiar as ffmpeg. exp. +``` +"video_params": { + "codec": "h264", + "width": 320, + "height": 240, + "crf": 23, + "preset": "veryfast" +}, + +``` + + + - metadata: to add user metadata in the outfile + + - vframes: set the number of video frames to output + + - aframes: set the number of audio frames to output + + - min_frames: set the min number of output video frames + + - codec: param in video_params or audio_params to specify the name of the codec which libavcodec included. exp. "h264", "bytevc1", "jpg", "png", "aac"(audio) + + - width: param in video_params to specify the video width + - height: param in video_params to specify the video height + - pix_fmt: param in video_params to specify the input format of raw video + + - audio_params: audio codec related parameters which similiar as ffmpeg. exp. +``` +"audio_params": { + "codec": "aac", + "bit_rate": 128000, + "sample_rate": 44100, + "channels": 2 +} + +``` + + + - loglevel: without using the logbuffer of builder API, to set the ffmpeg av log level: "quiet","panic","fatal","error","warning","info","verbose","debug","trace" + + - threads: specify the number of threads for encoder, "auto" by default, and other for example: "threads": "2" + + - psnr: to set encoder provide psnr information + + - in_time_base: to set time base manually + + - vsync: to set the video sync method on frame rate, "auto" by default. and it can be "cfr", "vfr", "passthrough", "drop" similar as ffmpeg + + - max_fr: to set the frame rate + + - max_fr: to set the frame rate, similar as ffmpeg + + - qscal: to set the qscale for the encoder global_quality + + - vtag: to set the vtag for output stream + + - bit_rate or b: to set the bitrate for video encode + + - channels: to set the channels for input audio + + - bit_rate or b: to set the bit_rate for audio encode + + - sample_rate: to set the sample_rate for audio encode + + - atag: to set the atag for output stream + + +### Build-in Encode Module + diff --git a/content/en/docs/bmf/api/api_in_cpp/exception/_index.md b/content/en/docs/bmf/api/api_in_cpp/exception/_index.md index 8ce87f1..a7e1ac0 100644 --- a/content/en/docs/bmf/api/api_in_cpp/exception/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/exception/_index.md @@ -7,7 +7,7 @@ weight: 3 [//]: <> (REF_MD: classException.html) - [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-member-functions) | [公共属性](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-attributes) | List of all members # Exception Class Reference + [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-attributes) | List of all members # Exception Class Reference Class passed to an error. [More...](page_classexception_v3_0_0#details) @@ -15,7 +15,7 @@ exception_factory.h![img](/img/docs/classException__inherit__graph.png) ![img](/img/docs/classException__coll__graph.png) - ## 公有成员函数 + ## Public Member Functions [Exception](#exception-12) () @@ -29,7 +29,7 @@ virtual const char * [what](#what) () const throw () void [formatMessage](#formatmessage) () - ## 公共属性 + ## Public Attributes std::string [msg](#msg) @@ -51,16 +51,16 @@ int [line](#line) -## 详细描述 +## Detailed Description -Class 传递一个错误。 +Class passed to an error. -该 class 封装了有关程序中发生的错误的所有或几乎所有必要的信息。异常通常是通过 BMF_Error 隐式构造和抛出的。 +This class encapsulates all or almost all necessary information about the error happened in the program. The exception is usually constructed and thrown implicitly via BMF_Error **See also** error -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  Exception() [1/2] @@ -68,7 +68,7 @@ Class 传递一个错误。 ``` Exception::Exception ( ) ``` -默认构造函数 +Default constructor ###  Exception() [2/2] @@ -81,7 +81,7 @@ Exception::Exception ( int _code, int _line ) ``` -完整的构造函数。通常构造函数不会被显式调用。而是使用宏 BMF_Error()、BMF_Error_()。 +Full constructor. Normally the constructor is not called explicitly. Instead, the macros BMF_Error() , BMF_Error_() are used. ###  ~Exception() @@ -97,7 +97,7 @@ throw ( -## 成员函数文档 +## Member Function Documentation ###  formatMessage() @@ -122,7 +122,7 @@ throw ( **Returns** -## 成员数据文档 +## Member Data Documentation ###  code @@ -130,7 +130,7 @@ throw ( ``` int Exception::code ``` -错误代码 +error code **See also** BMFStatus @@ -141,7 +141,7 @@ int Exception::code ``` std::string Exception::err ``` -错误描述 +error description ###  file @@ -149,7 +149,7 @@ std::string Exception::err ``` std::string Exception::file ``` -发生错误的源文件名 +source file name where the error has occurred ###  func @@ -157,7 +157,7 @@ std::string Exception::file ``` std::string Exception::func ``` -函数名称。仅当编译器支持获取时可用 +function name. Available only when the compiler supports getting it ###  line @@ -165,7 +165,7 @@ std::string Exception::func ``` int Exception::line ``` -发生错误的源文件中的行号 +line number in the source file where the error has occurred ###  msg @@ -173,7 +173,7 @@ int Exception::line ``` std::string Exception::msg ``` -格式化的错误消息 +the formatted error message - /20230627/doxygen_converter/bmf/bmf/sdk/cpp_sdk/include/bmf/sdk/ exception_factory.h diff --git a/content/en/docs/bmf/api/api_in_cpp/filter_module/_index.md b/content/en/docs/bmf/api/api_in_cpp/filter_module/_index.md new file mode 100644 index 0000000..5df98e0 --- /dev/null +++ b/content/en/docs/bmf/api/api_in_cpp/filter_module/_index.md @@ -0,0 +1,118 @@ +--- +title: 'Built-in Filter Module' +linkTitle: 'Built-in Filter Module' +weight: 6 +--- + +This is a module capability discrption about BMF build-in filter. The module can be used by Module Related BMF API such as [bmf.concat()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#concat) by providing ffmpeg command line style parameters to config the filtergraph: + + +``` +main_video = ( + video['video'].scale(output_width, output_height) + .overlay(logo_1, repeatlast=0) + .overlay(logo_2, + x='if(gte(t,3.900),960,NAN)', + y=0, + shortest=1) +) + +concat_video = ( + bmf.concat(header['video'].scale(output_width, output_height), + main_video, + tail['video'].scale(output_width, output_height), + n=3) +) + +concat_audio = ( + bmf.concat(header['audio'], + video['audio'], + tail['audio'], + n=3, v=0, a=1) +) + +``` +And in another common way, users can create any filter stream which ffmpeg libavfilter included. exp.: + + +``` +ff_filter('unsharp', '5:5:1') + +``` + - module name: c_ffmpeg_filter + + +### Build-in Filter Module + +## GPU Filter Module + +BMF provides several common filtering modules accelerated by GPU: +- scale +- flip +- rotate +- crop +- blur + +These modules are located in bmf/example/gpu_module/. The demo code showing how to use these modules is in `test_gpu_module.py`. You can also try them on Colab [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/eefengwei/colab_tutorials/blob/main/colab_tutorial_cd.ipynb). The modules accept nv12/yuv420p/rgb formats with 8/10 bits per component. + +### Scale + +The scale module can resize an image. + +**Scale Options** + +***size***: Target size of the image, can be of format `WxH`, `W*H` or `W,H` + +***algo***(optional): Interpretation algorithm, can be one of `area`, `cubic`, `linear` and `nearest`. If unspecified, `linear` will be used by default. + +### Flip + +Flip the image in the specified direction. + +**Flip Options** + +***direction***: The direction of the flip. Supports `h`, `horizontal`, `v`, `vertical` or `both` (flip both vertically and horizontally). E.g. `.module('flip_gpu', {'direction': 'v'})` flips the image vertically + +### Rotate + +Rotate the image in a certain angle. The angle can be represented as degrees or radians. By default, the image will be rotated around the image center. Note that the empty area will be fill with 0. Rotation will not change the aspect ratio of the image, i.e. if you rotate a 1920x1080 image by 90 degrees, the output image is still 1920x1080 rather than 1080x1920 + +**Rotate Options** + +***angle_deg***: The angle of the rotation. A positive angle value will rotate the image clockwise, a negative angle value anti-clockwise. The angle can be a floating point value. + +***angle***: The radius of the rotation. e.g. setting `{'angle': 'pi/8'}` will effectively rotate the image by 45 degrees clockwise. + +***center***: The point around which the image is rotated. By default, the center is the image center `w/2,h/2`, where `w` and `h` are the width and height of the image. + +***scale***: Scaling factor of the image. Default is `1`, which means do not scale the image. `{'scale': 1.5}` will zoom in the image by 1.5x. + +***algo***: Interpolation algorithm. Supports `'cubic'`, `'linear'` and `'nearest'`. + +### Crop + +Crops the input image into the given size. Example: `module('crop_gpu', {'x': 960, 'y': 540, 'width': 640, 'height': 480})` + +**Crop Options** + +***x, y***: The coordinate of the cropping area's upper-left corner. + +***width, height***: Width and height of the cropping area. + +### Blur + +Blur the input image using one of the supported algorithm (gaussian, average and median). Gaussian blur example: `module('blur_gpu', {'op': 'gblur', 'sigma': [0.7, 0.7], 'size': [5, 5]})` + +**Blur Options** + +***op***: The blur algorithm to be used. Supports `'gblur'` (gaussian blur), `'avgblur'` (average blur) and `'median'` (median blur). + +***size***: The width and height of the blur kernel. Should be of format `[W, H]`. Default size is `[1, 1]` This option applies to all blur algorithms. + +***planes***: Specifies which image plane should be blurred. The value should be a bit mask, e.g. if you want to blur all three planes of a yuv420p image, you should set `'planes': 0x7` or `'planes': 0b111`. Default value is `0xf`. This option applies to all blur algorithms. + +***sigma***: Gaussian kernel standard deviation. Should be of format `[X, Y]`, float data type. This option only applies to the `gblur` op. + +***anchor***: Kernel anchor. Indicates the relative position of a filtered point within the kernel. Should be of format `[X, Y]`. Default is `[-1, -1]` which indicates kernel center. This option only applies to `avgblur` op. + +***radius***: Alias for the ***size*** option. Radius only applies to `median` op. \ No newline at end of file diff --git a/content/en/docs/bmf/api/api_in_cpp/future/_index.md b/content/en/docs/bmf/api/api_in_cpp/future/_index.md index ecf314d..de5e3c4 100644 --- a/content/en/docs/bmf/api/api_in_cpp/future/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/future/_index.md @@ -7,11 +7,11 @@ weight: 13 [//]: <> (REF_MD: classbmf__sdk_1_1Future.html) - [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/future/#public-member-functions) | List of all members # bmf_sdk::Future Class Referenceabstract + [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/future/#public-member-functions) | List of all members # bmf_sdk::Future Class Referenceabstract sdk_interface.h! - ## 公有成员函数 + ## Public Member Functions [Future](#future-13) () @@ -45,7 +45,7 @@ void [synchronize](#synchronize) () -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  Future() [1/3] @@ -96,7 +96,7 @@ virtual  {}; ``` -## 成员函数文档 +## Member Function Documentation ###  copy_props() @@ -104,7 +104,8 @@ virtual ``` Future & bmf_sdk::Future::copy_props( const Future &from ) ``` -util 函数复制 props +util function to copy props + **Parameters** - **from** @@ -150,7 +151,7 @@ Implemented in [bmf_sdk::VideoFrame](https://babitmf.github.io/docs/bmf/api/api ``` bool bmf_sdk::Future::ready ( ) const ``` -检查结果是否准备好,必须在 [record()](#record) 之后调用 +check if result is ready, must be called after [record()](#record) **Returns** @@ -162,9 +163,9 @@ bool bmf_sdk::Future::ready ( ) const ``` void bmf_sdk::Future::record ( bool use_current = true ) ``` -记录时间以跟踪数据的准备情况 +record a event to track the readiness of the data -使用当前的 stream 或 self->stream +use current stream or self->stream ###  set_stream() @@ -172,7 +173,7 @@ void bmf_sdk::Future::record ( bool use_current = true ) ``` void bmf_sdk::Future::set_stream ( uint64_t stream ) ``` -设置 stream object,当前设备特定的 stream handle,只有 cuda stream handle(cudaStream_t)被取代,我们只获取该 stream 的 ref,该 stream 的所有权仍属于调用者。 +Set the stream object, device specific stream handle currently, only cuda stream handle(cudaStream_t) is suporrted, we only take the ref of this stream, the ownership of this stream is still belongs to caller. **Parameters** - **stream** diff --git a/content/en/docs/bmf/api/api_in_cpp/jsonparam/_index.md b/content/en/docs/bmf/api/api_in_cpp/jsonparam/_index.md index c6ee742..61aec12 100644 --- a/content/en/docs/bmf/api/api_in_cpp/jsonparam/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/jsonparam/_index.md @@ -7,7 +7,7 @@ weight: 4 [//]: <> (REF_MD: classJsonParam.html) - [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-member-functions) | [公共属性](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-attributes) | [成员清单](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/) # JsonParam Class Reference + [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-attributes) | [List of all members](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/) # JsonParam Class Reference json_param.h ## Public Member Functions @@ -91,13 +91,13 @@ void [merge_patch](#merge_patch) (const [JsonParam](https://babitmf.github.io/ - ## 公共属性 + ## Public Attributes bmf_nlohmann::json [json_value_](#json_value_) -## 构造函数和析构函数 +## Constructor & Destructor Documentation ###  JsonParam() [1/4] @@ -120,7 +120,7 @@ JsonParam::JsonParam ( ) JsonParam::JsonParam ( const JsonParam &json_param ) ``` **Parameters** - - **json_param**:复制 json_param + - **json_param** copy json_param @@ -131,7 +131,7 @@ JsonParam::JsonParam ( const JsonParam &json_param ) JsonParam::JsonParam ( std::string opt_str ) ``` **Parameters** - - **opt_str**:json string 的内容 + - **opt_str** content of json string @@ -152,7 +152,7 @@ JsonParam::JsonParam ( bmf_nlohmann::json json_value ) -## 成员函数文档 +## Member Function Documentation ###  dump() @@ -160,7 +160,7 @@ JsonParam::JsonParam ( bmf_nlohmann::json json_value ) ``` std::string JsonParam::dump ( ) const ``` -将 json object 传输到 string +dump json object to string **Returns** @@ -171,10 +171,10 @@ std::string JsonParam::dump ( ) const ``` int JsonParam::erase ( std::string name ) ``` -删除 json 参数中的关键内容 +erase the key content from json param **Parameters** - - **name**:key 的名称 + - **name** name of key @@ -208,11 +208,11 @@ int JsonParam::get_double ( std::string name, double & result ) ``` -根据 key 的名称获取 double value +get double value according to the key name **Parameters** - - **name**:key 的名称 - - **result**:double 的结果 + - **name** name of key + - **result** result of double @@ -227,11 +227,11 @@ int JsonParam::get_double_list ( std::string name, std::vector< double > & result ) ``` -根据 key 的名称获取 double value list +get double value list according to the key name **Parameters** - - **name**:key 的名称 - - **result** doule list 的结果 + - **name** name of key + - **result** result of doule list @@ -246,11 +246,11 @@ int JsonParam::get_float ( std::string name, float & result ) ``` -根据 key 的名称获取 float value +get float value according to the key name **Parameters** - - **name**:key 的名称 - - **result**:float 的结果 + - **name** name of key + - **result** result of float @@ -265,11 +265,11 @@ int JsonParam::get_float_list ( std::string name, std::vector< float > & result ) ``` -根据 key 的名称获取 float value list +get float value list according to the key name **Parameters** - - **name**:key 的名称 - - **result**:float list 的结果 + - **name** name of key + - **result** result of float list @@ -284,11 +284,11 @@ int JsonParam::get_int ( std::string name, int & result ) ``` -根据 key 的名称获取 int +get int according to the key name **Parameters** - - **name**:key 的名称 - - **result**:int 的结果 + - **name** name of key + - **result** result of int @@ -303,11 +303,11 @@ int JsonParam::get_int_list ( std::string name, std::vector< int > & result ) ``` -根据 key 的名称获取int value list +get int value list according to the key name **Parameters** - - **name**:key 的名称 - - **result**:int list 的结果 + - **name** name of key + - **result** result of int list @@ -320,10 +320,10 @@ int JsonParam::get_int_list ( std::string name, ``` int JsonParam::get_iterated ( std::vector< std::pair< std::string, std::string >> & group ) ``` -参数中获取所有内容 +get all content from json param **Parameters** - - **name**:key 的名称 + - **name** name of key @@ -338,11 +338,11 @@ int JsonParam::get_long ( std::string name, int64_t & result ) ``` -根据 key 的名称获取 long value +get long value according to the key name **Parameters** - - **name**:key 的名称 - - **result**:long 的结果 + - **name** name of key + - **result** result of long @@ -357,11 +357,11 @@ int JsonParam::get_object ( std::string name, JsonParam &result ) ``` -根据 key 的名称获取 json object +get json object according to the key name **Parameters** - - **name**:key 的名称 - - **result**:json object 的结果 + - **name** name of key + - **result** result of json object @@ -376,11 +376,11 @@ int JsonParam::get_object_list ( std::string name, std::vector< JsonParam > &result ) ``` -根据 key 的名称获取 json object list +get json object list according to the key name **Parameters** - - **name**:key 的名称 - - **result**:json object list 的结果 + - **name** name of key + - **result** result of json object list @@ -395,11 +395,11 @@ int JsonParam::get_string ( std::string name, std::string & result ) ``` -根据 key 的名称获取 string +get string according to the key name **Parameters** - - **name**:key 的名称 - - **result**:string 的结果 + - **name** name of key + - **result** result of string @@ -414,11 +414,11 @@ int JsonParam::get_string_list ( std::string name, std::vector< std::string > & result ) ``` -根据 key 的名称获取 string list +get string list according to the key name **Parameters** - - **name**:key 的名称 - - **result**;string list 的结果 + - **name** name of key + - **result** result of string list @@ -434,7 +434,7 @@ bool JsonParam::has_key ( std::string name ) judge the json has key **Parameters** - - **name**:key 的名称 + - **name** name of key @@ -447,10 +447,10 @@ judge the json has key ``` int JsonParam::load ( std::string file_name ) ``` -加载 json content 的文件 +load file of json content **Parameters** - - **file_name**:json content 的文件名称 + - **file_name** file name of json content @@ -463,10 +463,10 @@ int JsonParam::load ( std::string file_name ) ``` void JsonParam::merge_patch ( const JsonParam &json_patch ) ``` -将 json patch 合并到当前 target +merge json patch to current target **Parameters** - - **json_patch**:json patch + - **json_patch** json patch @@ -495,10 +495,10 @@ void JsonParam::merge_patch ( const JsonParam &json_patch ) ``` int JsonParam::parse ( std::string content ) ``` -解析 json content string +parse json content string **Parameters** - - **content**:json string + - **content** json string @@ -511,10 +511,10 @@ int JsonParam::parse ( std::string content ) ``` void JsonParam::set_value ( bmf_nlohmann::json &value ) ``` -设置 json value 的值 +set value of json value **Parameters** - - **json_value**:json value + - **json_value** json value @@ -524,10 +524,10 @@ void JsonParam::set_value ( bmf_nlohmann::json &value ) ``` int JsonParam::store ( std::string file_name ) ``` -存储 json content 到文件 +store json content to file **Parameters** - - **file_name**:json content 的文件名称 + - **file_name** file name of json content @@ -553,7 +553,7 @@ T JsonParam::to ( ) const   } ``` -## 成员数据文档 +## Member Data Documentation ###  json_value_ diff --git a/content/en/docs/bmf/api/api_in_cpp/loglevel/_index.md b/content/en/docs/bmf/api/api_in_cpp/loglevel/_index.md new file mode 100644 index 0000000..21bcbce --- /dev/null +++ b/content/en/docs/bmf/api/api_in_cpp/loglevel/_index.md @@ -0,0 +1,26 @@ +--- +title: 'Loglevel' +linkTitle: 'Loglevel' +weight: 7 +--- + +## LogLevel + +If you want to modify the loglevel related to FFmpeg in the built-in Module, please pass the loglevel parameter when building the graph. The following example sets the loglevel of decoder to quiet and the loglevel of encoder to debug. +``` + graph = bmf.graph() + + #decode + video = graph.decode({ + "loglevel" : "quiet", + "input_path": input_video_path + }) + graph.encode({ + "loglevel" : "debug", + "input_path": input_video_path + }) +``` + +The BMF framework also has its own log and loglevel. For the log from BMF, it's set to INFO default, if you want to modify, please use the ENV: + +```export BMF_LOG_LEVEL=WARNING/INFO/ERROR/FATAL/DISABLE``` \ No newline at end of file diff --git a/content/en/docs/bmf/api/api_in_cpp/module/_index.md b/content/en/docs/bmf/api/api_in_cpp/module/_index.md index 2e045af..2932e38 100644 --- a/content/en/docs/bmf/api/api_in_cpp/module/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/module/_index.md @@ -7,7 +7,7 @@ weight: 5 [//]: <> (REF_MD: classbmf__sdk_1_1Module.html) - [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-member-functions) | [公共属性](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-attributes) | List of all members # bmf_sdk::Module Class Referenceabstract + [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-attributes) | List of all members # bmf_sdk::Module Class Referenceabstract module.h ## Public Member Functions @@ -71,13 +71,13 @@ virtual int32_t [report](#report) ( [JsonParam](https://babitmf.github.io/docs virtual [~Module](#~module) () - ## 公共属性 + ## Public Attributes int32_t [node_id_](#node_id_) = -1 -## 构造函数和析构函数 +## Constructor & Destructor Documentation ###  Module() @@ -94,8 +94,8 @@ bmf_sdk::Module::Module ( int32_t node_id = -1, **Parameters** - - **node_id**:唯一标识 - - **json_param**:模块的 json 参数 + - **node_id** unique id . + - **json_param** json param of module. @@ -126,7 +126,7 @@ virtual  {}; ``` -## 成员函数文档 +## Member Function Documentation ###  close() @@ -142,7 +142,7 @@ virtual -关闭模块并释放资源 +close module and release resources **Returns** @@ -166,10 +166,10 @@ virtual -根据 json 参数动态重置模块 +dynamic reset module according to the jsonParam **Parameters** - - **opt_reset**:重置 json 参数 + - **opt_reset** json param of reset @@ -195,7 +195,7 @@ virtual -设置模块 mode 为 flush data +set module mode to flush data **Returns** @@ -219,10 +219,10 @@ virtual -如果模块是 subgraph,则获取 graph config +if the module is subgraph get the graph config **Parameters** - - **json_param**:返回 config 的值 + - **json_param** return value of config @@ -248,10 +248,10 @@ virtual -获取模块的 input stream 信息 +get input stream info of module **Parameters** - - **json_param**:input stream 信息 + - **json_param** input stream info. @@ -277,10 +277,11 @@ virtual -获取模块的信息 +get info of module **Parameters** - - **json_param**:模块信息 + - **json_param** module info. + **Returns** @@ -305,10 +306,11 @@ virtual -获取模块的 output stream 信息 +get output stream info of module **Parameters** - - **json_param**:output stream 信息 + - **json_param** output stream info. + **Returns** @@ -333,7 +335,7 @@ virtual -初始化模块 +init module **Returns** @@ -357,10 +359,10 @@ virtual -检查 input stream 是否需要数据 +check the input stream if need data **Parameters** - - **input_stream_id**:input stream id + - **input_stream_id** input stream id @@ -386,7 +388,7 @@ virtual -检查模块类型 +check the module type **Returns** @@ -410,7 +412,7 @@ virtual -检查模块是否是 subgraph +check the module is subgraph **Returns** @@ -434,10 +436,10 @@ virtual -检查 input stream 是否需要 hungry check +check the input stream if need hungry check **Parameters** - - **input_stream_id**:input stream id + - **input_stream_id** input stream id @@ -464,7 +466,7 @@ virtual int32_t bmf_sdk::Module::process ( Task &task ) process task **Parameters** - - **task**:需要被处理 + - **task** need to be processed @@ -487,11 +489,11 @@ virtual -报告模块的统计数据 +report module stats **Parameters** - - **json_param**:统计数据 - - **hints** 提示传递到统计计算 + - **json_param** stats + - **hints** hints pass to stats caculation @@ -517,7 +519,7 @@ virtual -重置模块 +reset module **Returns** @@ -541,10 +543,10 @@ virtual -设置模块的 graph callback +set the graph callback of module **Parameters** - - **callback_endpoint**:graph 中定义的 callback + - **callback_endpoint** callback that defined in graph @@ -567,10 +569,10 @@ virtual -设置模块的 input stream 信息 +set input stream info of module **Parameters** - - **json_param**:input stream 信息 + - **json_param** input stream info. @@ -596,10 +598,10 @@ virtual -设置模块的 output stream 信息 +set output stream info of module **Parameters** - - **json_param**:output stream 信息 + - **json_param** output stream info. @@ -611,7 +613,7 @@ virtual  { return 0; }; ``` -## 成员数据文档 +## Member Data Documentation ###  node_id_ diff --git a/content/en/docs/bmf/api/api_in_cpp/opaquedataset/_index.md b/content/en/docs/bmf/api/api_in_cpp/opaquedataset/_index.md index 2371741..eb1bc6b 100644 --- a/content/en/docs/bmf/api/api_in_cpp/opaquedataset/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/opaquedataset/_index.md @@ -7,11 +7,11 @@ weight: 10 [//]: <> (REF_MD: classbmf__sdk_1_1OpaqueDataSet.html) - [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#public-member-functions) | [受保护的成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#pro-methods) | List of all members # bmf_sdk::OpaqueDataSet Class Reference + [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#public-member-functions) | [Protected Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#pro-methods) | List of all members # bmf_sdk::OpaqueDataSet Class Reference sdk_interface.h! - ## 公共成员函数 + ## Public Member Functions [OpaqueDataSet](#opaquedataset-13) ()=default @@ -26,7 +26,7 @@ sdk_interface.h! void [private_attach](#private_attach) (const T *data, Args &&...args) - + const T * [private_get](#private_get) () const @@ -37,7 +37,7 @@ void [private_merge](#private_merge) (const [OpaqueDataSet](https://babitmf.gi - ## 受保护的成员函数 + ## Protected Member Functions virtual void [set_private_data](#set_private_data) (int key, const OpaqueData &data) @@ -46,7 +46,7 @@ virtual void [set_private_data](#set_private_data) (int key, const OpaqueData virtual const OpaqueData & [private_data](#private_data) (int key) const -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  OpaqueDataSet() [1/3] @@ -72,6 +72,7 @@ bmf_sdk::OpaqueDataSet::OpaqueDataSet ( OpaqueDataSet && ) + ###  OpaqueDataSet() [3/3] ``` @@ -82,7 +83,8 @@ bmf_sdk::OpaqueDataSet::OpaqueDataSet ( const OpaqueDataSet & ) -## 成员函数文档 + +## Member Function Documentation ###  copy_props() @@ -90,7 +92,7 @@ bmf_sdk::OpaqueDataSet::OpaqueDataSet ( const OpaqueDataSet & ) ``` OpaqueDataSet & bmf_sdk::OpaqueDataSet::copy_props( const OpaqueDataSet &from ) ``` -复制 props 的 util 函数 +utils function to copy props **Parameters** - **from** @@ -126,7 +128,7 @@ void bmf_sdk::OpaqueDataSet::private_attach ( const T * data, -附加类型为 T 的私有数据,为确保类型安全,T 应当由 OpaqueDataInfo 注册。 +Attach private data with type T, for type safety, T should be registry by OpaqueDataInfo . ffmpeg_helper.h , test_video_frame.cpp @@ -138,7 +140,7 @@ void bmf_sdk::OpaqueDataSet::private_attach ( const T * data, **Parameters** - **data** - - **args**:传递的额外的 arguments + - **args** extra arguments pass to @@ -177,7 +179,7 @@ const T* bmf_sdk::OpaqueDataSet::private_get ( ) const -读取通过 private_attach 或 private_merge 附加的只读私有数据。 +Retrieve readonly private data which attached by private_attach or private_merge. **Template Parameters** - **T** @@ -201,8 +203,7 @@ const T* bmf_sdk::OpaqueDataSet::private_get ( ) const ``` void bmf_sdk::OpaqueDataSet::private_merge ( const OpaqueDataSet &from ) ``` -合并来自 `from` 的私有数据 -**Parameters** +merge private data from `from` **Parameters** - **from** @@ -223,7 +224,7 @@ virtual -设置私有数据对象,派生类可以重载此函数以过滤掉不支持的 key。 +Set the private data object, Derived class can override this function to filter out unsupported keys. **Parameters** - **key** diff --git a/content/en/docs/bmf/api/api_in_cpp/packet/_index.md b/content/en/docs/bmf/api/api_in_cpp/packet/_index.md index cac6b5f..d6e93ba 100644 --- a/content/en/docs/bmf/api/api_in_cpp/packet/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/packet/_index.md @@ -56,7 +56,7 @@ double [time](#time) () const const [PacketImpl](https://babitmf.github.io/docs/bmf/api/api_in_cpp/packetimpl/) * [unsafe_self](#unsafe_self-22) () const - ## 静态公有成员函数 + ## Static Public Member Functions static Packet [generate_eos_packet](#generate_eos_packet) () @@ -64,14 +64,14 @@ static Packet [generate_eos_packet](#generate_eos_packet) () static Packet [generate_eof_packet](#generate_eof_packet) () - ## 受保护的成员函数 + ## Protected Member Functions [Packet](#packet-99) (T *obj) -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  Packet() [1/9] @@ -228,7 +228,7 @@ protected   } ``` -## 成员函数文档 +## Member Function Documentation ###  generate_eof_packet() diff --git a/content/en/docs/bmf/api/api_in_cpp/packetimpl/_index.md b/content/en/docs/bmf/api/api_in_cpp/packetimpl/_index.md index ac0acd5..6832915 100644 --- a/content/en/docs/bmf/api/api_in_cpp/packetimpl/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/packetimpl/_index.md @@ -11,7 +11,7 @@ weight: 7 packetimpl.h - ## 公有成员函数 + ## Public Member Functions [PacketImpl](#packetimpl-14) ()=delete @@ -42,7 +42,7 @@ void [set_time](#set_time) (double [time](#time) ) double [time](#time) () const - ## 受保护的成员函数 + ## Protected Member Functions [PacketImpl](#packetimpl-44) (void *obj, const TypeInfo * [type_info](#type_info) , const std::function< void(void *)> &del) @@ -54,7 +54,7 @@ double [time](#time) () const class [Packet](#packet) -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  PacketImpl() [1/4] @@ -113,7 +113,7 @@ bmf_sdk::PacketImpl::PacketImpl ( void * obj, -## 成员函数文档 +## Member Function Documentation ###  get() [1/2] diff --git a/content/en/docs/bmf/api/api_in_cpp/rational/_index.md b/content/en/docs/bmf/api/api_in_cpp/rational/_index.md index 2be2ce8..7d5fb89 100644 --- a/content/en/docs/bmf/api/api_in_cpp/rational/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/rational/_index.md @@ -16,7 +16,7 @@ rational.h ## Public Member Functions [Rational](#rational-22) (int n, int d) - ## 公共属性 + ## Public Attributes int [num](#num) = -1 @@ -26,7 +26,7 @@ int [den](#den) = -1 -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  Rational() [1/2] @@ -67,7 +67,7 @@ Rational::Rational ( int n,   } ``` -##成员数据文档 +## Member Data Documentation ###  den diff --git a/content/en/docs/bmf/api/api_in_cpp/sequencedata/_index.md b/content/en/docs/bmf/api/api_in_cpp/sequencedata/_index.md index 6ed00f7..9995867 100644 --- a/content/en/docs/bmf/api/api_in_cpp/sequencedata/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/sequencedata/_index.md @@ -11,7 +11,7 @@ weight: 11 sdk_interface.h - ## 公共成员函数 + ## Public Member Functions void [set_pts](#set_pts) (int64_t [pts](#pts) ) @@ -37,7 +37,7 @@ bool [operator<=](#operator-3) (const [SequenceData](https://babitmf.github.io -## 成员函数文档 +## Member Function Documentation ###  copy_props() @@ -45,7 +45,7 @@ bool [operator<=](#operator-3) (const [SequenceData](https://babitmf.github.io ``` SequenceData & bmf_sdk::SequenceData::copy_props( const SequenceData &from ) ``` -复制 props 的 util function +util function to copy props **Parameters** - **from** @@ -164,7 +164,7 @@ void bmf_sdk::SequenceData::set_pts ( int64_t pts ) -设置该 pts 的 object。 +Set the pts object. **Parameters** - **pts** @@ -188,10 +188,10 @@ void bmf_sdk::SequenceData::set_time_base ( Rational time_base ) -设置帧的 time base +set timebase of frame **Parameters** - - **time_base**;帧的 time base + - **time_base** of frame @@ -214,7 +214,8 @@ void bmf_sdk::SequenceData::set_time_base ( Rational time_base ) -获取 time base object。 +Get the time base object. + **Returns** [Rational](https://babitmf.github.io/docs/bmf/api/api_in_cpp/rational/) diff --git a/content/en/docs/bmf/api/api_in_cpp/task/_index.md b/content/en/docs/bmf/api/api_in_cpp/task/_index.md index fa42362..3f43bb1 100644 --- a/content/en/docs/bmf/api/api_in_cpp/task/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/task/_index.md @@ -60,7 +60,7 @@ int [get_node](#get_node) () void [init](#init) (int node_id, std::vector< int > input_stream_id_list, std::vector< int > output_stream_id_list) - ## 公共属性 + ## Public Attributes int64_t [timestamp_](#timestamp_) = [UNSET](page_timestamp_8h_v3_0_0#a6fc8e10db27041311d7695900743667caec1d962808cbb9cf1b89a5cdd6197923) @@ -78,7 +78,7 @@ int [node_id_](#node_id_) void [swap](#swap) ( [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) &target, [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) &source) -## 构造函数和析构函数 +## Constructor & Destructor Documentation ###  Task() [1/3] @@ -89,12 +89,12 @@ Task::Task ( int node_id = -1, std::vector< int > output_stream_id_list = {} ) ``` -构造 [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) +construct [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) . **Parameters** - - **node_id**:正在运行的 task 的 id - - **input_stream_id_list**:输入流的 id list - - **output_stream_id_list**:输出流的 id list + - **node_id** The id of the running task. + - **input_stream_id_list** input stream id list. + - **output_stream_id_list** output stream id list. @@ -110,7 +110,7 @@ Task::Task ( const Task &rhs ) ``` Task::Task ( Task &&rhs ) ``` -## 成员函数文档 +## Member Function Documentation ###  fill_input_packet() @@ -120,11 +120,11 @@ bool Task::fill_input_packet ( int stream_id, Packet packet ) ``` -将 packet 填入输入流队列。 +fill packet into the input stream queue. **Parameters** - - **stream_id**:输入流的 id - - **packet**:填入输入流队列的 packet + - **stream_id** The id of the input stream. + - **packet** the packet add to the input stream queue. @@ -139,11 +139,11 @@ bool Task::fill_output_packet ( int stream_id, Packet packet ) ``` -将 packet 填入输出流队列。 +fill packet into the output stream queue. **Parameters** - - **stream_id**:输出流的 id - - **packet**:填入输出流队列的 packet + - **stream_id** The id of the output stream. + - **packet** the packet add to the output stream queue. @@ -156,7 +156,7 @@ bool Task::fill_output_packet ( int stream_id, ``` ( ) ``` -获取输入流的 id list. +get input stream id list. **Returns** @@ -167,7 +167,7 @@ bool Task::fill_output_packet ( int stream_id, ``` PacketQueueMap & Task::get_inputs( ) ``` -获取输入流队列。 +get input stream queue. **Returns** @@ -184,7 +184,7 @@ int Task::get_node ( ) ``` ( ) ``` -获取输出流的 id list。 +get output stream id list. **Returns** @@ -195,7 +195,7 @@ int Task::get_node ( ) ``` PacketQueueMap & Task::get_outputs( ) ``` -获取输出流队列。 +get output stream queue. **Returns** @@ -235,11 +235,11 @@ bool Task::pop_packet_from_input_queue ( int stream_id, Packet & packet ) ``` -从输入队列的给定 stream id 中弹出 packet。 +pop packet from the given stream id of input queue. **Parameters** - - **stream_id**:输入流的 id - - **packet**:从输入流队列中弹出的 packet。 + - **stream_id** The id of the input stream. + - **packet** the packet poped from the input stream queue. @@ -254,11 +254,11 @@ bool Task::pop_packet_from_out_queue ( int stream_id, Packet & packet ) ``` -从输出队列的给定 stream id 中弹出 packet。 +pop packet from the given stream id of output queue. **Parameters** - - **stream_id**:输出流的 id - - **packet**:从输出流队列中弹出的 packet。 + - **stream_id** The id of the output stream. + - **packet** the packet poped from the output stream queue. @@ -271,10 +271,10 @@ bool Task::pop_packet_from_out_queue ( int stream_id, ``` void Task::set_timestamp ( int64_t t ) ``` -设置该task的timestamp +set the timestamp of the task. **Parameters** - - **t**:该 task 的 timestamp + - **t** the timestamp of the task. @@ -287,7 +287,7 @@ void Task::set_timestamp ( int64_t t ) ``` int64_t Task::timestamp ( ) const ``` -获取该 task 的 timestamp +get the timestamp of the task **Returns** @@ -308,7 +308,7 @@ void swap ( Task &target, -## 成员数据文档 +## Member Data Documentation ###  inputs_queue_ diff --git a/content/en/docs/bmf/api/api_in_cpp/video_frame/_index.md b/content/en/docs/bmf/api/api_in_cpp/video_frame/_index.md index d420380..a7694e7 100644 --- a/content/en/docs/bmf/api/api_in_cpp/video_frame/_index.md +++ b/content/en/docs/bmf/api/api_in_cpp/video_frame/_index.md @@ -12,13 +12,13 @@ weight: 9 video_frame.h - ## 公共类型 + ## Public Types using [Frame](#frame) = hmp::Frame - ## 公共成员函数 + ## Public Member Functions [VideoFrame](#videoframe-16) () @@ -152,7 +152,7 @@ void [synchronize](https://babitmf.github.io/docs/bmf/api/api_in_cpp/future/#s - ## 静态公共成员函数 + ## Static Public Member Functions static [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) [make](#make-12) (int [width](#width) , int [height](#height) , const PixelInfo &pix_info, const Device & [device](#device) =kCPU) @@ -161,7 +161,7 @@ static [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_fra static [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) [make](#make-22) (int [width](#width) , int [height](#height) , const PixelInfo &pix_info, const std::string & [device](#device) ) - ## 受保护的成员函数 + ## Protected Member Functions [VideoFrame](#videoframe-66) (const std::shared_ptr< Private > &other) @@ -183,7 +183,7 @@ virtual const OpaqueData & [private_data](https://babitmf.github.io/docs/bmf/a ``` using bmf_sdk::VideoFrame::Frame = hmp::Frame ``` -## 构造函数和析构函数文档 +## Constructor & Destructor Documentation ###  VideoFrame() [1/6] @@ -191,7 +191,7 @@ using bmf_sdk::VideoFrame::Frame = hmp::Frame ``` bmf_sdk::VideoFrame::VideoFrame ( ) ``` -构建一个未定义的 Video Frame object。 +Construct a undefined Video Frame object. ``` @@ -235,7 +235,7 @@ bmf_sdk::VideoFrame::VideoFrame ( const Frame &frame ) Construct [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) from Frame object. **Parameters** - - **frame**:专用于 YUV 数据,平面之间形状不规则 + - **frame** Dedicated to YUV data, with irregular shapes between planes @@ -249,12 +249,11 @@ bmf_sdk::VideoFrame::VideoFrame ( int width, const Device & device = kCPU ) ``` -使用 factory function VideoFrame::make 构建具有给定尺寸(宽、高)、PixelInfo 和设备的 VideoFrame(Frame) 以方便使用。 -**Parameters** - - **width**:Y 平面的宽 - - **height**:Y 平面的高 - - **pix_info**:PixelFormat 和 ColorModel - - **device**:device +Construct VideoFrame(Frame) with given size (width, height), PixelInfo, and device, for ease of use, using factory function VideoFrame::make **Parameters** + - **width** width of Y plane + - **height** height of Y plane + - **pix_info** PixelFormat and ColorModel + - **device** device @@ -270,7 +269,7 @@ bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other ) -## 成员函数文档 +## Member Function Documentation ###  copy_() @@ -278,10 +277,10 @@ bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other ) ``` VideoFrame & bmf_sdk::VideoFrame::copy_( const VideoFrame &from ) ``` -原地复制。 +In-place copy. **Parameters** - - **from**:type和shape相同的数据源 + - **from** data source which have the same type and shape @@ -294,8 +293,7 @@ bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other ) ``` VideoFrame & bmf_sdk::VideoFrame::copy_props( const VideoFrame &from ) ``` -复制来自 `from` 的所有 extra props(由成员函数set_xxx设置)(如果需要,可深度复制) -**Parameters** +copy all extra props(set by member func set_xxx) from `from` (deepcopy if needed), **Parameters** - **from** @@ -319,13 +317,13 @@ bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other ) int h ) const ``` -返回由(x、y、w、h)指定的选定区域 +Return the selected region which specified by (x, y, w, h) **Parameters** - - **x**:起始列索引 - - **y**:起始行索引 - - **w**:列数 - - **h**:行数 + - **x** start col index + - **y** start row index + - **w** number of cols + - **h** number of rows @@ -352,7 +350,7 @@ virtual -接口必须由子类实现,子类提供设备信息。 +interface must implemented by sub-class, which provide device info **Returns** @@ -398,9 +396,9 @@ static -构建 VideoFrame(Frame) 的 Facotry function +Facotry function to construct VideoFrame(Frame) -更多详细信息,请参阅 [test_video_frame.cpp](https://github.com/BabitMF/bmf/blob/a5d8c8626c0ae0bf5d2ae13ab284fe5e3fb4b5ee/bmf/sdk/cpp_sdk/test/test_video_frame.cpp#L4) +test_video_frame.cpp for more details ``` @@ -423,7 +421,7 @@ auto vf = VideoFrame::make(1920, 1080, H420, Device(kCUDA, 0)); - **width** - **height** - **format** - - **device**:const char*, string, Device - infer to Device + - **device** const char*, string, Device - infer to Device @@ -468,7 +466,7 @@ static ``` bmf_sdk::VideoFrame::operator bool ( ) const ``` -检查是否定义了 [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/)。 +check if [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) is defined **Returns** @@ -495,7 +493,7 @@ bmf_sdk::VideoFrame::operator bool ( ) const ``` VideoFrame bmf_sdk::VideoFrame::reformat( const PixelInfo & pix_info ) ``` -帧格式转换,此功能仅支持 rgb 转换为 yuv 或 yuv 转换为 rgb。 +Frame reformat, this only support rgb to yuv, or yuv to rgb. **Parameters** - **pix_info** @@ -513,11 +511,11 @@ bmf_sdk::VideoFrame::operator bool ( ) const bool non_blocking = false ) const ``` -复制到目标设备上,如果目标设备上已经有,则将执行 shadow copy。 +Copy to target device, if it have already reside on target device, shadow copy will be performed. **Parameters** - - **device**:目标设备 - - **non_blocking**:为 true 时,内部分配器将尝试分配固定的内存,这会导致数据复制异步 + - **device** Target device + - **non_blocking** if true, internal allocator will try to allocate pinned memory, which can make data copy asynchronous diff --git a/content/en/docs/bmf/api/api_in_go/_index.md b/content/en/docs/bmf/api/api_in_go/_index.md index 339e09f..ba26b54 100644 --- a/content/en/docs/bmf/api/api_in_go/_index.md +++ b/content/en/docs/bmf/api/api_in_go/_index.md @@ -3,141 +3,141 @@ title: 'API In Go' linkTitle: 'API In Go' weight: 3 --- -## Normal mode (即 normalMode) +## Normal mode (refer to normalMode) ### func NewBMFGraph(mode BMFGraphMode, option interface{}) *BMFGraph Para: -- mode: 枚举类型,即 BMF 的运行模式,有以下选项: - - Normal mode(最常用) - - Server:预构建模式 - - Generator:生成器模式 - - SubGraph:子图模式 - - Update:动态增删流场景 -- option: interface{} 类型,BMF 的全局参数,通常可以填空值 nil +- mode: Enumeration type, the operation mode of BMF, with the following options: + - Normal mode (most commonly used) + - Server pre-built mode + - Generator generator mode + - SubGraph subgraph mode + - Update Dynamic addition and deletion of streaming scenarios +- option: interface{} type, global Parameter of BMF, usually can be filled with null value nil Return: -- *BMFGraph: 结构体指针类型,全局 Graph 指针 +- *BMFGraph: structure pointer type, global Graph pointer ### func (g *BMFGraph) Decode(decodePara interface{}, controlStream *BMFStream) *BMFNode Para: -- decodePara: interface{} 类型,解码模块的参数,可以用 map[string]interface{} 数据结构来表示 -- controlStream: 结构体指针类型,通常为空 nil +- decodePara: interface{} type, decoding module Parameters, can be represented by map[string]interface{} data structure +- controlStream: structure pointer type, usually empty nil Return: -- *BMFNode: 结构体指针类型,指向解码节点的指针 +- *BMFNode: structure pointer type, pointer to decoding node ### func (n *BMFNode) Stream(id interface{}) *BMFStream Para: -- id: 整数,表示该节点的 stream number(stream number 通常从 0 开始) +- id: integer, representing the stream number of the node (the stream number usually starts from 0) Return: -- *BMFStream: 结构体指针类型,指向流结构体的指针 +- *BMFStream: structure pointer type, pointer to stream structure ### func (g *BMFGraph) Encode(videoStream *BMFStream, audioStream *BMFStream, encoderPara interface{}) *BMFNode Para: -- videoStream: 结构体指针类型,视频流的结构体指针 -- audioStream: 结构体指针类型,音频流的结构体指针 -- encoderPara: interface{} 类型,解码模块的参数,可以用 map[string]interface{} 数据结构来表示 +- videoStream: structure pointer type, the structure pointer of the video stream +- audioStream: structure pointer type, structure pointer of audio stream +- encoderPara: interface{} type, encoding module Parameters, can be represented by map[string]interface{} data structure Return: -- *BMFNode: 结构体指针类型,编码节点指针 +- *BMFNode: structure pointer type, coded node pointer ### func (g *BMFGraph) Module(inputs []*BMFStream, moduleName string, moduleType BMFModuleType, modulePath string, moduleEntry string, option interface{}, preModule *BMFModuleInstance) *BMFNode Para: -- inputs: BMFStream 结构指针的 slice 结构,代表模块的所有输入流 -- moduleName: 字符串类型,模块名称 -- moduleType: 枚举类型,有以下选项: +- inputs: The slice structure of the BMFStream structure pointer, representing all input streams of the module +- moduleName: string type, module name +- moduleType: enumerated type, with the following options: -Python -Cpp - -Go -- modulePath: 字符串类型,模块文件所在路径 -- moduleEntry: 字符串类型,模块入口 -- option: interface{} 类型,模块参数 -- preModule: BMFModuleInstance 的结构体指针,预加载模块,如果没有则为 nil + - Go +- modulePath: string type, the path where the module file is located +- moduleEntry: string type, module entry +- option: interface{} type, module Parameter +- preModule: structure pointer of BMFModuleInstance, preload module, nil if no Return: -- *BMFNode: 结构体指针类型,模块对应节点的指针 +- *BMFNode: structure pointer type, the pointer of the corresponding node of the module ### func (g *BMFGraph) Run(needMerge bool) *CBMFGraph Para: -- needMerge: Boolean 类型,是否合并图中的 ffmpeg filter 节点,通常为 true +- needMerge: Boolean type, whether to merge the ffmpeg filter nodes in the graph, usually true Return: -- *CBMFGraph: 结构体指针类型,是指向 C 语言 Graph 对象的封装结构体的指针 +- *CBMFGraph: structure pointer type, which is a pointer to the encapsulation structure of the C language graph object ### func (bgp *CBMFGraph) Close() error Return: -- error: error类型,当 C graph 结构为空时,会报错 +- error: error type, when the C graph structure is empty, an error will be reported -## preload mode (即 premoduleMode) +## preload mode (refer to premoduleMode) ### func NewCBMFModule(moduleName string, option interface{}, moduleType BMFModuleType, modulePath, moduleEntry string) (*CBMFModule, error) Para: -- moduleName: 字符串类型,模块名称 -- option: interface{} 类型,模块参数 -- moduleType: 枚举类型,具有以下选项: +- moduleName: string type, module name +- option: interface{} type, module Parameter +- moduleType: enumerated type, with the following options: -Python -Cpp - -Go -- modulePath: 字符串类型,模块文件所在的路径 -- moduleEntry: 字符串类型,模块入口 + - Go +- modulePath: string type, the path where the module file is located +- moduleEntry: string type, module entry Return: -- *BMFModuleInstance: 结构体指针类型,是指向 C 语言模块对象的封装结构体的指针 -- error: error 类型,当 C Graph 结构为空时,会报错 +- *BMFModuleInstance: structure pointer type, which is a pointer to the encapsulation structure of the C language module object +- error: error type, when the C graph structure is empty, an error will be reported ### func (s *BMFStream) Module(inputs []*BMFStream, moduleName string, moduleType BMFModuleType, modulePath string, moduleEntry string, option interface{}, preModule *CBMFModule) *BMFNode -注意: 该接口与普通模式下的模块接口的区别在于调用者是 BMFStream 而不是 BMFGraph。 -当调用者为 BMFStream 时,与调用者对应的流将与输入中的其他流合并,共同用作模块的输入流。 +Note: The difference between this interface and the Module interface in normal mode is that the caller is BMFStream instead of BMFGraph. +When the caller is BMFStream, the stream corresponding to the caller will be merged with other streams in inputs, and they will be used as the input stream of the module together. ## Sync mode (see syncMode & syncModeSerial) ### func NewModulefunctor(name, tp, path, entry string, option interface{}, ninputs, nooutputs int32) (*Modulefunctor, error) Para: -- name: string type, Module name字符串类型,模块名称 -- tp: 字符串类型,模块类型(Python,C++,Go) -- Path: 字符串类型,对应模块实施文件的路径 -- entry: 字符串类型,模块入口 -- ninputs: int32 类型,指定输入流的数量 -- nooutputs: int32 类型,注定输出流的数量 +- name: string type, Module name +- tp: string type, Module type (python, c++, go) +- Path: string type, corresponding to the path of the module implementation file +- entry: string type, module entry +- ninputs: int32 type, specifies the number of input streams +- nooutputs: int32 type, specifies the number of output streams Return: -- *Modulefunctor: 实例化的 Modulefunctor -- error: 错误信息,默认为 nil +- *Modulefunctor: the instantiated Modulefunctor +- error: error message, default is nil ### func (self *Modulefunctor) Execute(inputs []*Packet, cleanup bool) (bool, error) Para: -- inputs: *Packet 是元素类型的 slice structure,其中包含要处理的输入数据包 -- cleanup : bool 类型,控制是否清除所有未获取结果 +- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed +- cleanup : bool type, controls whether to clear all un-fetch results Return: -- bool: 操作是否成功,1 表示成功,0 表示失败 -- error: 错误信息,默认为 nil +- bool: Whether the operation is successful, 1 is success, 0 is failed +- error: error message, default is nil ### func (self *Modulefunctor) Fetch(index int) ([]*Packet, error) Para: -- inputs: *Packet 是元素类型的 slice structure,其中包含要处理的输入数据包 -- cleanup : bool 类型,控制是否清除所有未获取结果 +- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed +- cleanup : bool type, controls whether to clear all un-fetch results Return: -- []*Packet: 同步模式模块处理的数据包列表 -- error: 错误信息,默认为 nil +- []*Packet: packet list processed by Sync mode module +- error: error message, default is nil ### func (self *Modulefunctor) Call(inputs []*Packet) ([]*Packet, error) Para: -- inputs: *Packet 是元素类型的 slice structure,其中包含要处理的输入数据包 +- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed Return: -- []*Packet: 同步模式模块处理的数据包列表 -- error: 错误信息,默认为 nil +- []*Packet: packet list processed by Sync mode module +- error: error message, default is nil ### func deleteModulefunctor(o *Modulefunctor) Para: -- o: *Modulefunctor,指向将被释放的 Modulefunctor 实例 \ No newline at end of file +- o: *Modulefunctor, pointing to the Modulefunctor instance that will be free \ No newline at end of file diff --git a/content/en/docs/bmf/api/decode_module/_index.md b/content/en/docs/bmf/api/decode_module/_index.md index 74a015e..c168178 100644 --- a/content/en/docs/bmf/api/decode_module/_index.md +++ b/content/en/docs/bmf/api/decode_module/_index.md @@ -1,11 +1,11 @@ --- -title: '内置解码模块' -linkTitle: '内置解码模块' +title: 'Built-in Decode Module' +linkTitle: 'Built-in Decode Module' weight: 4 --- -这是一个关于 BMF 内置解码器的模块功能说明。通过向配置(如下面的第 3 个参数)提供 json 样式的"选项",BMF API,如 [bmf.decode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#decode) 可以使用该模块: +This is a module capability discrption about BMF build-in decoder. The module can be used by BMF API such as [bmf.decode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#decode) by providing json style "option" to config such as the 3rd parameter below: ``` @@ -14,72 +14,71 @@ bmf.decode( ) ``` -详情: +Details: - module name: c_ffmpeg_decoder - - loglevel: 设置 ffmpeg 库的日志级别,可以是“quiet”、“panic”、“fatal”、“error”、“warning”、“info”、“verbose”、“debug”、“trace” + - loglevel: to set the loglevel of ffmpeg library it can be "quiet","panic","fatal","error","warning","info","verbose","debug","trace" - - map_v: 解码器的视频流索引,例如 0 表示选择 0 号流作为即将解码的视频流。 + - map_v: video stream index for decoder, exp. 0, which mean choose No.0 stream as video stream to be decode. - - map_a: 解码器的音频流索引,例如 1 表示选择 1 号流作为即将解码的音频流。 + - map_a: audio stream index for decoder, exp. 1, which mean choose No.1 stream as audio stream to be decode. - - start_time: 解码开始时间(以秒为单位),例如 1 表示 1 秒后解码帧,类似于 ffmpeg 命令中的 -ss。 + - start_time: decode start time in seconds, exp. 1, which mean just decode the frame after 1 second, similar as -ss in ffmpeg command. - - end_time: 解码结束时间,例如 1 表示只解码 1 秒之前的帧,类似于 ffmpeg 命令中的 -to。 + - end_time: decode end time, exp. 1, which mean just decode the frame before 1 second, just as -to in ffmpeg command. - - durations: 解码多组持续时间帧/样本,例如[1.1,4,6.5,9,12.3,15]。 + - durations: decode multiple group of duration frames/samples, such as [1.1, 4, 6.5, 9, 12.3, 15]. - - fps: 将帧解码为 fps set。 + - fps: decode the frame as the fps set . - - video_time_base: 视频流时基,例如 1/1000 表示设置视频流时基为1/1000。 + - video_time_base: video stream time base, exp. 1/1000, set the video stream timebase as 1/1000. - - skip_frame: 跳帧,例如 32 表示根据选项值进行解码器丢弃处理,就像 ffmpeg commnad 中的 -skip_frame 一样。 AVDISCARD_NONE = -16, ///< 不丢弃任何内容 AVDISCARD_DEFAULT = 0, ///< 丢弃无用的数据包,例如 avi 中 0 大小的数据包 AVDISCARD_NONREF = 8, ///< 丢弃所有非引用 AVDISCARD_BIDIR = 16, ///< 丢弃所有 双向帧 AVDISCARD_NONINTRA= 24, ///< 丢弃所有非帧内帧 AVDISCARD_NONKEY = 32, ///< 丢弃除关键帧之外的所有帧 AVDISCARD_ALL = 48, ///< 丢弃所有 + - skip_frame: skip frame, exp. 32, make decoder discard processing depending on the option value, just as -skip_frame in ffmpeg commnad. AVDISCARD_NONE = -16, ///< discard nothing AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi AVDISCARD_NONREF = 8, ///< discard all non reference AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames AVDISCARD_NONINTRA= 24, ///< discard all non intra frames AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes AVDISCARD_ALL = 48, ///< discard all - - video_codec: 视频编解码器名称,例如 libx264,设置视频流的特定编解码器。 设置为 “copy” 时为流复制 + - video_codec: video codec name, exp. libx264, set the specific codec for video stream. it will be stream copy when it set to be "copy" - - overlap_time: 用于解码直播流,如果直播流中断,如果下一个数据包的 pts 重叠小于重叠时间,我们将删除重叠数据包。默认值为 10 + - overlap_time, which is used in decode live stream, if the live stream cut off, if the next packet pts is overlap smaller than overlap time, we will remove the overlap packet. default value is 10 - - cut_off_time: 用于解码直播流,如果直播流中断,当下一个 packet pts 大于最后一个 pts + cut_off_time 时,我们将调整 pts 以避免大的中断。 否则我们使用 packet pts + - cut_off_time, which is used in decode live stream ,if the live stream cut off, when the next packet pts is larger than last pts + cut_off_time, we will adjust pts to avoid large cut off. else we use the packet pts. - - cut_off_interval: 用于解码直播流,如果直播流中断,当下一个 packet pts 大于最后一个 pts + cut_off_time 时,我们将调整 pts 以避免大的中断。 否则我们使用 packet pts + - cut_off_interval.which is used in decode live stream ,if the live stream cut off, when the next packet pts is larger than last pts + cut_off_time, we will adjust pts to avoid large cut off. else we use the packet pts. - - vframes: 设置要输出的视频帧数 + - vframes: set the number of video frames to output - - aframes: 设置要输出的音频帧数 + - aframes: set the number of audio frames to output - - copyts: 复制 timestamps + - copyts: copy timestamps - - max_width_height: 设置输入框的最大宽度或高度限制。启用后,默认情况下会丢弃帧,或者根据 “limit_hits” 抛出 + - max_width_height: set the max width or height limitation of input frame. Once it's enabled, frame will be dropped by default or it will throw exp according to "limit_hits" - - max_limit_hits: 设置最大命中次数限制,一旦超过就会抛出 + - max_limit_hits: set the max number of limit hits, once exceeded the exp will be threw - - hwaccel: 硬件加速,例如 cuda + - hwaccel: hardware accelete exp. cuda. + - extract_frames: support extract frames with given fps and device. - - extract_frames: 支持使用给定的 fps 和设备提取帧 + - audio_codec: audio codec name, exp. aac, set the specific codec for audio stream. - - audio_codec: 音频编解码器名称,例如 aac 表示设置音频流的特定编解码器 + - dec_params: set the decode codec parameters, such as "threads": 1 - - dec_params: 设置解码编解码参数,如 “threads”:1 + - autorotate: to enable/disable autorotate for the input video if needed, it's enabled by default - - autorotate: 如果需要,可以启用或禁用输入视频的自动旋转,默认情况下启用 + - s: video size, exp. "1280:720". - - s: 视频尺寸,例如 "1280:720" + - pix_fmt: pixel format, exp. "rgba". - - pix_fmt: 像素格式,例如 "rgba" + - input_path: decode input file,exp. "1.mp4". - - input_path: 解码输入文件,例如 "1.mp4" + - push_raw_stream: enable raw stream push mode, exp. 1 - - push_raw_stream: 启用原始流推送模式,例如 1 + - channels: audio channels (required for audio push mode) - - channels: 音频通道(音频推送模式所需) + - sample_rate: audio sample rate (required for audio push mode) - - sample_rate: 音频采样率(音频推送模式所需) + - sample_fmt: audio sample format (used for audio push mode - optional) - - sample_fmt: 音频样本格式(用于音频推送模式 - 可选) + - orig_pts_time: keep the original pts time of inputstream in the frame - - orig_pts_time: 在帧中保留输入流的原始 pts 时间 - -### 内置解码模块 +### Build-in Decode Module diff --git a/content/en/docs/bmf/api/encode_module/_index.md b/content/en/docs/bmf/api/encode_module/_index.md index e4516e5..8ffbc8b 100644 --- a/content/en/docs/bmf/api/encode_module/_index.md +++ b/content/en/docs/bmf/api/encode_module/_index.md @@ -1,10 +1,10 @@ --- -title: '内置编码模块' -linkTitle: '内置编码模块' +title: 'Built-in Encode Module' +linkTitle: 'Built-in Encode Module' weight: 5 --- -这是一个关于 BMF 内置编码器的模块功能说明。通过向配置(如下面的第 3 个参数)提供 json 样式的"选项",BMF API,如[bmf.encode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#encode)可以使用该模块: +This is a module capability discrption about BMF build-in encoder. The module can be used by BMF API such as [bmf.encode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#encode) by providing json style "option" to config such as the 3rd parameter below: ``` @@ -30,16 +30,17 @@ bmf.encode( ) ``` -详情: +Details: - module name: c_ffmpeg_encoder - - null_output: 在某些情况下使编码器作为 null sink,"null_output": 1。 - - output_path: 输出文件路径,例如 out.mp4,可表明文件的输出格式,类似于 ffmpeg。 + - null_output: to make encoder as a null sink in some cases. "null_output": 1 - - adjust_pts: 启用后,将从 0 开始调整 pts + - output_path: output file path, exp. out.mp4, which can indicate the output format of the file similiar as ffmpeg. - - format: 类似于 ffmpeg 命令行中的 “-f”,用于指定解复用/复用格式。 + - adjust_pts: will adjust the pts start from 0 when it's enabled + + - format: similiar as the "-f" in ffmpeg command line to specify the demux/mux format. exp. ``` { "format": "flv", @@ -49,23 +50,23 @@ bmf.encode( ``` - - output_prefix: 指定输出目录路径 + - output_prefix: specify the output directory path - - push_output: 决定是否复用结果以及将结果输出到哪里,可用值为 0/1/2。 0:将复用结果写入磁盘,1:将复用结果写入输出队列,2:将未复用结果写入输出队列。 + - push_output: decide whether to mux the result and where to output the results, available value is 0/1/2. 0: write muxed result to disk, 1: write muxed result to the output queue, 2: write unmuxed result to the output queue. ``` "push_output": 1 ``` - - avio_buffer_size: 设置 avio 缓冲区大小,当格式为 image2pipe 时,此参数有用,例如: + - avio_buffer_size: set avio buffer size, when oformat is image2pipe, this paramter is useful, exp. ``` "avio_buffer_size": 16384 ``` - - mux_params: 指定额外输出复用参数,例如: + - mux_params: specify the extra output mux parameters, exp. ``` "format": "hls", "mux_params": { @@ -77,7 +78,7 @@ bmf.encode( ``` - - video_params: 视频编解码相关的参数,类似于 FFmpeg,例如: + - video_params: video codec related parameters which similiar as ffmpeg. exp. ``` "video_params": { "codec": "h264", @@ -89,24 +90,22 @@ bmf.encode( ``` - - - metadata: 在输出文件文件中添加用户 metadata - - - vframes: 设置输出视频帧的数量 - - aframes: 设置输出音频帧的数量 + - metadata: to add user metadata in the outfile - - min_frames: 设置输出视频帧的最小数量 + - vframes: set the number of video frames to output - - codec: video_params 或 audio_params 中的参数,用于指定 libavcodec 包含的编解码器名称。例如:"h264"、"bytevc1"、"jpg"、"png"、"aac"(音频) + - aframes: set the number of audio frames to output - - width: video_params 中的参数,用于指定视频宽度 + - min_frames: set the min number of output video frames - - height: video_params 中的参数,用于指定视频高度 + - codec: param in video_params or audio_params to specify the name of the codec which libavcodec included. exp. "h264", "bytevc1", "jpg", "png", "aac"(audio) - - pix_fmt: video_params 中的参数,用于指定原始视频的输入格式 + - width: param in video_params to specify the video width + - height: param in video_params to specify the video height + - pix_fmt: param in video_params to specify the input format of raw video - - audio_params: 与 ffmpeg 类似的音频编解码器相关参数。例如: + - audio_params: audio codec related parameters which similiar as ffmpeg. exp. ``` "audio_params": { "codec": "aac", @@ -118,32 +117,34 @@ bmf.encode( ``` - - loglevel: 不使用 builder API 的 logbuffer,设置 ffmpeg av 日志级别:“quiet”,“panic”,“fatal”,“error”,“warning”,“info”,“verbose”,“debug”,“trace ” + - loglevel: without using the logbuffer of builder API, to set the ffmpeg av log level: "quiet","panic","fatal","error","warning","info","verbose","debug","trace" + + - threads: specify the number of threads for encoder, "auto" by default, and other for example: "threads": "2" - - threads: 指定编码器的线程数,默认为 "auto",其它示例:"线程":"2" + - psnr: to set encoder provide psnr information - - psnr: 设置编码器,提供 PSNR 信息 + - in_time_base: to set time base manually - - in_time_base: 手动设置 time base + - vsync: to set the video sync method on frame rate, "auto" by default. and it can be "cfr", "vfr", "passthrough", "drop" similar as ffmpeg - - vsync: 设置帧率的视频同步方法,默认为“自动”。 它可以是 “cfr”,“vfr”,“passthrough”,“drop”,类似于 ffmpeg + - max_fr: to set the frame rate - - max_fr: 设置帧率,类似于 FFmpeg + - max_fr: to set the frame rate, similar as ffmpeg - - qscal: 设置编码器 global_quality 的 qscale + - qscal: to set the qscale for the encoder global_quality - - vtag: 设置输出流的 vtag + - vtag: to set the vtag for output stream - - bit_rate or b: 设置视频编码的比特率 + - bit_rate or b: to set the bitrate for video encode - - channels: 设置输入音频的通道 + - channels: to set the channels for input audio - - bit_rate or b: 设置音频编码的 bit_rate + - bit_rate or b: to set the bit_rate for audio encode - - sample_rate: 设置音频编码的 sample_rate + - sample_rate: to set the sample_rate for audio encode - - atag: 设置输出流的 atag + - atag: to set the atag for output stream -### 内置编码模块 +### Build-in Encode Module diff --git a/content/en/docs/bmf/api/filter_module/_index.md b/content/en/docs/bmf/api/filter_module/_index.md index b256065..5df98e0 100644 --- a/content/en/docs/bmf/api/filter_module/_index.md +++ b/content/en/docs/bmf/api/filter_module/_index.md @@ -4,7 +4,7 @@ linkTitle: 'Built-in Filter Module' weight: 6 --- -这是一个关于 BMF 内置 Filter 模块的功能描述。通过提供 ffmpeg 命令行样式的参数来配置 filtergraph,该模块可用于模块相关的 BMF API,如[bmf.concat()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#concat): +This is a module capability discrption about BMF build-in filter. The module can be used by Module Related BMF API such as [bmf.concat()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#concat) by providing ffmpeg command line style parameters to config the filtergraph: ``` @@ -32,7 +32,7 @@ concat_audio = ( ) ``` -另一种常见的方式是,用户可以创建 ffmpeg libavfilter 包含的任何 filter 流。 例如: +And in another common way, users can create any filter stream which ffmpeg libavfilter included. exp.: ``` @@ -42,76 +42,77 @@ ff_filter('unsharp', '5:5:1') - module name: c_ffmpeg_filter -### 内置 filter 模块 +### Build-in Filter Module -## GPU Filter 模块 -BMF 提供了几种常用的 GPU 加速的 filter 模块: +## GPU Filter Module + +BMF provides several common filtering modules accelerated by GPU: - scale - flip - rotate - crop - blur -这些模块模块位于 bmf/example/gpu_module/ 中。`test_gpu_module.py` 这个示例代码展示了如何使用这些模块。你也可以通过 Colab 体验它们 [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/eefengwei/colab_tutorials/blob/main/colab_tutorial_cd.ipynb)。该模块接受 nv12/yuv420p/rgb 格式,每个组件 8 或 10 位。 +These modules are located in bmf/example/gpu_module/. The demo code showing how to use these modules is in `test_gpu_module.py`. You can also try them on Colab [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/eefengwei/colab_tutorials/blob/main/colab_tutorial_cd.ipynb). The modules accept nv12/yuv420p/rgb formats with 8/10 bits per component. ### Scale -scale 模块可以调整图像的大小。 +The scale module can resize an image. -**Scale 选项** +**Scale Options** -***size***: 图像的目标尺寸,格式可以是 `WxH`,`W*H` 或 `W,H` +***size***: Target size of the image, can be of format `WxH`, `W*H` or `W,H` -***algo***: (可选的):插值算法,可以是 `area`、`cubic`、`linear` 和 `nearest` 之一。 如果未指定,则默认使用 `linear`。 +***algo***(optional): Interpretation algorithm, can be one of `area`, `cubic`, `linear` and `nearest`. If unspecified, `linear` will be used by default. ### Flip -沿指定方向翻转图像。 +Flip the image in the specified direction. -**Flip 选项** +**Flip Options** -***direction***: 翻转的方向。 支持 `h`,`horizontal`,`v`,`vertical` 或 `both`(垂直和水平翻转)。 例如 `.module('flip_gpu', {'direction': 'v'})` 垂直翻转图像 +***direction***: The direction of the flip. Supports `h`, `horizontal`, `v`, `vertical` or `both` (flip both vertically and horizontally). E.g. `.module('flip_gpu', {'direction': 'v'})` flips the image vertically ### Rotate -将图像旋转一定角度。角度可以表示为度数或弧度。默认情况下,图像将围绕图像中心旋转。注意,空白区域将填充 0。旋转不会改变图像的宽高比,例如如果将 1920x1080 图像旋转 90 度,输出图像仍然是 1920x1080 而不是 1080x1920。 +Rotate the image in a certain angle. The angle can be represented as degrees or radians. By default, the image will be rotated around the image center. Note that the empty area will be fill with 0. Rotation will not change the aspect ratio of the image, i.e. if you rotate a 1920x1080 image by 90 degrees, the output image is still 1920x1080 rather than 1080x1920 -**Rotate 选项** +**Rotate Options** -***angle_deg***: 旋转的角度。正角度值将顺时针旋转图像,负角度值将逆时针旋转图像。角度可以是浮点值。 +***angle_deg***: The angle of the rotation. A positive angle value will rotate the image clockwise, a negative angle value anti-clockwise. The angle can be a floating point value. -***angle***: 旋转半径。例如设置 `{'angle': 'pi/8'}` 将有效地将图像顺时针旋转 45 度。 +***angle***: The radius of the rotation. e.g. setting `{'angle': 'pi/8'}` will effectively rotate the image by 45 degrees clockwise. -***center***: 图像旋转的中心点。默认情况下,中心点是图像中心点 `w/2,h/2`,其中 `w` 和 `h` 是图像的宽度和高度。 +***center***: The point around which the image is rotated. By default, the center is the image center `w/2,h/2`, where `w` and `h` are the width and height of the image. -***scale***: 图像的缩放因子。默认值为 `1`,表示不缩放图像。`{'scale': 1.5}` 表示将图像放大 1.5 倍。 +***scale***: Scaling factor of the image. Default is `1`, which means do not scale the image. `{'scale': 1.5}` will zoom in the image by 1.5x. -***algo***: 插值算法。支持 `'cubic'`、`'linear'` 和 `'nearest'`。 +***algo***: Interpolation algorithm. Supports `'cubic'`, `'linear'` and `'nearest'`. ### Crop -将输入图像裁剪成指定大小。示例: `module('crop_gpu', {'x': 960, 'y': 540, 'width': 640, 'height': 480})` +Crops the input image into the given size. Example: `module('crop_gpu', {'x': 960, 'y': 540, 'width': 640, 'height': 480})` -**Crop 选项** +**Crop Options** -***x, y***: 裁剪区域左上角的坐标。 +***x, y***: The coordinate of the cropping area's upper-left corner. -***width, height***: 裁剪区域的宽度和高度。 +***width, height***: Width and height of the cropping area. ### Blur -使用支持的算法(高斯、平均和中值)之一对输入图像进行模糊处理。高斯模糊示例:`module('blur_gpu', {'op': 'gblur', 'sigma': [0.7, 0.7], 'size': [5, 5]})` +Blur the input image using one of the supported algorithm (gaussian, average and median). Gaussian blur example: `module('blur_gpu', {'op': 'gblur', 'sigma': [0.7, 0.7], 'size': [5, 5]})` -**Blur 选项** +**Blur Options** -***op***: 要使用的模糊算法。支持 `'gblur'`(高斯模糊)、`'avgblur'`(平均模糊)和 `'median'`(中值模糊)。 +***op***: The blur algorithm to be used. Supports `'gblur'` (gaussian blur), `'avgblur'` (average blur) and `'median'` (median blur). -***size***: 模糊内核的宽度和高度。格式应为 `[W,H]`。默认大小为 `[1, 1]` 该选项适用于所有模糊算法。 +***size***: The width and height of the blur kernel. Should be of format `[W, H]`. Default size is `[1, 1]` This option applies to all blur algorithms. -***planes***: 指定应模糊哪个图像平面。该值应是位掩码,例如,如果要模糊 yuv420p 图像的所有三个平面,应设置 `'planes': 0x7` 或 `'planes': 0b111`. 默认值为 `0xf`。此选项适用于所有模糊算法。 +***planes***: Specifies which image plane should be blurred. The value should be a bit mask, e.g. if you want to blur all three planes of a yuv420p image, you should set `'planes': 0x7` or `'planes': 0b111`. Default value is `0xf`. This option applies to all blur algorithms. -***sigma***: 高斯核标准偏差。格式应为 `[X,Y]`,浮点数据类型。该选项仅适用于 `gblur` 操作。 +***sigma***: Gaussian kernel standard deviation. Should be of format `[X, Y]`, float data type. This option only applies to the `gblur` op. -***anchor***: 内核锚点。表示过滤点在内核中的相对位置。格式应为 `[X,Y]`。默认为 `[-1, -1]` 表示内核中心。此选项仅适用于 `avgblur` 操作。 +***anchor***: Kernel anchor. Indicates the relative position of a filtered point within the kernel. Should be of format `[X, Y]`. Default is `[-1, -1]` which indicates kernel center. This option only applies to `avgblur` op. -***radius***: ***size*** 选项的别名。半径只适用于 `median` 操作。 \ No newline at end of file +***radius***: Alias for the ***size*** option. Radius only applies to `median` op. \ No newline at end of file diff --git a/content/en/docs/bmf/api/loglevel/_index.md b/content/en/docs/bmf/api/loglevel/_index.md index 1890dea..21bcbce 100644 --- a/content/en/docs/bmf/api/loglevel/_index.md +++ b/content/en/docs/bmf/api/loglevel/_index.md @@ -1,12 +1,12 @@ --- -title: '日志级别' -linkTitle: '日志级别' +title: 'Loglevel' +linkTitle: 'Loglevel' weight: 7 --- -## 日志级别 +## LogLevel -如果要修改内置模块中与 FFmpeg 相关的日志级别,请在构建 graph 时传递日志级别参数。下面的示例将解码器的日志级别设为 quiet,将编码器的日志级别设为 debug。 +If you want to modify the loglevel related to FFmpeg in the built-in Module, please pass the loglevel parameter when building the graph. The following example sets the loglevel of decoder to quiet and the loglevel of encoder to debug. ``` graph = bmf.graph() @@ -21,6 +21,6 @@ weight: 7 }) ``` -BMF 框架也有自己的日志和日志级别。BMF 的日志默认设置为 INFO,如果要修改,请使用 ENV: +The BMF framework also has its own log and loglevel. For the log from BMF, it's set to INFO default, if you want to modify, please use the ENV: ```export BMF_LOG_LEVEL=WARNING/INFO/ERROR/FATAL/DISABLE``` \ No newline at end of file diff --git a/content/zh/.DS_Store b/content/zh/.DS_Store index 1bd3684..e0d211b 100644 Binary files a/content/zh/.DS_Store and b/content/zh/.DS_Store differ diff --git a/content/zh/docs/.DS_Store b/content/zh/docs/.DS_Store new file mode 100644 index 0000000..6b1458c Binary files /dev/null and b/content/zh/docs/.DS_Store differ diff --git a/content/zh/docs/bmf/.DS_Store b/content/zh/docs/bmf/.DS_Store new file mode 100644 index 0000000..684391d Binary files /dev/null and b/content/zh/docs/bmf/.DS_Store differ diff --git a/content/zh/docs/bmf/api/api_in_cpp/audio_frame/_index.md b/content/zh/docs/bmf/api/api_in_cpp/audio_frame/_index.md index c5cfb2b..dff631d 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/audio_frame/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/audio_frame/_index.md @@ -7,11 +7,11 @@ weight: 1 [//]: <> (REF_MD: classbmf__sdk_1_1AudioFrame.html) - [Public Member Functions](#public-member-functions) | [Static Public Member Functions](#static-public-member-functions) # bmf_sdk::AudioFrame Class Reference + [公共成员函数](#public-member-functions) | [静态公共成员函数](#static-public-member-functions) # bmf_sdk::AudioFrame Class Reference audio_frame.h - ## Public Member Functions + ## 公有成员函数 [AudioFrame](#audioframe-15) ()=default @@ -106,7 +106,7 @@ bool [operator<=](https://babitmf.github.io/docs/bmf/api/api_in_cpp/sequenceda - ## Static Public Member Functions + ## 静态共有成员函数 static [AudioFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/audio_frame/) [make](#make-13) (int samples, uint64_t [layout](#layout) , bool [planer](#planer) =true) @@ -117,7 +117,7 @@ static [AudioFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/audio_fra static [AudioFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/audio_frame/) [make](#make-33) (const TensorList &data, uint64_t [layout](#layout) , bool [planer](#planer) =true) - ## Additional Inherited Members + ## 其它继承成员 ![img](/img/docs/closed.png) @@ -129,7 +129,7 @@ virtual void [set_private_data](https://babitmf.github.io/docs/bmf/api/api_in_ virtual const OpaqueData & [private_data](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#private_data) (int key) const -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  AudioFrame() [1/5] @@ -186,7 +186,7 @@ bmf_sdk::AudioFrame::AudioFrame ( const TensorList & data, bool planer = true ) ``` -## Member Function Documentation +## 成员函数文档 ###  clone() @@ -200,7 +200,8 @@ bmf_sdk::AudioFrame::AudioFrame ( const TensorList & data, ``` AudioFrame & bmf_sdk::AudioFrame::copy_props( const AudioFrame &from ) ``` -copy all extra props(set by member func set_xxx) from `from` (deepcopy if needed), **Parameters** +复制来自 `from` 的所有额外 prop(由成员 func set_xxx 设置,(如需要可深度复制)。 +**Parameters** - **from** diff --git a/content/zh/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md b/content/zh/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md index 80e91bf..1b29d54 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/bmfavpacket/_index.md @@ -7,13 +7,13 @@ weight: 2 [//]: <> (REF_MD: classbmf__sdk_1_1BMFAVPacket.html) - [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-member-functions) | [Static Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#static-public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-attributes) # bmf_sdk::BMFAVPacket Class Reference + [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-member-functions) | [静态公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#static-public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/#public-attributes) # bmf_sdk::BMFAVPacket Class Reference bmf_av_packet.h! ! - ## Public Member Functions + ## 公有成员函数 [BMFAVPacket](#bmfavpacket-15) ()=default @@ -111,14 +111,14 @@ bool [operator<=](https://babitmf.github.io/docs/bmf/api/api_in_cpp/sequenceda - ## Static Public Member Functions + ## 静态公有成员函数 static [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) [make](#make) (int size, Options &&...opts) - ## Public Attributes + ## 公共属性 int64_t [offset_](#offset_) @@ -126,7 +126,7 @@ int64_t [offset_](#offset_) int [whence_](#whence_) - ## Additional Inherited Members + ## 其它继承成员 ![img](/img/docs/closed.png) @@ -138,7 +138,7 @@ virtual void [set_private_data](https://babitmf.github.io/docs/bmf/api/api_in_ virtual const OpaqueData & [private_data](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#private_data) (int key) const -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  BMFAVPacket() [1/5] @@ -182,10 +182,9 @@ bmf_sdk::BMFAVPacket::BMFAVPacket ( BMFAVPacket && ) ``` bmf_sdk::BMFAVPacket::BMFAVPacket ( const Tensor & data ) ``` -Construct a new [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) object. - +构建一个新的 [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) 对象。 **Parameters** - - **data** contiguous tensor data, cpu only + - **data**:连续张量数据,仅限 cpu @@ -197,15 +196,14 @@ bmf_sdk::BMFAVPacket::BMFAVPacket ( int size, const TensorOptions & options = kUInt8 ) ``` -Construct a new [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) object. - +构建一个新的 [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) 对象。 **Parameters** - **size** - - **options** ref [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) + - **options**:参考 [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) -## Member Function Documentation +## 成员函数文档 ###  copy_props() @@ -213,7 +211,8 @@ Construct a new [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp ``` BMFAVPacket & bmf_sdk::BMFAVPacket::copy_props( const BMFAVPacket &from ) ``` -copy all extra props(set by member func set_xxx) from `from` (deepcopy if needed), **Parameters** +从`from`复制所有额外的 props(由成员函数 set_xxx 设置)(如果需要则进行深复制) +**Parameters** - **from** @@ -245,7 +244,7 @@ const Tensor& bmf_sdk::BMFAVPacket::data ( ) const ``` void* bmf_sdk::BMFAVPacket::data_ptr ( ) ``` -return raw pointer of underlying data +返回底层数据的原始指针 **Returns** @@ -265,7 +264,7 @@ const void* bmf_sdk::BMFAVPacket::data_ptr ( ) const ``` int64_t bmf_sdk::BMFAVPacket::get_offset ( ) const ``` -get the current data offset which is file write pointer offset +获取当前数据偏移量,即文件的 write pointer 偏移量 **Returns** @@ -276,8 +275,7 @@ get the current data offset which is file write pointer offset ``` int bmf_sdk::BMFAVPacket::get_whence ( ) const ``` -get the data whence which is mode. whence == SEEK_SET, from begin; whence == SEEK_CUR, current - +获取来自 mode 的数据。whence == SEEK_SET, from begin; whence == SEEK_CUR, current **Returns** @@ -304,7 +302,7 @@ static **Parameters** - **size** - - **opts** ref [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) + - **opts**:参考 [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) @@ -325,7 +323,7 @@ static ``` int bmf_sdk::BMFAVPacket::nbytes ( ) const ``` -number of bytes of underlying data +底层数据的字节数 **Returns** @@ -336,7 +334,7 @@ number of bytes of underlying data ``` bmf_sdk::BMFAVPacket::operator bool ( ) const ``` -check if [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) if defined +检查 [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavpacket/) 是否已定义。 **Returns** @@ -360,7 +358,7 @@ check if [BMFAVPacket](https://babitmf.github.io/docs/bmf/api/api_in_cpp/bmfavp ``` void bmf_sdk::BMFAVPacket::set_offset ( int64_t offset ) ``` -set the current data offset which is file write pointer offset +设置当前数据偏移量,即文件的 write pointer 偏移量 **Returns** @@ -371,12 +369,12 @@ set the current data offset which is file write pointer offset ``` void bmf_sdk::BMFAVPacket::set_whence ( int whence ) ``` -set the data whence which is mode. whence == SEEK_SET, from begin; whence == SEEK_CUR, current +设置数据来源,即 mode。whence == SEEK_SET, from begin; whence == SEEK_CUR, current **Returns** -## Member Data Documentation +## 成员函数文档 ###  offset_ diff --git a/content/zh/docs/bmf/api/api_in_cpp/exception/_index.md b/content/zh/docs/bmf/api/api_in_cpp/exception/_index.md index a7e1ac0..8ce87f1 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/exception/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/exception/_index.md @@ -7,7 +7,7 @@ weight: 3 [//]: <> (REF_MD: classException.html) - [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-attributes) | List of all members # Exception Class Reference + [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-member-functions) | [公共属性](https://babitmf.github.io/docs/bmf/api/api_in_cpp/exception/#public-attributes) | List of all members # Exception Class Reference Class passed to an error. [More...](page_classexception_v3_0_0#details) @@ -15,7 +15,7 @@ exception_factory.h![img](/img/docs/classException__inherit__graph.png) ![img](/img/docs/classException__coll__graph.png) - ## Public Member Functions + ## 公有成员函数 [Exception](#exception-12) () @@ -29,7 +29,7 @@ virtual const char * [what](#what) () const throw () void [formatMessage](#formatmessage) () - ## Public Attributes + ## 公共属性 std::string [msg](#msg) @@ -51,16 +51,16 @@ int [line](#line) -## Detailed Description +## 详细描述 -Class passed to an error. +Class 传递一个错误。 -This class encapsulates all or almost all necessary information about the error happened in the program. The exception is usually constructed and thrown implicitly via BMF_Error +该 class 封装了有关程序中发生的错误的所有或几乎所有必要的信息。异常通常是通过 BMF_Error 隐式构造和抛出的。 **See also** error -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  Exception() [1/2] @@ -68,7 +68,7 @@ This class encapsulates all or almost all necessary information about the error ``` Exception::Exception ( ) ``` -Default constructor +默认构造函数 ###  Exception() [2/2] @@ -81,7 +81,7 @@ Exception::Exception ( int _code, int _line ) ``` -Full constructor. Normally the constructor is not called explicitly. Instead, the macros BMF_Error() , BMF_Error_() are used. +完整的构造函数。通常构造函数不会被显式调用。而是使用宏 BMF_Error()、BMF_Error_()。 ###  ~Exception() @@ -97,7 +97,7 @@ throw ( -## Member Function Documentation +## 成员函数文档 ###  formatMessage() @@ -122,7 +122,7 @@ throw ( **Returns** -## Member Data Documentation +## 成员数据文档 ###  code @@ -130,7 +130,7 @@ throw ( ``` int Exception::code ``` -error code +错误代码 **See also** BMFStatus @@ -141,7 +141,7 @@ error code ``` std::string Exception::err ``` -error description +错误描述 ###  file @@ -149,7 +149,7 @@ error description ``` std::string Exception::file ``` -source file name where the error has occurred +发生错误的源文件名 ###  func @@ -157,7 +157,7 @@ source file name where the error has occurred ``` std::string Exception::func ``` -function name. Available only when the compiler supports getting it +函数名称。仅当编译器支持获取时可用 ###  line @@ -165,7 +165,7 @@ function name. Available only when the compiler supports getting it ``` int Exception::line ``` -line number in the source file where the error has occurred +发生错误的源文件中的行号 ###  msg @@ -173,7 +173,7 @@ line number in the source file where the error has occurred ``` std::string Exception::msg ``` -the formatted error message +格式化的错误消息 - /20230627/doxygen_converter/bmf/bmf/sdk/cpp_sdk/include/bmf/sdk/ exception_factory.h diff --git a/content/zh/docs/bmf/api/api_in_cpp/future/_index.md b/content/zh/docs/bmf/api/api_in_cpp/future/_index.md index de5e3c4..ecf314d 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/future/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/future/_index.md @@ -7,11 +7,11 @@ weight: 13 [//]: <> (REF_MD: classbmf__sdk_1_1Future.html) - [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/future/#public-member-functions) | List of all members # bmf_sdk::Future Class Referenceabstract + [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/future/#public-member-functions) | List of all members # bmf_sdk::Future Class Referenceabstract sdk_interface.h! - ## Public Member Functions + ## 公有成员函数 [Future](#future-13) () @@ -45,7 +45,7 @@ void [synchronize](#synchronize) () -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  Future() [1/3] @@ -96,7 +96,7 @@ virtual  {}; ``` -## Member Function Documentation +## 成员函数文档 ###  copy_props() @@ -104,8 +104,7 @@ virtual ``` Future & bmf_sdk::Future::copy_props( const Future &from ) ``` -util function to copy props - +util 函数复制 props **Parameters** - **from** @@ -151,7 +150,7 @@ Implemented in [bmf_sdk::VideoFrame](https://babitmf.github.io/docs/bmf/api/api ``` bool bmf_sdk::Future::ready ( ) const ``` -check if result is ready, must be called after [record()](#record) +检查结果是否准备好,必须在 [record()](#record) 之后调用 **Returns** @@ -163,9 +162,9 @@ check if result is ready, must be called after [record()](#record) ``` void bmf_sdk::Future::record ( bool use_current = true ) ``` -record a event to track the readiness of the data +记录时间以跟踪数据的准备情况 -use current stream or self->stream +使用当前的 stream 或 self->stream ###  set_stream() @@ -173,7 +172,7 @@ use current stream or self->stream ``` void bmf_sdk::Future::set_stream ( uint64_t stream ) ``` -Set the stream object, device specific stream handle currently, only cuda stream handle(cudaStream_t) is suporrted, we only take the ref of this stream, the ownership of this stream is still belongs to caller. +设置 stream object,当前设备特定的 stream handle,只有 cuda stream handle(cudaStream_t)被取代,我们只获取该 stream 的 ref,该 stream 的所有权仍属于调用者。 **Parameters** - **stream** diff --git a/content/zh/docs/bmf/api/api_in_cpp/jsonparam/_index.md b/content/zh/docs/bmf/api/api_in_cpp/jsonparam/_index.md index 61aec12..c6ee742 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/jsonparam/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/jsonparam/_index.md @@ -7,7 +7,7 @@ weight: 4 [//]: <> (REF_MD: classJsonParam.html) - [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-attributes) | [List of all members](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/) # JsonParam Class Reference + [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-member-functions) | [公共属性](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/#public-attributes) | [成员清单](https://babitmf.github.io/docs/bmf/api/api_in_cpp/jsonparam/) # JsonParam Class Reference json_param.h ## Public Member Functions @@ -91,13 +91,13 @@ void [merge_patch](#merge_patch) (const [JsonParam](https://babitmf.github.io/ - ## Public Attributes + ## 公共属性 bmf_nlohmann::json [json_value_](#json_value_) -## Constructor & Destructor Documentation +## 构造函数和析构函数 ###  JsonParam() [1/4] @@ -120,7 +120,7 @@ JsonParam::JsonParam ( ) JsonParam::JsonParam ( const JsonParam &json_param ) ``` **Parameters** - - **json_param** copy json_param + - **json_param**:复制 json_param @@ -131,7 +131,7 @@ JsonParam::JsonParam ( const JsonParam &json_param ) JsonParam::JsonParam ( std::string opt_str ) ``` **Parameters** - - **opt_str** content of json string + - **opt_str**:json string 的内容 @@ -152,7 +152,7 @@ JsonParam::JsonParam ( bmf_nlohmann::json json_value ) -## Member Function Documentation +## 成员函数文档 ###  dump() @@ -160,7 +160,7 @@ JsonParam::JsonParam ( bmf_nlohmann::json json_value ) ``` std::string JsonParam::dump ( ) const ``` -dump json object to string +将 json object 传输到 string **Returns** @@ -171,10 +171,10 @@ dump json object to string ``` int JsonParam::erase ( std::string name ) ``` -erase the key content from json param +删除 json 参数中的关键内容 **Parameters** - - **name** name of key + - **name**:key 的名称 @@ -208,11 +208,11 @@ int JsonParam::get_double ( std::string name, double & result ) ``` -get double value according to the key name +根据 key 的名称获取 double value **Parameters** - - **name** name of key - - **result** result of double + - **name**:key 的名称 + - **result**:double 的结果 @@ -227,11 +227,11 @@ int JsonParam::get_double_list ( std::string name, std::vector< double > & result ) ``` -get double value list according to the key name +根据 key 的名称获取 double value list **Parameters** - - **name** name of key - - **result** result of doule list + - **name**:key 的名称 + - **result** doule list 的结果 @@ -246,11 +246,11 @@ int JsonParam::get_float ( std::string name, float & result ) ``` -get float value according to the key name +根据 key 的名称获取 float value **Parameters** - - **name** name of key - - **result** result of float + - **name**:key 的名称 + - **result**:float 的结果 @@ -265,11 +265,11 @@ int JsonParam::get_float_list ( std::string name, std::vector< float > & result ) ``` -get float value list according to the key name +根据 key 的名称获取 float value list **Parameters** - - **name** name of key - - **result** result of float list + - **name**:key 的名称 + - **result**:float list 的结果 @@ -284,11 +284,11 @@ int JsonParam::get_int ( std::string name, int & result ) ``` -get int according to the key name +根据 key 的名称获取 int **Parameters** - - **name** name of key - - **result** result of int + - **name**:key 的名称 + - **result**:int 的结果 @@ -303,11 +303,11 @@ int JsonParam::get_int_list ( std::string name, std::vector< int > & result ) ``` -get int value list according to the key name +根据 key 的名称获取int value list **Parameters** - - **name** name of key - - **result** result of int list + - **name**:key 的名称 + - **result**:int list 的结果 @@ -320,10 +320,10 @@ get int value list according to the key name ``` int JsonParam::get_iterated ( std::vector< std::pair< std::string, std::string >> & group ) ``` -get all content from json param +参数中获取所有内容 **Parameters** - - **name** name of key + - **name**:key 的名称 @@ -338,11 +338,11 @@ int JsonParam::get_long ( std::string name, int64_t & result ) ``` -get long value according to the key name +根据 key 的名称获取 long value **Parameters** - - **name** name of key - - **result** result of long + - **name**:key 的名称 + - **result**:long 的结果 @@ -357,11 +357,11 @@ int JsonParam::get_object ( std::string name, JsonParam &result ) ``` -get json object according to the key name +根据 key 的名称获取 json object **Parameters** - - **name** name of key - - **result** result of json object + - **name**:key 的名称 + - **result**:json object 的结果 @@ -376,11 +376,11 @@ int JsonParam::get_object_list ( std::string name, std::vector< JsonParam > &result ) ``` -get json object list according to the key name +根据 key 的名称获取 json object list **Parameters** - - **name** name of key - - **result** result of json object list + - **name**:key 的名称 + - **result**:json object list 的结果 @@ -395,11 +395,11 @@ int JsonParam::get_string ( std::string name, std::string & result ) ``` -get string according to the key name +根据 key 的名称获取 string **Parameters** - - **name** name of key - - **result** result of string + - **name**:key 的名称 + - **result**:string 的结果 @@ -414,11 +414,11 @@ int JsonParam::get_string_list ( std::string name, std::vector< std::string > & result ) ``` -get string list according to the key name +根据 key 的名称获取 string list **Parameters** - - **name** name of key - - **result** result of string list + - **name**:key 的名称 + - **result**;string list 的结果 @@ -434,7 +434,7 @@ bool JsonParam::has_key ( std::string name ) judge the json has key **Parameters** - - **name** name of key + - **name**:key 的名称 @@ -447,10 +447,10 @@ judge the json has key ``` int JsonParam::load ( std::string file_name ) ``` -load file of json content +加载 json content 的文件 **Parameters** - - **file_name** file name of json content + - **file_name**:json content 的文件名称 @@ -463,10 +463,10 @@ load file of json content ``` void JsonParam::merge_patch ( const JsonParam &json_patch ) ``` -merge json patch to current target +将 json patch 合并到当前 target **Parameters** - - **json_patch** json patch + - **json_patch**:json patch @@ -495,10 +495,10 @@ merge json patch to current target ``` int JsonParam::parse ( std::string content ) ``` -parse json content string +解析 json content string **Parameters** - - **content** json string + - **content**:json string @@ -511,10 +511,10 @@ parse json content string ``` void JsonParam::set_value ( bmf_nlohmann::json &value ) ``` -set value of json value +设置 json value 的值 **Parameters** - - **json_value** json value + - **json_value**:json value @@ -524,10 +524,10 @@ set value of json value ``` int JsonParam::store ( std::string file_name ) ``` -store json content to file +存储 json content 到文件 **Parameters** - - **file_name** file name of json content + - **file_name**:json content 的文件名称 @@ -553,7 +553,7 @@ T JsonParam::to ( ) const   } ``` -## Member Data Documentation +## 成员数据文档 ###  json_value_ diff --git a/content/zh/docs/bmf/api/api_in_cpp/module/_index.md b/content/zh/docs/bmf/api/api_in_cpp/module/_index.md index 2932e38..2e045af 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/module/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/module/_index.md @@ -7,7 +7,7 @@ weight: 5 [//]: <> (REF_MD: classbmf__sdk_1_1Module.html) - [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-member-functions) | [Public Attributes](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-attributes) | List of all members # bmf_sdk::Module Class Referenceabstract + [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-member-functions) | [公共属性](https://babitmf.github.io/docs/bmf/api/api_in_cpp/module/#public-attributes) | List of all members # bmf_sdk::Module Class Referenceabstract module.h ## Public Member Functions @@ -71,13 +71,13 @@ virtual int32_t [report](#report) ( [JsonParam](https://babitmf.github.io/docs virtual [~Module](#~module) () - ## Public Attributes + ## 公共属性 int32_t [node_id_](#node_id_) = -1 -## Constructor & Destructor Documentation +## 构造函数和析构函数 ###  Module() @@ -94,8 +94,8 @@ bmf_sdk::Module::Module ( int32_t node_id = -1, **Parameters** - - **node_id** unique id . - - **json_param** json param of module. + - **node_id**:唯一标识 + - **json_param**:模块的 json 参数 @@ -126,7 +126,7 @@ virtual  {}; ``` -## Member Function Documentation +## 成员函数文档 ###  close() @@ -142,7 +142,7 @@ virtual -close module and release resources +关闭模块并释放资源 **Returns** @@ -166,10 +166,10 @@ virtual -dynamic reset module according to the jsonParam +根据 json 参数动态重置模块 **Parameters** - - **opt_reset** json param of reset + - **opt_reset**:重置 json 参数 @@ -195,7 +195,7 @@ virtual -set module mode to flush data +设置模块 mode 为 flush data **Returns** @@ -219,10 +219,10 @@ virtual -if the module is subgraph get the graph config +如果模块是 subgraph,则获取 graph config **Parameters** - - **json_param** return value of config + - **json_param**:返回 config 的值 @@ -248,10 +248,10 @@ virtual -get input stream info of module +获取模块的 input stream 信息 **Parameters** - - **json_param** input stream info. + - **json_param**:input stream 信息 @@ -277,11 +277,10 @@ virtual -get info of module +获取模块的信息 **Parameters** - - **json_param** module info. - + - **json_param**:模块信息 **Returns** @@ -306,11 +305,10 @@ virtual -get output stream info of module +获取模块的 output stream 信息 **Parameters** - - **json_param** output stream info. - + - **json_param**:output stream 信息 **Returns** @@ -335,7 +333,7 @@ virtual -init module +初始化模块 **Returns** @@ -359,10 +357,10 @@ virtual -check the input stream if need data +检查 input stream 是否需要数据 **Parameters** - - **input_stream_id** input stream id + - **input_stream_id**:input stream id @@ -388,7 +386,7 @@ virtual -check the module type +检查模块类型 **Returns** @@ -412,7 +410,7 @@ virtual -check the module is subgraph +检查模块是否是 subgraph **Returns** @@ -436,10 +434,10 @@ virtual -check the input stream if need hungry check +检查 input stream 是否需要 hungry check **Parameters** - - **input_stream_id** input stream id + - **input_stream_id**:input stream id @@ -466,7 +464,7 @@ virtual int32_t bmf_sdk::Module::process ( Task &task ) process task **Parameters** - - **task** need to be processed + - **task**:需要被处理 @@ -489,11 +487,11 @@ virtual -report module stats +报告模块的统计数据 **Parameters** - - **json_param** stats - - **hints** hints pass to stats caculation + - **json_param**:统计数据 + - **hints** 提示传递到统计计算 @@ -519,7 +517,7 @@ virtual -reset module +重置模块 **Returns** @@ -543,10 +541,10 @@ virtual -set the graph callback of module +设置模块的 graph callback **Parameters** - - **callback_endpoint** callback that defined in graph + - **callback_endpoint**:graph 中定义的 callback @@ -569,10 +567,10 @@ virtual -set input stream info of module +设置模块的 input stream 信息 **Parameters** - - **json_param** input stream info. + - **json_param**:input stream 信息 @@ -598,10 +596,10 @@ virtual -set output stream info of module +设置模块的 output stream 信息 **Parameters** - - **json_param** output stream info. + - **json_param**:output stream 信息 @@ -613,7 +611,7 @@ set output stream info of module  { return 0; }; ``` -## Member Data Documentation +## 成员数据文档 ###  node_id_ diff --git a/content/zh/docs/bmf/api/api_in_cpp/opaquedataset/_index.md b/content/zh/docs/bmf/api/api_in_cpp/opaquedataset/_index.md index eb1bc6b..2371741 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/opaquedataset/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/opaquedataset/_index.md @@ -7,11 +7,11 @@ weight: 10 [//]: <> (REF_MD: classbmf__sdk_1_1OpaqueDataSet.html) - [Public Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#public-member-functions) | [Protected Member Functions](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#pro-methods) | List of all members # bmf_sdk::OpaqueDataSet Class Reference + [公有成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#public-member-functions) | [受保护的成员函数](https://babitmf.github.io/docs/bmf/api/api_in_cpp/opaquedataset/#pro-methods) | List of all members # bmf_sdk::OpaqueDataSet Class Reference sdk_interface.h! - ## Public Member Functions + ## 公共成员函数 [OpaqueDataSet](#opaquedataset-13) ()=default @@ -26,7 +26,7 @@ sdk_interface.h! void [private_attach](#private_attach) (const T *data, Args &&...args) - + const T * [private_get](#private_get) () const @@ -37,7 +37,7 @@ void [private_merge](#private_merge) (const [OpaqueDataSet](https://babitmf.gi - ## Protected Member Functions + ## 受保护的成员函数 virtual void [set_private_data](#set_private_data) (int key, const OpaqueData &data) @@ -46,7 +46,7 @@ virtual void [set_private_data](#set_private_data) (int key, const OpaqueData virtual const OpaqueData & [private_data](#private_data) (int key) const -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  OpaqueDataSet() [1/3] @@ -72,7 +72,6 @@ bmf_sdk::OpaqueDataSet::OpaqueDataSet ( OpaqueDataSet && ) - ###  OpaqueDataSet() [3/3] ``` @@ -83,8 +82,7 @@ bmf_sdk::OpaqueDataSet::OpaqueDataSet ( const OpaqueDataSet & ) - -## Member Function Documentation +## 成员函数文档 ###  copy_props() @@ -92,7 +90,7 @@ bmf_sdk::OpaqueDataSet::OpaqueDataSet ( const OpaqueDataSet & ) ``` OpaqueDataSet & bmf_sdk::OpaqueDataSet::copy_props( const OpaqueDataSet &from ) ``` -utils function to copy props +复制 props 的 util 函数 **Parameters** - **from** @@ -128,7 +126,7 @@ void bmf_sdk::OpaqueDataSet::private_attach ( const T * data, -Attach private data with type T, for type safety, T should be registry by OpaqueDataInfo . +附加类型为 T 的私有数据,为确保类型安全,T 应当由 OpaqueDataInfo 注册。 ffmpeg_helper.h , test_video_frame.cpp @@ -140,7 +138,7 @@ Attach private data with type T, for type safety, T should be registry by Opaqu **Parameters** - **data** - - **args** extra arguments pass to + - **args**:传递的额外的 arguments @@ -179,7 +177,7 @@ const T* bmf_sdk::OpaqueDataSet::private_get ( ) const -Retrieve readonly private data which attached by private_attach or private_merge. +读取通过 private_attach 或 private_merge 附加的只读私有数据。 **Template Parameters** - **T** @@ -203,7 +201,8 @@ Retrieve readonly private data which attached by private_attach or private_merge ``` void bmf_sdk::OpaqueDataSet::private_merge ( const OpaqueDataSet &from ) ``` -merge private data from `from` **Parameters** +合并来自 `from` 的私有数据 +**Parameters** - **from** @@ -224,7 +223,7 @@ virtual -Set the private data object, Derived class can override this function to filter out unsupported keys. +设置私有数据对象,派生类可以重载此函数以过滤掉不支持的 key。 **Parameters** - **key** diff --git a/content/zh/docs/bmf/api/api_in_cpp/packet/_index.md b/content/zh/docs/bmf/api/api_in_cpp/packet/_index.md index d6e93ba..cac6b5f 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/packet/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/packet/_index.md @@ -56,7 +56,7 @@ double [time](#time) () const const [PacketImpl](https://babitmf.github.io/docs/bmf/api/api_in_cpp/packetimpl/) * [unsafe_self](#unsafe_self-22) () const - ## Static Public Member Functions + ## 静态公有成员函数 static Packet [generate_eos_packet](#generate_eos_packet) () @@ -64,14 +64,14 @@ static Packet [generate_eos_packet](#generate_eos_packet) () static Packet [generate_eof_packet](#generate_eof_packet) () - ## Protected Member Functions + ## 受保护的成员函数 [Packet](#packet-99) (T *obj) -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  Packet() [1/9] @@ -228,7 +228,7 @@ protected   } ``` -## Member Function Documentation +## 成员函数文档 ###  generate_eof_packet() diff --git a/content/zh/docs/bmf/api/api_in_cpp/packetimpl/_index.md b/content/zh/docs/bmf/api/api_in_cpp/packetimpl/_index.md index 6832915..ac0acd5 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/packetimpl/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/packetimpl/_index.md @@ -11,7 +11,7 @@ weight: 7 packetimpl.h - ## Public Member Functions + ## 公有成员函数 [PacketImpl](#packetimpl-14) ()=delete @@ -42,7 +42,7 @@ void [set_time](#set_time) (double [time](#time) ) double [time](#time) () const - ## Protected Member Functions + ## 受保护的成员函数 [PacketImpl](#packetimpl-44) (void *obj, const TypeInfo * [type_info](#type_info) , const std::function< void(void *)> &del) @@ -54,7 +54,7 @@ double [time](#time) () const class [Packet](#packet) -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  PacketImpl() [1/4] @@ -113,7 +113,7 @@ bmf_sdk::PacketImpl::PacketImpl ( void * obj, -## Member Function Documentation +## 成员函数文档 ###  get() [1/2] diff --git a/content/zh/docs/bmf/api/api_in_cpp/rational/_index.md b/content/zh/docs/bmf/api/api_in_cpp/rational/_index.md index 7d5fb89..2be2ce8 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/rational/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/rational/_index.md @@ -16,7 +16,7 @@ rational.h ## Public Member Functions [Rational](#rational-22) (int n, int d) - ## Public Attributes + ## 公共属性 int [num](#num) = -1 @@ -26,7 +26,7 @@ int [den](#den) = -1 -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  Rational() [1/2] @@ -67,7 +67,7 @@ Rational::Rational ( int n,   } ``` -## Member Data Documentation +##成员数据文档 ###  den diff --git a/content/zh/docs/bmf/api/api_in_cpp/sequencedata/_index.md b/content/zh/docs/bmf/api/api_in_cpp/sequencedata/_index.md index 9995867..6ed00f7 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/sequencedata/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/sequencedata/_index.md @@ -11,7 +11,7 @@ weight: 11 sdk_interface.h - ## Public Member Functions + ## 公共成员函数 void [set_pts](#set_pts) (int64_t [pts](#pts) ) @@ -37,7 +37,7 @@ bool [operator<=](#operator-3) (const [SequenceData](https://babitmf.github.io -## Member Function Documentation +## 成员函数文档 ###  copy_props() @@ -45,7 +45,7 @@ bool [operator<=](#operator-3) (const [SequenceData](https://babitmf.github.io ``` SequenceData & bmf_sdk::SequenceData::copy_props( const SequenceData &from ) ``` -util function to copy props +复制 props 的 util function **Parameters** - **from** @@ -164,7 +164,7 @@ void bmf_sdk::SequenceData::set_pts ( int64_t pts ) -Set the pts object. +设置该 pts 的 object。 **Parameters** - **pts** @@ -188,10 +188,10 @@ void bmf_sdk::SequenceData::set_time_base ( Rational time_base ) -set timebase of frame +设置帧的 time base **Parameters** - - **time_base** of frame + - **time_base**;帧的 time base @@ -214,8 +214,7 @@ set timebase of frame -Get the time base object. - +获取 time base object。 **Returns** [Rational](https://babitmf.github.io/docs/bmf/api/api_in_cpp/rational/) diff --git a/content/zh/docs/bmf/api/api_in_cpp/task/_index.md b/content/zh/docs/bmf/api/api_in_cpp/task/_index.md index 3f43bb1..fa42362 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/task/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/task/_index.md @@ -60,7 +60,7 @@ int [get_node](#get_node) () void [init](#init) (int node_id, std::vector< int > input_stream_id_list, std::vector< int > output_stream_id_list) - ## Public Attributes + ## 公共属性 int64_t [timestamp_](#timestamp_) = [UNSET](page_timestamp_8h_v3_0_0#a6fc8e10db27041311d7695900743667caec1d962808cbb9cf1b89a5cdd6197923) @@ -78,7 +78,7 @@ int [node_id_](#node_id_) void [swap](#swap) ( [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) &target, [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) &source) -## Constructor & Destructor Documentation +## 构造函数和析构函数 ###  Task() [1/3] @@ -89,12 +89,12 @@ Task::Task ( int node_id = -1, std::vector< int > output_stream_id_list = {} ) ``` -construct [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) . +构造 [Task](https://babitmf.github.io/docs/bmf/api/api_in_cpp/task/) **Parameters** - - **node_id** The id of the running task. - - **input_stream_id_list** input stream id list. - - **output_stream_id_list** output stream id list. + - **node_id**:正在运行的 task 的 id + - **input_stream_id_list**:输入流的 id list + - **output_stream_id_list**:输出流的 id list @@ -110,7 +110,7 @@ Task::Task ( const Task &rhs ) ``` Task::Task ( Task &&rhs ) ``` -## Member Function Documentation +## 成员函数文档 ###  fill_input_packet() @@ -120,11 +120,11 @@ bool Task::fill_input_packet ( int stream_id, Packet packet ) ``` -fill packet into the input stream queue. +将 packet 填入输入流队列。 **Parameters** - - **stream_id** The id of the input stream. - - **packet** the packet add to the input stream queue. + - **stream_id**:输入流的 id + - **packet**:填入输入流队列的 packet @@ -139,11 +139,11 @@ bool Task::fill_output_packet ( int stream_id, Packet packet ) ``` -fill packet into the output stream queue. +将 packet 填入输出流队列。 **Parameters** - - **stream_id** The id of the output stream. - - **packet** the packet add to the output stream queue. + - **stream_id**:输出流的 id + - **packet**:填入输出流队列的 packet @@ -156,7 +156,7 @@ fill packet into the output stream queue. ``` ( ) ``` -get input stream id list. +获取输入流的 id list. **Returns** @@ -167,7 +167,7 @@ get input stream id list. ``` PacketQueueMap & Task::get_inputs( ) ``` -get input stream queue. +获取输入流队列。 **Returns** @@ -184,7 +184,7 @@ int Task::get_node ( ) ``` ( ) ``` -get output stream id list. +获取输出流的 id list。 **Returns** @@ -195,7 +195,7 @@ get output stream id list. ``` PacketQueueMap & Task::get_outputs( ) ``` -get output stream queue. +获取输出流队列。 **Returns** @@ -235,11 +235,11 @@ bool Task::pop_packet_from_input_queue ( int stream_id, Packet & packet ) ``` -pop packet from the given stream id of input queue. +从输入队列的给定 stream id 中弹出 packet。 **Parameters** - - **stream_id** The id of the input stream. - - **packet** the packet poped from the input stream queue. + - **stream_id**:输入流的 id + - **packet**:从输入流队列中弹出的 packet。 @@ -254,11 +254,11 @@ bool Task::pop_packet_from_out_queue ( int stream_id, Packet & packet ) ``` -pop packet from the given stream id of output queue. +从输出队列的给定 stream id 中弹出 packet。 **Parameters** - - **stream_id** The id of the output stream. - - **packet** the packet poped from the output stream queue. + - **stream_id**:输出流的 id + - **packet**:从输出流队列中弹出的 packet。 @@ -271,10 +271,10 @@ pop packet from the given stream id of output queue. ``` void Task::set_timestamp ( int64_t t ) ``` -set the timestamp of the task. +设置该task的timestamp **Parameters** - - **t** the timestamp of the task. + - **t**:该 task 的 timestamp @@ -287,7 +287,7 @@ set the timestamp of the task. ``` int64_t Task::timestamp ( ) const ``` -get the timestamp of the task +获取该 task 的 timestamp **Returns** @@ -308,7 +308,7 @@ void swap ( Task &target, -## Member Data Documentation +## 成员数据文档 ###  inputs_queue_ diff --git a/content/zh/docs/bmf/api/api_in_cpp/video_frame/_index.md b/content/zh/docs/bmf/api/api_in_cpp/video_frame/_index.md index a7694e7..d420380 100644 --- a/content/zh/docs/bmf/api/api_in_cpp/video_frame/_index.md +++ b/content/zh/docs/bmf/api/api_in_cpp/video_frame/_index.md @@ -12,13 +12,13 @@ weight: 9 video_frame.h - ## Public Types + ## 公共类型 using [Frame](#frame) = hmp::Frame - ## Public Member Functions + ## 公共成员函数 [VideoFrame](#videoframe-16) () @@ -152,7 +152,7 @@ void [synchronize](https://babitmf.github.io/docs/bmf/api/api_in_cpp/future/#s - ## Static Public Member Functions + ## 静态公共成员函数 static [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) [make](#make-12) (int [width](#width) , int [height](#height) , const PixelInfo &pix_info, const Device & [device](#device) =kCPU) @@ -161,7 +161,7 @@ static [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_fra static [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) [make](#make-22) (int [width](#width) , int [height](#height) , const PixelInfo &pix_info, const std::string & [device](#device) ) - ## Protected Member Functions + ## 受保护的成员函数 [VideoFrame](#videoframe-66) (const std::shared_ptr< Private > &other) @@ -183,7 +183,7 @@ virtual const OpaqueData & [private_data](https://babitmf.github.io/docs/bmf/a ``` using bmf_sdk::VideoFrame::Frame = hmp::Frame ``` -## Constructor & Destructor Documentation +## 构造函数和析构函数文档 ###  VideoFrame() [1/6] @@ -191,7 +191,7 @@ using bmf_sdk::VideoFrame::Frame = hmp::Frame ``` bmf_sdk::VideoFrame::VideoFrame ( ) ``` -Construct a undefined Video Frame object. +构建一个未定义的 Video Frame object。 ``` @@ -235,7 +235,7 @@ bmf_sdk::VideoFrame::VideoFrame ( const Frame &frame ) Construct [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) from Frame object. **Parameters** - - **frame** Dedicated to YUV data, with irregular shapes between planes + - **frame**:专用于 YUV 数据,平面之间形状不规则 @@ -249,11 +249,12 @@ bmf_sdk::VideoFrame::VideoFrame ( int width, const Device & device = kCPU ) ``` -Construct VideoFrame(Frame) with given size (width, height), PixelInfo, and device, for ease of use, using factory function VideoFrame::make **Parameters** - - **width** width of Y plane - - **height** height of Y plane - - **pix_info** PixelFormat and ColorModel - - **device** device +使用 factory function VideoFrame::make 构建具有给定尺寸(宽、高)、PixelInfo 和设备的 VideoFrame(Frame) 以方便使用。 +**Parameters** + - **width**:Y 平面的宽 + - **height**:Y 平面的高 + - **pix_info**:PixelFormat 和 ColorModel + - **device**:device @@ -269,7 +270,7 @@ bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other ) -## Member Function Documentation +## 成员函数文档 ###  copy_() @@ -277,10 +278,10 @@ bmf_sdk::VideoFrame::VideoFrame ( const std::shared_ptr< Private > & other ) ``` VideoFrame & bmf_sdk::VideoFrame::copy_( const VideoFrame &from ) ``` -In-place copy. +原地复制。 **Parameters** - - **from** data source which have the same type and shape + - **from**:type和shape相同的数据源 @@ -293,7 +294,8 @@ In-place copy. ``` VideoFrame & bmf_sdk::VideoFrame::copy_props( const VideoFrame &from ) ``` -copy all extra props(set by member func set_xxx) from `from` (deepcopy if needed), **Parameters** +复制来自 `from` 的所有 extra props(由成员函数set_xxx设置)(如果需要,可深度复制) +**Parameters** - **from** @@ -317,13 +319,13 @@ copy all extra props(set by member func set_xxx) from `from` (deepcopy if neede int h ) const ``` -Return the selected region which specified by (x, y, w, h) +返回由(x、y、w、h)指定的选定区域 **Parameters** - - **x** start col index - - **y** start row index - - **w** number of cols - - **h** number of rows + - **x**:起始列索引 + - **y**:起始行索引 + - **w**:列数 + - **h**:行数 @@ -350,7 +352,7 @@ virtual -interface must implemented by sub-class, which provide device info +接口必须由子类实现,子类提供设备信息。 **Returns** @@ -396,9 +398,9 @@ static -Facotry function to construct VideoFrame(Frame) +构建 VideoFrame(Frame) 的 Facotry function -test_video_frame.cpp for more details +更多详细信息,请参阅 [test_video_frame.cpp](https://github.com/BabitMF/bmf/blob/a5d8c8626c0ae0bf5d2ae13ab284fe5e3fb4b5ee/bmf/sdk/cpp_sdk/test/test_video_frame.cpp#L4) ``` @@ -421,7 +423,7 @@ auto vf = VideoFrame::make(1920, 1080, H420, Device(kCUDA, 0)); - **width** - **height** - **format** - - **device** const char*, string, Device - infer to Device + - **device**:const char*, string, Device - infer to Device @@ -466,7 +468,7 @@ static ``` bmf_sdk::VideoFrame::operator bool ( ) const ``` -check if [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/) is defined +检查是否定义了 [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_frame/)。 **Returns** @@ -493,7 +495,7 @@ check if [VideoFrame](https://babitmf.github.io/docs/bmf/api/api_in_cpp/video_f ``` VideoFrame bmf_sdk::VideoFrame::reformat( const PixelInfo & pix_info ) ``` -Frame reformat, this only support rgb to yuv, or yuv to rgb. +帧格式转换,此功能仅支持 rgb 转换为 yuv 或 yuv 转换为 rgb。 **Parameters** - **pix_info** @@ -511,11 +513,11 @@ Frame reformat, this only support rgb to yuv, or yuv to rgb. bool non_blocking = false ) const ``` -Copy to target device, if it have already reside on target device, shadow copy will be performed. +复制到目标设备上,如果目标设备上已经有,则将执行 shadow copy。 **Parameters** - - **device** Target device - - **non_blocking** if true, internal allocator will try to allocate pinned memory, which can make data copy asynchronous + - **device**:目标设备 + - **non_blocking**:为 true 时,内部分配器将尝试分配固定的内存,这会导致数据复制异步 diff --git a/content/zh/docs/bmf/api/api_in_go/_index.md b/content/zh/docs/bmf/api/api_in_go/_index.md index ba26b54..339e09f 100644 --- a/content/zh/docs/bmf/api/api_in_go/_index.md +++ b/content/zh/docs/bmf/api/api_in_go/_index.md @@ -3,141 +3,141 @@ title: 'API In Go' linkTitle: 'API In Go' weight: 3 --- -## Normal mode (refer to normalMode) +## Normal mode (即 normalMode) ### func NewBMFGraph(mode BMFGraphMode, option interface{}) *BMFGraph Para: -- mode: Enumeration type, the operation mode of BMF, with the following options: - - Normal mode (most commonly used) - - Server pre-built mode - - Generator generator mode - - SubGraph subgraph mode - - Update Dynamic addition and deletion of streaming scenarios -- option: interface{} type, global Parameter of BMF, usually can be filled with null value nil +- mode: 枚举类型,即 BMF 的运行模式,有以下选项: + - Normal mode(最常用) + - Server:预构建模式 + - Generator:生成器模式 + - SubGraph:子图模式 + - Update:动态增删流场景 +- option: interface{} 类型,BMF 的全局参数,通常可以填空值 nil Return: -- *BMFGraph: structure pointer type, global Graph pointer +- *BMFGraph: 结构体指针类型,全局 Graph 指针 ### func (g *BMFGraph) Decode(decodePara interface{}, controlStream *BMFStream) *BMFNode Para: -- decodePara: interface{} type, decoding module Parameters, can be represented by map[string]interface{} data structure -- controlStream: structure pointer type, usually empty nil +- decodePara: interface{} 类型,解码模块的参数,可以用 map[string]interface{} 数据结构来表示 +- controlStream: 结构体指针类型,通常为空 nil Return: -- *BMFNode: structure pointer type, pointer to decoding node +- *BMFNode: 结构体指针类型,指向解码节点的指针 ### func (n *BMFNode) Stream(id interface{}) *BMFStream Para: -- id: integer, representing the stream number of the node (the stream number usually starts from 0) +- id: 整数,表示该节点的 stream number(stream number 通常从 0 开始) Return: -- *BMFStream: structure pointer type, pointer to stream structure +- *BMFStream: 结构体指针类型,指向流结构体的指针 ### func (g *BMFGraph) Encode(videoStream *BMFStream, audioStream *BMFStream, encoderPara interface{}) *BMFNode Para: -- videoStream: structure pointer type, the structure pointer of the video stream -- audioStream: structure pointer type, structure pointer of audio stream -- encoderPara: interface{} type, encoding module Parameters, can be represented by map[string]interface{} data structure +- videoStream: 结构体指针类型,视频流的结构体指针 +- audioStream: 结构体指针类型,音频流的结构体指针 +- encoderPara: interface{} 类型,解码模块的参数,可以用 map[string]interface{} 数据结构来表示 Return: -- *BMFNode: structure pointer type, coded node pointer +- *BMFNode: 结构体指针类型,编码节点指针 ### func (g *BMFGraph) Module(inputs []*BMFStream, moduleName string, moduleType BMFModuleType, modulePath string, moduleEntry string, option interface{}, preModule *BMFModuleInstance) *BMFNode Para: -- inputs: The slice structure of the BMFStream structure pointer, representing all input streams of the module -- moduleName: string type, module name -- moduleType: enumerated type, with the following options: +- inputs: BMFStream 结构指针的 slice 结构,代表模块的所有输入流 +- moduleName: 字符串类型,模块名称 +- moduleType: 枚举类型,有以下选项: -Python -Cpp - - Go -- modulePath: string type, the path where the module file is located -- moduleEntry: string type, module entry -- option: interface{} type, module Parameter -- preModule: structure pointer of BMFModuleInstance, preload module, nil if no + -Go +- modulePath: 字符串类型,模块文件所在路径 +- moduleEntry: 字符串类型,模块入口 +- option: interface{} 类型,模块参数 +- preModule: BMFModuleInstance 的结构体指针,预加载模块,如果没有则为 nil Return: -- *BMFNode: structure pointer type, the pointer of the corresponding node of the module +- *BMFNode: 结构体指针类型,模块对应节点的指针 ### func (g *BMFGraph) Run(needMerge bool) *CBMFGraph Para: -- needMerge: Boolean type, whether to merge the ffmpeg filter nodes in the graph, usually true +- needMerge: Boolean 类型,是否合并图中的 ffmpeg filter 节点,通常为 true Return: -- *CBMFGraph: structure pointer type, which is a pointer to the encapsulation structure of the C language graph object +- *CBMFGraph: 结构体指针类型,是指向 C 语言 Graph 对象的封装结构体的指针 ### func (bgp *CBMFGraph) Close() error Return: -- error: error type, when the C graph structure is empty, an error will be reported +- error: error类型,当 C graph 结构为空时,会报错 -## preload mode (refer to premoduleMode) +## preload mode (即 premoduleMode) ### func NewCBMFModule(moduleName string, option interface{}, moduleType BMFModuleType, modulePath, moduleEntry string) (*CBMFModule, error) Para: -- moduleName: string type, module name -- option: interface{} type, module Parameter -- moduleType: enumerated type, with the following options: +- moduleName: 字符串类型,模块名称 +- option: interface{} 类型,模块参数 +- moduleType: 枚举类型,具有以下选项: -Python -Cpp - - Go -- modulePath: string type, the path where the module file is located -- moduleEntry: string type, module entry + -Go +- modulePath: 字符串类型,模块文件所在的路径 +- moduleEntry: 字符串类型,模块入口 Return: -- *BMFModuleInstance: structure pointer type, which is a pointer to the encapsulation structure of the C language module object -- error: error type, when the C graph structure is empty, an error will be reported +- *BMFModuleInstance: 结构体指针类型,是指向 C 语言模块对象的封装结构体的指针 +- error: error 类型,当 C Graph 结构为空时,会报错 ### func (s *BMFStream) Module(inputs []*BMFStream, moduleName string, moduleType BMFModuleType, modulePath string, moduleEntry string, option interface{}, preModule *CBMFModule) *BMFNode -Note: The difference between this interface and the Module interface in normal mode is that the caller is BMFStream instead of BMFGraph. -When the caller is BMFStream, the stream corresponding to the caller will be merged with other streams in inputs, and they will be used as the input stream of the module together. +注意: 该接口与普通模式下的模块接口的区别在于调用者是 BMFStream 而不是 BMFGraph。 +当调用者为 BMFStream 时,与调用者对应的流将与输入中的其他流合并,共同用作模块的输入流。 ## Sync mode (see syncMode & syncModeSerial) ### func NewModulefunctor(name, tp, path, entry string, option interface{}, ninputs, nooutputs int32) (*Modulefunctor, error) Para: -- name: string type, Module name -- tp: string type, Module type (python, c++, go) -- Path: string type, corresponding to the path of the module implementation file -- entry: string type, module entry -- ninputs: int32 type, specifies the number of input streams -- nooutputs: int32 type, specifies the number of output streams +- name: string type, Module name字符串类型,模块名称 +- tp: 字符串类型,模块类型(Python,C++,Go) +- Path: 字符串类型,对应模块实施文件的路径 +- entry: 字符串类型,模块入口 +- ninputs: int32 类型,指定输入流的数量 +- nooutputs: int32 类型,注定输出流的数量 Return: -- *Modulefunctor: the instantiated Modulefunctor -- error: error message, default is nil +- *Modulefunctor: 实例化的 Modulefunctor +- error: 错误信息,默认为 nil ### func (self *Modulefunctor) Execute(inputs []*Packet, cleanup bool) (bool, error) Para: -- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed -- cleanup : bool type, controls whether to clear all un-fetch results +- inputs: *Packet 是元素类型的 slice structure,其中包含要处理的输入数据包 +- cleanup : bool 类型,控制是否清除所有未获取结果 Return: -- bool: Whether the operation is successful, 1 is success, 0 is failed -- error: error message, default is nil +- bool: 操作是否成功,1 表示成功,0 表示失败 +- error: 错误信息,默认为 nil ### func (self *Modulefunctor) Fetch(index int) ([]*Packet, error) Para: -- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed -- cleanup : bool type, controls whether to clear all un-fetch results +- inputs: *Packet 是元素类型的 slice structure,其中包含要处理的输入数据包 +- cleanup : bool 类型,控制是否清除所有未获取结果 Return: -- []*Packet: packet list processed by Sync mode module -- error: error message, default is nil +- []*Packet: 同步模式模块处理的数据包列表 +- error: 错误信息,默认为 nil ### func (self *Modulefunctor) Call(inputs []*Packet) ([]*Packet, error) Para: -- inputs: *Packet is a slice structure of element type, which contains the input Packet to be processed +- inputs: *Packet 是元素类型的 slice structure,其中包含要处理的输入数据包 Return: -- []*Packet: packet list processed by Sync mode module -- error: error message, default is nil +- []*Packet: 同步模式模块处理的数据包列表 +- error: 错误信息,默认为 nil ### func deleteModulefunctor(o *Modulefunctor) Para: -- o: *Modulefunctor, pointing to the Modulefunctor instance that will be free \ No newline at end of file +- o: *Modulefunctor,指向将被释放的 Modulefunctor 实例 \ No newline at end of file diff --git a/content/zh/docs/bmf/api/decode_module/_index.md b/content/zh/docs/bmf/api/decode_module/_index.md index c168178..74a015e 100644 --- a/content/zh/docs/bmf/api/decode_module/_index.md +++ b/content/zh/docs/bmf/api/decode_module/_index.md @@ -1,11 +1,11 @@ --- -title: 'Built-in Decode Module' -linkTitle: 'Built-in Decode Module' +title: '内置解码模块' +linkTitle: '内置解码模块' weight: 4 --- -This is a module capability discrption about BMF build-in decoder. The module can be used by BMF API such as [bmf.decode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#decode) by providing json style "option" to config such as the 3rd parameter below: +这是一个关于 BMF 内置解码器的模块功能说明。通过向配置(如下面的第 3 个参数)提供 json 样式的"选项",BMF API,如 [bmf.decode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#decode) 可以使用该模块: ``` @@ -14,71 +14,72 @@ bmf.decode( ) ``` -Details: +详情: - module name: c_ffmpeg_decoder - - loglevel: to set the loglevel of ffmpeg library it can be "quiet","panic","fatal","error","warning","info","verbose","debug","trace" + - loglevel: 设置 ffmpeg 库的日志级别,可以是“quiet”、“panic”、“fatal”、“error”、“warning”、“info”、“verbose”、“debug”、“trace” - - map_v: video stream index for decoder, exp. 0, which mean choose No.0 stream as video stream to be decode. + - map_v: 解码器的视频流索引,例如 0 表示选择 0 号流作为即将解码的视频流。 - - map_a: audio stream index for decoder, exp. 1, which mean choose No.1 stream as audio stream to be decode. + - map_a: 解码器的音频流索引,例如 1 表示选择 1 号流作为即将解码的音频流。 - - start_time: decode start time in seconds, exp. 1, which mean just decode the frame after 1 second, similar as -ss in ffmpeg command. + - start_time: 解码开始时间(以秒为单位),例如 1 表示 1 秒后解码帧,类似于 ffmpeg 命令中的 -ss。 - - end_time: decode end time, exp. 1, which mean just decode the frame before 1 second, just as -to in ffmpeg command. + - end_time: 解码结束时间,例如 1 表示只解码 1 秒之前的帧,类似于 ffmpeg 命令中的 -to。 - - durations: decode multiple group of duration frames/samples, such as [1.1, 4, 6.5, 9, 12.3, 15]. + - durations: 解码多组持续时间帧/样本,例如[1.1,4,6.5,9,12.3,15]。 - - fps: decode the frame as the fps set . + - fps: 将帧解码为 fps set。 - - video_time_base: video stream time base, exp. 1/1000, set the video stream timebase as 1/1000. + - video_time_base: 视频流时基,例如 1/1000 表示设置视频流时基为1/1000。 - - skip_frame: skip frame, exp. 32, make decoder discard processing depending on the option value, just as -skip_frame in ffmpeg commnad. AVDISCARD_NONE = -16, ///< discard nothing AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi AVDISCARD_NONREF = 8, ///< discard all non reference AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames AVDISCARD_NONINTRA= 24, ///< discard all non intra frames AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes AVDISCARD_ALL = 48, ///< discard all + - skip_frame: 跳帧,例如 32 表示根据选项值进行解码器丢弃处理,就像 ffmpeg commnad 中的 -skip_frame 一样。 AVDISCARD_NONE = -16, ///< 不丢弃任何内容 AVDISCARD_DEFAULT = 0, ///< 丢弃无用的数据包,例如 avi 中 0 大小的数据包 AVDISCARD_NONREF = 8, ///< 丢弃所有非引用 AVDISCARD_BIDIR = 16, ///< 丢弃所有 双向帧 AVDISCARD_NONINTRA= 24, ///< 丢弃所有非帧内帧 AVDISCARD_NONKEY = 32, ///< 丢弃除关键帧之外的所有帧 AVDISCARD_ALL = 48, ///< 丢弃所有 - - video_codec: video codec name, exp. libx264, set the specific codec for video stream. it will be stream copy when it set to be "copy" + - video_codec: 视频编解码器名称,例如 libx264,设置视频流的特定编解码器。 设置为 “copy” 时为流复制 - - overlap_time, which is used in decode live stream, if the live stream cut off, if the next packet pts is overlap smaller than overlap time, we will remove the overlap packet. default value is 10 + - overlap_time: 用于解码直播流,如果直播流中断,如果下一个数据包的 pts 重叠小于重叠时间,我们将删除重叠数据包。默认值为 10 - - cut_off_time, which is used in decode live stream ,if the live stream cut off, when the next packet pts is larger than last pts + cut_off_time, we will adjust pts to avoid large cut off. else we use the packet pts. + - cut_off_time: 用于解码直播流,如果直播流中断,当下一个 packet pts 大于最后一个 pts + cut_off_time 时,我们将调整 pts 以避免大的中断。 否则我们使用 packet pts - - cut_off_interval.which is used in decode live stream ,if the live stream cut off, when the next packet pts is larger than last pts + cut_off_time, we will adjust pts to avoid large cut off. else we use the packet pts. + - cut_off_interval: 用于解码直播流,如果直播流中断,当下一个 packet pts 大于最后一个 pts + cut_off_time 时,我们将调整 pts 以避免大的中断。 否则我们使用 packet pts - - vframes: set the number of video frames to output + - vframes: 设置要输出的视频帧数 - - aframes: set the number of audio frames to output + - aframes: 设置要输出的音频帧数 - - copyts: copy timestamps + - copyts: 复制 timestamps - - max_width_height: set the max width or height limitation of input frame. Once it's enabled, frame will be dropped by default or it will throw exp according to "limit_hits" + - max_width_height: 设置输入框的最大宽度或高度限制。启用后,默认情况下会丢弃帧,或者根据 “limit_hits” 抛出 - - max_limit_hits: set the max number of limit hits, once exceeded the exp will be threw + - max_limit_hits: 设置最大命中次数限制,一旦超过就会抛出 - - hwaccel: hardware accelete exp. cuda. - - extract_frames: support extract frames with given fps and device. + - hwaccel: 硬件加速,例如 cuda - - audio_codec: audio codec name, exp. aac, set the specific codec for audio stream. + - extract_frames: 支持使用给定的 fps 和设备提取帧 - - dec_params: set the decode codec parameters, such as "threads": 1 + - audio_codec: 音频编解码器名称,例如 aac 表示设置音频流的特定编解码器 - - autorotate: to enable/disable autorotate for the input video if needed, it's enabled by default + - dec_params: 设置解码编解码参数,如 “threads”:1 - - s: video size, exp. "1280:720". + - autorotate: 如果需要,可以启用或禁用输入视频的自动旋转,默认情况下启用 - - pix_fmt: pixel format, exp. "rgba". + - s: 视频尺寸,例如 "1280:720" - - input_path: decode input file,exp. "1.mp4". + - pix_fmt: 像素格式,例如 "rgba" - - push_raw_stream: enable raw stream push mode, exp. 1 + - input_path: 解码输入文件,例如 "1.mp4" - - channels: audio channels (required for audio push mode) + - push_raw_stream: 启用原始流推送模式,例如 1 - - sample_rate: audio sample rate (required for audio push mode) + - channels: 音频通道(音频推送模式所需) - - sample_fmt: audio sample format (used for audio push mode - optional) + - sample_rate: 音频采样率(音频推送模式所需) - - orig_pts_time: keep the original pts time of inputstream in the frame + - sample_fmt: 音频样本格式(用于音频推送模式 - 可选) + - orig_pts_time: 在帧中保留输入流的原始 pts 时间 -### Build-in Decode Module + +### 内置解码模块 diff --git a/content/zh/docs/bmf/api/encode_module/_index.md b/content/zh/docs/bmf/api/encode_module/_index.md index 8ffbc8b..e4516e5 100644 --- a/content/zh/docs/bmf/api/encode_module/_index.md +++ b/content/zh/docs/bmf/api/encode_module/_index.md @@ -1,10 +1,10 @@ --- -title: 'Built-in Encode Module' -linkTitle: 'Built-in Encode Module' +title: '内置编码模块' +linkTitle: '内置编码模块' weight: 5 --- -This is a module capability discrption about BMF build-in encoder. The module can be used by BMF API such as [bmf.encode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#encode) by providing json style "option" to config such as the 3rd parameter below: +这是一个关于 BMF 内置编码器的模块功能说明。通过向配置(如下面的第 3 个参数)提供 json 样式的"选项",BMF API,如[bmf.encode()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#encode)可以使用该模块: ``` @@ -30,17 +30,16 @@ bmf.encode( ) ``` -Details: +详情: - module name: c_ffmpeg_encoder - - null_output: to make encoder as a null sink in some cases. "null_output": 1 + - null_output: 在某些情况下使编码器作为 null sink,"null_output": 1。 + - output_path: 输出文件路径,例如 out.mp4,可表明文件的输出格式,类似于 ffmpeg。 - - output_path: output file path, exp. out.mp4, which can indicate the output format of the file similiar as ffmpeg. + - adjust_pts: 启用后,将从 0 开始调整 pts - - adjust_pts: will adjust the pts start from 0 when it's enabled - - - format: similiar as the "-f" in ffmpeg command line to specify the demux/mux format. exp. + - format: 类似于 ffmpeg 命令行中的 “-f”,用于指定解复用/复用格式。 ``` { "format": "flv", @@ -50,23 +49,23 @@ Details: ``` - - output_prefix: specify the output directory path + - output_prefix: 指定输出目录路径 - - push_output: decide whether to mux the result and where to output the results, available value is 0/1/2. 0: write muxed result to disk, 1: write muxed result to the output queue, 2: write unmuxed result to the output queue. + - push_output: 决定是否复用结果以及将结果输出到哪里,可用值为 0/1/2。 0:将复用结果写入磁盘,1:将复用结果写入输出队列,2:将未复用结果写入输出队列。 ``` "push_output": 1 ``` - - avio_buffer_size: set avio buffer size, when oformat is image2pipe, this paramter is useful, exp. + - avio_buffer_size: 设置 avio 缓冲区大小,当格式为 image2pipe 时,此参数有用,例如: ``` "avio_buffer_size": 16384 ``` - - mux_params: specify the extra output mux parameters, exp. + - mux_params: 指定额外输出复用参数,例如: ``` "format": "hls", "mux_params": { @@ -78,7 +77,7 @@ Details: ``` - - video_params: video codec related parameters which similiar as ffmpeg. exp. + - video_params: 视频编解码相关的参数,类似于 FFmpeg,例如: ``` "video_params": { "codec": "h264", @@ -90,22 +89,24 @@ Details: ``` + + - metadata: 在输出文件文件中添加用户 metadata + + - vframes: 设置输出视频帧的数量 - - metadata: to add user metadata in the outfile + - aframes: 设置输出音频帧的数量 - - vframes: set the number of video frames to output + - min_frames: 设置输出视频帧的最小数量 - - aframes: set the number of audio frames to output + - codec: video_params 或 audio_params 中的参数,用于指定 libavcodec 包含的编解码器名称。例如:"h264"、"bytevc1"、"jpg"、"png"、"aac"(音频) - - min_frames: set the min number of output video frames + - width: video_params 中的参数,用于指定视频宽度 - - codec: param in video_params or audio_params to specify the name of the codec which libavcodec included. exp. "h264", "bytevc1", "jpg", "png", "aac"(audio) + - height: video_params 中的参数,用于指定视频高度 - - width: param in video_params to specify the video width - - height: param in video_params to specify the video height - - pix_fmt: param in video_params to specify the input format of raw video + - pix_fmt: video_params 中的参数,用于指定原始视频的输入格式 - - audio_params: audio codec related parameters which similiar as ffmpeg. exp. + - audio_params: 与 ffmpeg 类似的音频编解码器相关参数。例如: ``` "audio_params": { "codec": "aac", @@ -117,34 +118,32 @@ Details: ``` - - loglevel: without using the logbuffer of builder API, to set the ffmpeg av log level: "quiet","panic","fatal","error","warning","info","verbose","debug","trace" - - - threads: specify the number of threads for encoder, "auto" by default, and other for example: "threads": "2" + - loglevel: 不使用 builder API 的 logbuffer,设置 ffmpeg av 日志级别:“quiet”,“panic”,“fatal”,“error”,“warning”,“info”,“verbose”,“debug”,“trace ” - - psnr: to set encoder provide psnr information + - threads: 指定编码器的线程数,默认为 "auto",其它示例:"线程":"2" - - in_time_base: to set time base manually + - psnr: 设置编码器,提供 PSNR 信息 - - vsync: to set the video sync method on frame rate, "auto" by default. and it can be "cfr", "vfr", "passthrough", "drop" similar as ffmpeg + - in_time_base: 手动设置 time base - - max_fr: to set the frame rate + - vsync: 设置帧率的视频同步方法,默认为“自动”。 它可以是 “cfr”,“vfr”,“passthrough”,“drop”,类似于 ffmpeg - - max_fr: to set the frame rate, similar as ffmpeg + - max_fr: 设置帧率,类似于 FFmpeg - - qscal: to set the qscale for the encoder global_quality + - qscal: 设置编码器 global_quality 的 qscale - - vtag: to set the vtag for output stream + - vtag: 设置输出流的 vtag - - bit_rate or b: to set the bitrate for video encode + - bit_rate or b: 设置视频编码的比特率 - - channels: to set the channels for input audio + - channels: 设置输入音频的通道 - - bit_rate or b: to set the bit_rate for audio encode + - bit_rate or b: 设置音频编码的 bit_rate - - sample_rate: to set the sample_rate for audio encode + - sample_rate: 设置音频编码的 sample_rate - - atag: to set the atag for output stream + - atag: 设置输出流的 atag -### Build-in Encode Module +### 内置编码模块 diff --git a/content/zh/docs/bmf/api/filter_module/_index.md b/content/zh/docs/bmf/api/filter_module/_index.md index 5df98e0..b256065 100644 --- a/content/zh/docs/bmf/api/filter_module/_index.md +++ b/content/zh/docs/bmf/api/filter_module/_index.md @@ -4,7 +4,7 @@ linkTitle: 'Built-in Filter Module' weight: 6 --- -This is a module capability discrption about BMF build-in filter. The module can be used by Module Related BMF API such as [bmf.concat()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#concat) by providing ffmpeg command line style parameters to config the filtergraph: +这是一个关于 BMF 内置 Filter 模块的功能描述。通过提供 ffmpeg 命令行样式的参数来配置 filtergraph,该模块可用于模块相关的 BMF API,如[bmf.concat()](https://babitmf.github.io/docs/bmf/api/api_in_python/transcode_functions/#concat): ``` @@ -32,7 +32,7 @@ concat_audio = ( ) ``` -And in another common way, users can create any filter stream which ffmpeg libavfilter included. exp.: +另一种常见的方式是,用户可以创建 ffmpeg libavfilter 包含的任何 filter 流。 例如: ``` @@ -42,77 +42,76 @@ ff_filter('unsharp', '5:5:1') - module name: c_ffmpeg_filter -### Build-in Filter Module +### 内置 filter 模块 -## GPU Filter Module - -BMF provides several common filtering modules accelerated by GPU: +## GPU Filter 模块 +BMF 提供了几种常用的 GPU 加速的 filter 模块: - scale - flip - rotate - crop - blur -These modules are located in bmf/example/gpu_module/. The demo code showing how to use these modules is in `test_gpu_module.py`. You can also try them on Colab [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/eefengwei/colab_tutorials/blob/main/colab_tutorial_cd.ipynb). The modules accept nv12/yuv420p/rgb formats with 8/10 bits per component. +这些模块模块位于 bmf/example/gpu_module/ 中。`test_gpu_module.py` 这个示例代码展示了如何使用这些模块。你也可以通过 Colab 体验它们 [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/eefengwei/colab_tutorials/blob/main/colab_tutorial_cd.ipynb)。该模块接受 nv12/yuv420p/rgb 格式,每个组件 8 或 10 位。 ### Scale -The scale module can resize an image. +scale 模块可以调整图像的大小。 -**Scale Options** +**Scale 选项** -***size***: Target size of the image, can be of format `WxH`, `W*H` or `W,H` +***size***: 图像的目标尺寸,格式可以是 `WxH`,`W*H` 或 `W,H` -***algo***(optional): Interpretation algorithm, can be one of `area`, `cubic`, `linear` and `nearest`. If unspecified, `linear` will be used by default. +***algo***: (可选的):插值算法,可以是 `area`、`cubic`、`linear` 和 `nearest` 之一。 如果未指定,则默认使用 `linear`。 ### Flip -Flip the image in the specified direction. +沿指定方向翻转图像。 -**Flip Options** +**Flip 选项** -***direction***: The direction of the flip. Supports `h`, `horizontal`, `v`, `vertical` or `both` (flip both vertically and horizontally). E.g. `.module('flip_gpu', {'direction': 'v'})` flips the image vertically +***direction***: 翻转的方向。 支持 `h`,`horizontal`,`v`,`vertical` 或 `both`(垂直和水平翻转)。 例如 `.module('flip_gpu', {'direction': 'v'})` 垂直翻转图像 ### Rotate -Rotate the image in a certain angle. The angle can be represented as degrees or radians. By default, the image will be rotated around the image center. Note that the empty area will be fill with 0. Rotation will not change the aspect ratio of the image, i.e. if you rotate a 1920x1080 image by 90 degrees, the output image is still 1920x1080 rather than 1080x1920 +将图像旋转一定角度。角度可以表示为度数或弧度。默认情况下,图像将围绕图像中心旋转。注意,空白区域将填充 0。旋转不会改变图像的宽高比,例如如果将 1920x1080 图像旋转 90 度,输出图像仍然是 1920x1080 而不是 1080x1920。 -**Rotate Options** +**Rotate 选项** -***angle_deg***: The angle of the rotation. A positive angle value will rotate the image clockwise, a negative angle value anti-clockwise. The angle can be a floating point value. +***angle_deg***: 旋转的角度。正角度值将顺时针旋转图像,负角度值将逆时针旋转图像。角度可以是浮点值。 -***angle***: The radius of the rotation. e.g. setting `{'angle': 'pi/8'}` will effectively rotate the image by 45 degrees clockwise. +***angle***: 旋转半径。例如设置 `{'angle': 'pi/8'}` 将有效地将图像顺时针旋转 45 度。 -***center***: The point around which the image is rotated. By default, the center is the image center `w/2,h/2`, where `w` and `h` are the width and height of the image. +***center***: 图像旋转的中心点。默认情况下,中心点是图像中心点 `w/2,h/2`,其中 `w` 和 `h` 是图像的宽度和高度。 -***scale***: Scaling factor of the image. Default is `1`, which means do not scale the image. `{'scale': 1.5}` will zoom in the image by 1.5x. +***scale***: 图像的缩放因子。默认值为 `1`,表示不缩放图像。`{'scale': 1.5}` 表示将图像放大 1.5 倍。 -***algo***: Interpolation algorithm. Supports `'cubic'`, `'linear'` and `'nearest'`. +***algo***: 插值算法。支持 `'cubic'`、`'linear'` 和 `'nearest'`。 ### Crop -Crops the input image into the given size. Example: `module('crop_gpu', {'x': 960, 'y': 540, 'width': 640, 'height': 480})` +将输入图像裁剪成指定大小。示例: `module('crop_gpu', {'x': 960, 'y': 540, 'width': 640, 'height': 480})` -**Crop Options** +**Crop 选项** -***x, y***: The coordinate of the cropping area's upper-left corner. +***x, y***: 裁剪区域左上角的坐标。 -***width, height***: Width and height of the cropping area. +***width, height***: 裁剪区域的宽度和高度。 ### Blur -Blur the input image using one of the supported algorithm (gaussian, average and median). Gaussian blur example: `module('blur_gpu', {'op': 'gblur', 'sigma': [0.7, 0.7], 'size': [5, 5]})` +使用支持的算法(高斯、平均和中值)之一对输入图像进行模糊处理。高斯模糊示例:`module('blur_gpu', {'op': 'gblur', 'sigma': [0.7, 0.7], 'size': [5, 5]})` -**Blur Options** +**Blur 选项** -***op***: The blur algorithm to be used. Supports `'gblur'` (gaussian blur), `'avgblur'` (average blur) and `'median'` (median blur). +***op***: 要使用的模糊算法。支持 `'gblur'`(高斯模糊)、`'avgblur'`(平均模糊)和 `'median'`(中值模糊)。 -***size***: The width and height of the blur kernel. Should be of format `[W, H]`. Default size is `[1, 1]` This option applies to all blur algorithms. +***size***: 模糊内核的宽度和高度。格式应为 `[W,H]`。默认大小为 `[1, 1]` 该选项适用于所有模糊算法。 -***planes***: Specifies which image plane should be blurred. The value should be a bit mask, e.g. if you want to blur all three planes of a yuv420p image, you should set `'planes': 0x7` or `'planes': 0b111`. Default value is `0xf`. This option applies to all blur algorithms. +***planes***: 指定应模糊哪个图像平面。该值应是位掩码,例如,如果要模糊 yuv420p 图像的所有三个平面,应设置 `'planes': 0x7` 或 `'planes': 0b111`. 默认值为 `0xf`。此选项适用于所有模糊算法。 -***sigma***: Gaussian kernel standard deviation. Should be of format `[X, Y]`, float data type. This option only applies to the `gblur` op. +***sigma***: 高斯核标准偏差。格式应为 `[X,Y]`,浮点数据类型。该选项仅适用于 `gblur` 操作。 -***anchor***: Kernel anchor. Indicates the relative position of a filtered point within the kernel. Should be of format `[X, Y]`. Default is `[-1, -1]` which indicates kernel center. This option only applies to `avgblur` op. +***anchor***: 内核锚点。表示过滤点在内核中的相对位置。格式应为 `[X,Y]`。默认为 `[-1, -1]` 表示内核中心。此选项仅适用于 `avgblur` 操作。 -***radius***: Alias for the ***size*** option. Radius only applies to `median` op. \ No newline at end of file +***radius***: ***size*** 选项的别名。半径只适用于 `median` 操作。 \ No newline at end of file diff --git a/content/zh/docs/bmf/api/loglevel/_index.md b/content/zh/docs/bmf/api/loglevel/_index.md index 21bcbce..1890dea 100644 --- a/content/zh/docs/bmf/api/loglevel/_index.md +++ b/content/zh/docs/bmf/api/loglevel/_index.md @@ -1,12 +1,12 @@ --- -title: 'Loglevel' -linkTitle: 'Loglevel' +title: '日志级别' +linkTitle: '日志级别' weight: 7 --- -## LogLevel +## 日志级别 -If you want to modify the loglevel related to FFmpeg in the built-in Module, please pass the loglevel parameter when building the graph. The following example sets the loglevel of decoder to quiet and the loglevel of encoder to debug. +如果要修改内置模块中与 FFmpeg 相关的日志级别,请在构建 graph 时传递日志级别参数。下面的示例将解码器的日志级别设为 quiet,将编码器的日志级别设为 debug。 ``` graph = bmf.graph() @@ -21,6 +21,6 @@ If you want to modify the loglevel related to FFmpeg in the built-in Module, ple }) ``` -The BMF framework also has its own log and loglevel. For the log from BMF, it's set to INFO default, if you want to modify, please use the ENV: +BMF 框架也有自己的日志和日志级别。BMF 的日志默认设置为 INFO,如果要修改,请使用 ENV: ```export BMF_LOG_LEVEL=WARNING/INFO/ERROR/FATAL/DISABLE``` \ No newline at end of file