Combining the MP3 Files
To do this you simply need to open a terminal and follow the below "template / guide":
1 | cat mp3file1.mp3 mp3file2.mp3 mp3file3.mp3 > combined1-3.mp3 |
The above command will work as long as you CD'ed to the directory holding the MP3 files, you can define the full path instead to not have to change directories. Once the CAT command combined the 3 files into 1 file, you can add ID3 tag information back onto the file using the eyeD3 command as well, just do a eyeD3 --help for tag types etc. Now that was pretty simple!
Ending Notes
Although the ID3 tag removal may not be necessary, it is still a good idea to do. Combining MP3 files like so makes it seamless and easy, especially to incorporate into your own Shell Script which can be as robust as you would like it to. For me, I used PHP to accomplish an easy MP3 combiner. For a reference, I decided to post the script I created to do this here. Questions feel free to let me know, the script should be well commented!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <?php /* * Author: Frost of Slunked * Site: http://www.slunked.com * Date: 2/20/2010 */ // Function usage example combineMp3s("/path/to/mp3files/", "/path/to/output_folder/", 10); /************************************************ * function name - combineMp3s * description - Takes in parameters to go through * a directory and gathers the number set of mp3's * to combine into one file. * * parameters: * @param $dir String - Directory to look in * @param $outputdir String - Directory to output combined files to * @param $combine_num - Number of files to combine * @param $prefix String - Optional prefix for file names * @param $ext String - Optional extension (incase .mp3 is .MP3) * @return void ************************************************/ function combineMp3s($dir, $outputdir, $combine_num, $prefix="combined_", $ext="*.mp3") { $i=$x=1; $files = glob($dir . $ext); foreach ($files as $file) { if (($i % $combine_num) == 0 || count($files) == $i) { // Combine the files for combining // into a command to be executed by system $cmd = "cat " . implode(" ", $temp) . " > \"{$outputdir}{$prefix}" . $x++ . ".mp3\""; // execute the command, use output buffering // to have a clean output ob_start(); system($cmd, $return); ob_end_clean(); // test if the command executed properly if ($return != 0) trigger_error("The command {$cmd} did not execute properly.\n"); else echo "The command executed with return result: {$return}<br />\n"; $temp = array(); } // assign the files to an array for imploding. $temp[$i++] = '"' . $file . '"'; } return true; } ?> |
