Skip to content

FFtrim

Your first assignment is to build a command line tool named fftrim which replicates FFmpeg's media trimming capabilities. FFmpeg is versatile tool for media manipulation. If you work with speech data of any sort, you will be sleeping happily in nights knowing that FFmpeg exists.

In fftrim, we want to minimally replicate audio trimming feature that works like the following:

fftrim -i <input-file> -ss <start-time> -to <end-time> <output-file>
fftrim -i <input-file> -ss <start-time> -t <duration> <output-file>

# All time units are in seconds

Few notes on the assignment:

  • Your CLI tool should be installable via your language's standard method and provide a command in shell, post installation.
  • fftrim should preserve the audio format and encoding.
  • Do not call ffmpeg as subprocess. The idea is for you to understand as much as possible about audio data representation so try reading the input using a decoding library and work from there.

Note

Since this is merely an instructional program, don't put the package on public package indices like PyPI. Instead, just provide instructions on building and installing the package system wide for usage.

Once you have built the package, run the test cases to ensure that your program does what it's supposed to do. You can run tests by running make test in the exercise root.

Warning

Tests for this exercise are not working as of now. You are encouraged to listen to the generated audios to see if the tool is working as expected. Also feel free to do a pull request for fixing the tests.

Resources

Few resources that you might want to follow for working on this:

  1. Python packaging and Poetry
  2. SoundFile
  3. cli and docopt
  4. Working with audio data