@@ -386,16 +386,24 @@ public function getAudioUrl($filePath, $audioOptions): string
386386
387387 // Assemble the destination path and final ffmpeg command
388388 $ destAudioPath .= $ destAudioFile ;
389-
390- if ($ audioOptions ['stripMetadata ' ]) {
389+ // Handle the `stripMetadata` setting
390+ $ stripMetadata = false ;
391+ if (!empty ($ audioOptions ['stripMetadata ' ])) {
392+ $ stripMetadata = $ audioOptions ['stripMetadata ' ];
393+ }
394+ if ($ stripMetadata ) {
391395 $ ffmpegCmd .= ' -map_metadata -1 ' ;
392396 }
393-
397+ // Add the file format
394398 $ ffmpegCmd .= ' -f '
395399 .$ thisEncoder ['fileFormat ' ]
396400 .' -y ' .escapeshellarg ($ destAudioPath );
397-
398- if (!$ audioOptions ['synchronous ' ]) {
401+ // Handle the `synchronous` setting
402+ $ synchronous = false ;
403+ if (!empty ($ audioOptions ['synchronous ' ])) {
404+ $ synchronous = $ audioOptions ['synchronous ' ];
405+ }
406+ if (!$ synchronous ) {
399407 $ ffmpegCmd .=' 1> ' .$ progressFile .' 2>&1 & echo $! ' ;
400408 // Make sure there isn't a lockfile for this audio file already
401409 $ lockFile = sys_get_temp_dir ().DIRECTORY_SEPARATOR .$ destAudioFile .'.lock ' ;
@@ -418,8 +426,8 @@ public function getAudioUrl($filePath, $audioOptions): string
418426 } else {
419427 // Kick off the transcoding
420428 $ this ->executeShellCommand ($ ffmpegCmd );
421-
422- if ($ audioOptions [ ' synchronous ' ] ) {
429+
430+ if ($ synchronous ) {
423431 Craft::info ($ ffmpegCmd , __METHOD__ );
424432 $ url = $ settings ['transcoderUrls ' ]['audio ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
425433 $ result = Craft::getAlias ($ url ).$ destAudioFile ;
0 commit comments