ffmpeg
copied
junjiejiangjjj
3 years ago
1 changed files with 67 additions and 1 deletions
@ -1,2 +1,68 @@ |
|||||
# ffmpeg |
|
||||
|
### Description |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
**Audio** **Decode** converts the encoded audio back to uncompressed audio frames. In most cases, audio decoding is the first step of an audio processing pipeline. |
||||
|
|
||||
|
|
||||
|
|
||||
|
### Interface |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
def audio_decode.${op_name}(**kwargs): |
||||
|
|
||||
|
def ${op_name}.__call__(audio) |
||||
|
|
||||
|
""" |
||||
|
|
||||
|
An audio decode operator takes an audio file path as input. It decodes the audio back to audio frames. |
||||
|
|
||||
|
**Args:** |
||||
|
|
||||
|
**audio** (str): |
||||
|
|
||||
|
Audio file path. |
||||
|
|
||||
|
**Return** (iterable): |
||||
|
|
||||
|
An iterator over audio frames with type `towhee.types.AudioFrame`. |
||||
|
|
||||
|
""" |
||||
|
|
||||
|
### Code Example |
||||
|
|
||||
|
|
||||
|
|
||||
|
Using the default audio_decode implementation and writing the pipeline in the simplified way |
||||
|
|
||||
|
```Python |
||||
|
import towhee.DataCollection as dc |
||||
|
|
||||
|
|
||||
|
|
||||
|
dc.glob(./music.flac) |
||||
|
|
||||
|
.audio_decode() |
||||
|
|
||||
|
.show() |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
|
||||
|
Using the ffmpeg based implementations of audio_decode to write a same pipeline |
||||
|
|
||||
|
```Python |
||||
|
import towhee.DataCollection as dc |
||||
|
|
||||
|
|
||||
|
|
||||
|
dc.glob['path'](./music.flac) |
||||
|
|
||||
|
.audio_decode.ffmpeg['path', 'frames']() |
||||
|
|
||||
|
.select('frames') |
||||
|
|
||||
|
.show() |
||||
|
``` |
||||
|
|
||||
|
Loading…
Reference in new issue