#author("2021-10-13T18:51:29+09:00","default:nobuoki","nobuoki") #author("2021-10-13T18:52:14+09:00","default:nobuoki","nobuoki") * 回答例 / example [#y2c7694d] #prism(bash){{{ for f in *.spc; do set -x; ffmpeg -hide_banner -loglevel error -y -i "$f" -t "$(espctag -gnL "$f")" "${f%.spc}.wav"; set +x; done }}} ** SCPとは? / What is SPC? [#fabf4c69] - [[SPC - Video Game Music Preservation Foundation Wiki>http://www.vgmpf.com/Wiki/index.php?title=SPC]] - [[Home of SNES Music ~ SNESmusic.org>http://snesmusic.org/v2/]] * 解説 / explanation [#mc4e0bf4] - spcファイルの中には、永久にループ再生する前提のものがあり、変換後にとてつもなくデカいファイルが生成されることがある Some spc files are supposed to be played in a loop forever, and after conversion, a huge file may be generated. -- [[format conversion - SPC to WAV command-line - Ask Ubuntu>https://askubuntu.com/questions/896196/spc-to-wav-command-line]] - そこで予めspcファイルのID666タグ情報を利用して1周期の長さを求め、ffmpegの(出力ファイルに対する)-t オプションを利用して、1周期ぶんだけ変換する Therefore, the length of one cycle is calculated in advance using the ID666 tag information of the spc file, and the -t option (for the output file) of ffmpeg is used to convert only one cycle. - ID666タグの読み取りは espctag コマンドを利用する Use the espctag command to read the ID666 tag 整形後 / formatted #prism(bash){{{ for f in *.spc; do # *.spc ファイル全てに対してループ / Loop for all * .spc files set -x # デバッグ用(無くても良い) / debugging (not required) ffmpeg \ -hide_banner \ -loglevel error \ -y \ -i "$f" \ -t "$(espctag -gnL "$f")" \ "${f%.spc}.wav" set +x # デバッグ用(無くても良い) / debugging (not required) done }}} * おまけ / other examples [#e7bee6d6] spcファイルの冒頭6秒のみmp3に変換、最後の1秒はフェードアウト(exponentialカーブ)、2並列で処理 #prism(bash){{{ command ls *.spc | sed 's/....$//' | xargs -P2 -tI@ ffmpeg -hide_banner -y -t 6 -i @.spc @.wav command ls *.wav | sed 's/....$//' | xargs -P2 -tI@ ffmpeg -hide_banner -y -i @.wav -af 'afade=t=out:st=5:d=1:curve=exp' @.mp3 rm *.wav }}}