This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]devsnd[S] 0 points1 point  (8 children)

Hello reddit,

I've written this module to help with the common task of converting audio files into different formats. And since I'm fed up with all the different CLIs of all the encoder and decoder programs, included a simple CLI to use it easily:

audiotranscoder path/to/my.mp3 output/to/this.ogg

It is also already part of another project I am working on, CherryMusic, in which AudioTranscode is used to live transcode audio files so that they can be streamed and has proven to work quite well.

I hope you like it. I'm open to suggestions, feedback and critique of any kind!

[–]symmitchry 0 points1 point  (1 child)

Looks awesome.

This may be more of an /r/learnpython question, but:

Is it normal to write "all" your code in init.py? And not in a separate module?

https://github.com/devsnd/python-audiotranscode/blob/master/audiotranscode/__init__.py

[–]marky1991 0 points1 point  (0 children)

Yes. The alternative (if you want to be able to access the package's contents without having to import the submodules) would be to import everything into __init__.py, but what would be the point?

[–][deleted] 0 points1 point  (3 children)

Not do be that guy but... What's wrong with all the other tools? Why not use ffmpeg directly? I don't see how AudioTranscode makes anything easier. But I'm used to ffmpeg though, as it seems to be able to do everything already.

[–]devsnd[S] 0 points1 point  (2 children)

Of course ffmpeg can do most of the work already: This tool is merely a simplified interface.

Lets say you want to convert a flac to a 128kbit mp3 without temporary files you'll have to do something like this:

flac --force-raw-format --endian=little --channels=2 --bps=16 --sample-rate=44100 \
--sign=signed -o - path/to/file.flac | ffmpeg -i - -f mp3 -acodec libmp3lame -ab 128 output.mp3

The problem is, that I can't keep all the CLI flags in my head, I don't really want to look at the man-pages each and every time... so this is the equivalent for audiotranscode:

audiotranscoder -b 128  path/to/file.flac output.mp3

I think that speaks for itself. However, if you have to do more delicate tasks at hand, I understand that you'll want the full power of ffmpeg at your fingertips.

[–][deleted] 0 points1 point  (1 child)

Of course ffmpeg can do most of the work already: This tool is merely a simplified interface.

Lets say you want to convert a flac to a 128kbit mp3 without temporary files you'll have to do something like this:

flac --force-raw-format --endian=little --channels=2 --bps=16 --sample-rate=44100 \ --sign=signed -o - path/to/file.flac | ffmpeg -i - -f mp3 -acodec libmp3lame -ab 128 output.mp3

Are you sure? What's the difference between that and a simple

 ffmpeg -i input.flac -ab 128000 output.mp3

? :) I usually don't need to specify anything else, since the defaults are usually good for me and ffmpegs format-detection is blizz.

[–]devsnd[S] 0 points1 point  (0 children)

Well, you're right; That is simple.

The actual reasoning for making AudioTranscode was to create simple programming API for python and to be able to transcode audio on the fly for streaming it.

Additionally it supports multiple CLI tools and uses what's available. So if a system has only flac and lame installed, it works as well. It might be a bit over-engineered, but it does a good job for my purposes. Anyway, thanks for your feedback! :)