Skip to content

Commit

Permalink
fix(video): fix format conf conflict (#3320)
Browse files Browse the repository at this point in the history
Signed-off-by: Jiyong Huang <huangjy@emqx.io>
  • Loading branch information
ngjaying authored Oct 22, 2024
1 parent d8ca0f1 commit 4757a49
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions docs/en_US/guide/sources/plugin/video.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ The url address for the video streaming.

The interval (ms) to issue a message.

### vformat

The video format. Run `ffmpeg -formats` to get all supported format, default to 'image2'.

### codec

The video codec. Check https://www.ffmpeg.org/general.html#Video-Codecs for all supported codec, default to 'mjpeg'

## Override the default settings

If you have a specific connection that need to overwrite the default settings, you can create a customized section. In the previous sample, we create a specific setting named with `ext`. Then you can specify the configuration with option `CONF_KEY` when creating the stream definition (see [stream specs](../../../sqls/streams.md) for more info).
Expand Down
8 changes: 8 additions & 0 deletions docs/zh_CN/guide/sources/plugin/video.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ dedup:

发出消息的间隔(毫秒)。

### vformat

视频格式。运行 `ffmpeg -formats` 可获取所有支持的格式,默认为 'image2'。

### codec

视频编码。访问 https://www.ffmpeg.org/general.html#Video-Codecs 以获取所有支持的编码。默认为 'mjpeg'。

## 覆盖默认设置

如果您有特定的连接需要覆盖默认设置,则可以创建一个自定义部分。 在上一个示例中,我们创建一个名为 `ext` 的特定设置。 然后,您可以在创建流定义时使用选项 `CONF_KEY` 指定配置(有关更多信息,请参见 [stream specs](../../../sqls/streams.md))。
Expand Down
3 changes: 1 addition & 2 deletions extensions/impl/video/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const FRAMENUMBER = 5
type Source struct {
Url string `json:"url"`
// Run ffmpeg -formats to get all supported format, default to 'image2'
Format string `json:"format"`
Format string `json:"vformat"`
// Check https://www.ffmpeg.org/general.html#Video-Codecs, default to 'mjpeg'
Codec string `json:"codec"`
meta map[string]any
Expand All @@ -60,7 +60,6 @@ func (s *Source) Provision(ctx api.StreamContext, props map[string]any) error {
if err != nil {
return err
}

if s.Url == "" {
return errors.New("url is empty")
}
Expand Down

0 comments on commit 4757a49

Please sign in to comment.