1 # FFmpeg (contrib) 2 [TOC] 3 4 ## Encoding and decoding audio using FFmpeg 5 6 TensorFlow provides Ops to decode and encode audio files using the 7 [FFmpeg](https://www.ffmpeg.org/) library. FFmpeg must be 8 locally [installed](https://ffmpeg.org/download.html) for these Ops to succeed. 9 10 Example: 11 12 ```python 13 from tensorflow.contrib import ffmpeg 14 15 audio_binary = tf.read_file('song.mp3') 16 waveform = ffmpeg.decode_audio( 17 audio_binary, file_format='mp3', samples_per_second=44100, channel_count=2) 18 uncompressed_binary = ffmpeg.encode_audio( 19 waveform, file_format='wav', samples_per_second=44100) 20 ``` 21 22 * @{tf.contrib.ffmpeg.decode_audio} 23 * @{tf.contrib.ffmpeg.encode_audio} 24