contrib.ffmpeg.decode_audio

tf.contrib.ffmpeg.decode_audio

tf.contrib.ffmpeg.decode_audio

decode_audio(
    contents,
    file_format=None,
    samples_per_second=None,
    channel_count=None
)

Defined in tensorflow/contrib/ffmpeg/ffmpeg_ops.py.

See the guide: FFmpeg (contrib) > Encoding and decoding audio using FFmpeg

Create an op that decodes the contents of an audio file.

Note that ffmpeg is free to select the "best" audio track from an mp4. https://trac.ffmpeg.org/wiki/Map

Args:

  • contents: The binary contents of the audio file to decode. This is a scalar.
  • file_format: A string specifying which format the contents will conform to. This can be mp3, mp4, ogg, or wav.
  • samples_per_second: The number of samples per second that is assumed. In some cases, resampling will occur to generate the correct sample rate.
  • channel_count: The number of channels that should be created from the audio contents. If the contents have more than this number, then some channels will be merged or dropped. If contents has fewer than this, then additional channels will be created from the existing ones.

Returns:

A rank 2 tensor that has time along dimension 0 and channels along dimension 1. Dimension 0 will be samples_per_second * length wide, and dimension 1 will be channel_count wide. If ffmpeg fails to decode the audio then an empty tensor will be returned.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/ffmpeg/decode_audio

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部