Open allensuvorov opened 8 months ago
Yea now if we just prep exactly what that CBO python script is doing in go and pass the exact flags, it will be a great contribution. No go engineer wants python installed if they dont have to.
Plus the added benefits of just doing a go install and I will update this to accept better argument handlers and documentation for help on the arguments.
It does support flac too, so if you have a flac file or get one online to test, you basically can process one file for each test run and keep copying the file into your test directory.
Thanks Allen for the contribution, I just havent had the need to use this again lately, but its a super simple conversion and port and chat gpt is a base contributor 😉
The maintainer of the python abandoned his script
https://github.com/MadaooQuake/cboMP3/pull/1
It works well with setting up the ffmpeg flags.
If you wanna go over a call about his code lmk.
If you cant get this working in 2 weeks of spare time, we should re-review your coding knowledge.
I can definitely teach you a bit about maybe the channels I got going on to process 10 at a time.
Once we are done collaborating, I will add it to make it a flag as far as how many go routines are spiking your CPU processing thousands of songs concurrently.
Ok, hope my dizzy %) brain is getting closer to seeing the full picture:
Basically we need to teach our Go code to make direct calls to the locally installed ffmpeg, without those 3 python dependencies:
If that's so, I could start with reviewing what it takes to make a call to ffmpeg from our Go function. Right?
Really appreciate your guidance and this opportunity for a collaboration with you. Hope after I am done nursing my cold you will also have some time and we can jump on a call.
And the fact this project is based on concurrency is also exciting.
Quick update. Playing around, I got nothing Burger working with this function calling ffmpeg directly. Had to make it write to a new file name, otherwise it's pretty simple.
Just wanted to see it working without all the python libs.
func convertTo128kbps(inputFile string) error {
inputFileName := filepath.Base(inputFile)
outputFileName := "new_" + inputFileName
outputFile := filepath.Join(filepath.Dir(inputFile), outputFileName)
cmd := exec.Command("ffmpeg", "-i", inputFile, "-b:a", "128k", outputFile)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return fmt.Errorf("error converting file: %w", err)
}
return nil
}
Cool check chat gpt output. It's very close to what and how cbo handles it. Cbo does read the current bit rate On a file and only processes files over your desired rate. Not sure how it flags variable bit rate vs static.
Cbo does a lot more with sending different flags for flac files and there's something else too. Can remember. Read the code a bit and we can get on a discord call to review the ais code.
Cool project. I got it working on a test run. Here is what I understand:
This tool is automation of changing bitrate for mp3 files in bulk (from a folder including subfolders). That's instead of running ffmpeg on files one by one with a command like this: ffmpeg -i input.mp3 -codec:a libmp3lame -b:a 128k output.mp3 (which also works)
Currently that automation uses a couple of python tools: ffmpy and mutagen. And we want to get rid of them, and have our tool run ffmpeg without them.