tf.contrib.ffmpeg.decode_audio( contents, file_format=None, samples_per_second=None, channel_count=None, stream=None )
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
contents: The binary contents of the audio file to decode. This is a scalar.
file_format: A string or scalar string tensor 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, as an
int32tensor. 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, as an
int32tensor. If the
contentshave more than this number, then some channels will be merged or dropped. If
contentshas fewer than this, then additional channels will be created from the existing ones.
stream: A string specifying which stream from the content file should be decoded, e.g., '0' means the 0-th stream. The default value is '' which leaves the decision to ffmpeg.
A rank-2 tensor that has time along dimension 0 and channels along
dimension 1. Dimension 0 will be
length_in_seconds wide, and dimension 1 will be
wide. If ffmpeg fails to decode the audio then an empty tensor will