开发者

Is there a best practice for concatenating MP3 Files, adjusting sample rates to match, while preserving original files?

开发者 https://www.devze.com 2023-02-03 05:35 出处:网络
Does anyone know if there is a \"best practice\" to concatenate mp3 files to create new files, while 开发者_高级运维preserving the original files?

Does anyone know if there is a "best practice" to concatenate mp3 files to create new files, while 开发者_高级运维preserving the original files?

I am working on a CentOS Linux machine, in command line. I will eventually call the command line from a PHP script.

I have been doing research and I have come up with a process that I think could work. It combines general advice from different forums, blogs, and sources like this one.

So here I go:

  1. Create a temporary folder
  2. Loop through files to create a new, converted copy, of file into a "raw" format (which one, I don't know. I didn't know "raw" files existed before too long ago. I could use some suggestions on this)
  3. Store the path to the temporary files, in the temporary folder, and then loop through the files to concatenate them and then put the new merged file the final "processed directory"
  4. Delete the contents of the temporary file with the temporary raw files inside.
  5. Convert the final file from "raw" to mp3 and enjoy the finished result

I'm thinking that this course of action might be best because I can't necessarily control the quality of the original "source" mp3s.

The only other option I could think of would be to create a script that would perform a similar process upon files being added to the system leaving only the files with the "proper" format and removing the original "erroneous" file.

Hopefully you can see that I have put some thought into this and that I'm trying to leverage the collective knowledge of this community to choose the best direction.

Perhaps there is a better path that I could take?

By concatenate, I mean to join together in sequence to create a new audio file from the "concatenated files."

I currently have the following installed: - Sox - FFMpeg

I'm currently using the sox like this:

sox file1.mp3 file2.mp3 newfile.mp3


By using 'cat' command? This will mangle the mp3 file format by "creating an array" (as it were) of mp3 files within a single mp3 file, with the resultant mp3 working only if the player software is smart enough. So, if you can find and install mp3wrap you could:

mp3wrap output.mp3 `ls -1 *.mp3 | sort`
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号