错误:参数 'Creation]/audio_section_working/1.mp3' 作为输入文件名提供,但 '/e/[Content' 已指定

问题描述

enter image description here

请帮我解决这个问题

本程序的使用:

find duration of a video and audio

代码

loc="/e/[Content Creation]/audio_section_working/1.mp3"
echo $(ffprobe -v error -show_entries format=duration /
-of default=noprint_wrappers=1:nokey=1  $loc )

错误

Argument 'Creation]/audio_section_working/1.mp3' provided as input filename,but '/e/[Content' was already specified.

在没有给出路径的情况下更早地工作,当我在文件所在的同一目录上执行 git bash 时:

echo $(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "1.mp3" )

[正如你所看到的,当我提供文件路径以查找持续时间时,它给了我错误] [给出直接路径,即“1.mp3”没有给我错误] [给出文件位置路径是给出错误,为什么? ]

img-1 location of image

img-2 code which i ran

解决方法

在前面加两行,#!/bin/bash 和 IFS=$'\n'

去掉路径的第一个斜杠,如果没有这样的文件或目录,用路径中的首斜杠检查或看文件是否存在,然后使用下一个代码

#!/bin/bash
IFS=$'\n'  
loc='e/[Content Creation]/audio_section_working/01.mp3' 
echo  $(ffprobe   -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $loc )

国王问候