ffmpeg not working with filenames that have whitespace

前端 未结 6 775
小鲜肉
小鲜肉 2020-12-09 17:35

I\'m using FFMPEG to measure the duration of videos stored in an Amazon S3 Bucket.

I\'ve read the FFMPEG docs, and they explicitly state that all whitespace and speci

6条回答
  •  再見小時候
    2020-12-09 18:38

    for fileOne in *.mp4
    do
      baseName=$(basename "$fileOne" .mp4) # "$fileOne" quotes are necessary because of special chars in it
      echo "input: " $fileOne
      echo "var: " $baseName
      echo "target: " $baseName".mp3"
      cp "$fileOne" "tmp.mp4"
      # ffmpeg problem with specialchars like whitespaces and '-'
      # ffmpeg -i \"$fileOne\" "$baseName..mp3"
      ffmpeg -i "tmp.mp4" "tmp.mp3"
      mv "tmp.mp3" "$baseName".mp3""
    done
    rm "tmp-mp4"
    

    `just rename the file for the conversion :)

提交回复
热议问题