0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

mp4 ファイルにサムネイル付ける

Posted at

前置き

ffmpeg コマンドは実に豊富なオプションが用意されちょるのだが、使う機会の低い引数群は忘れがち💦
じゃけ、今回は過去に書いちょる ffmpeg コマンドでサムネイルを埋め込むってヤツを、シェルスクリプト化して、手抜きをして見る作戦w

add_thumbnail.sh
#!/bin/sh
if test $# = 0
then
echo Usage `basename $0` \"aac or m4a file\" \"thumbnail file\"
exit
fi

FILE=$(basename $1 | awk -F. '{print$1}')
EXT=$(basename $1 | awk -F. '{print$2}')

if test ${EXT} = "m4a" -o ${EXT} = "aac"
then
ffmpeg -hide_banner -i ${FILE}.${EXT} -i $2 -map 0:a -map 1:v -c copy -disposition:1 attached_pic ${FILE}_thumbnail.${EXT}
else
echo Unsupported files.
fi

exit

余談

毎回書いちょるシェルスクリプトに一貫性が無いのは性格上の問題じゃけ、統一化に向けての提案お待ちしとりますm(__)m

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?