save the audio but make sure before saving remove the special character sapce use this regexp String sanitizeFileName(String fileName) { // Remove special characters and replace spaces with underscores return fileName .replaceAll(RegExp(r'[^\w\s.]'), '') // Remove special characters .replaceAll(RegExp(r'\s+'), '_') // Replace spaces with underscores .replaceAll(RegExp(r'.+'), '.') // Ensure only single dots .toLowerCase(); // Convert to lowercase }
use command like this '-i "$outputPath" -i "$audioPath" -map 0:v -map 1:a -c:v copy -c:a aac "$finalOutputPath"';