Reputation: 1004
I am working on a php script that will blend two audio files into one using ffmpeg's amix feature and $ variables. It is set to automatically trim the final output's duration to the first inputs duration. (as seen with duration=first)
When I run this script it is not creating mixtest.mp3
mix.php:
<?php
$input1 = 'original.mp3'; // Original Track
$input2 = 'tagoverlay.mp3'; // Audio Tag Overlay
$output = 'mixtest.mp3';
shell_exec('ffmpeg -i ' . $input1 . ' -i ' . $input2 . ' -filter_complex amix=inputs=2:duration=first:dropout_transition=3 ' . $output . '');
echo 'Done';
?>
I am already using ffmpeg on server to convert wav's to mp3 and it works great. I have also seen sox can do this as well with -m, which I have installed and tried, for some reason it is not exporting the mixtest.mp3.
Upvotes: 1
Views: 1226
Reputation: 1004
After messing around and switching the variables I got it to work, It may have been file permissions issue, also i got rid of dropout_transition, according to ffmpeg documentation it defaults to 2:
$file_path = 'beats/' . $timecode . '.' . $file_extn;
$overlay = 'beats/tagoverlay.mp3';
shell_exec('ffmpeg -i ' . $file_path . ' -i ' . $overlay . ' -filter_complex amix=inputs=2:duration=first beats/' . $timecode . 'tagged.mp3');
Upvotes: 1