mp4 をitunesに取り込んだら残念な感じ
「不明なアーティスト」にすべて分類される。
スクリーンショット 2014-11-16 16.24.10
ホームビデオに分類されて動画が行方不明になるので、ミュージックビデオにするとミュージックに出てくる
id3tags で音楽情報が書き換えられるようにmp4tags で動画情報を手軽に扱うことが出来る。
これをチャントフォルダに放り込みたい
iTunesのフォルダは、ファイルのメタデータを使って分類しているため、手作業でフォルダを作っても、徒労に終わる。(細かいことを言えば、iTunesに自動で管理のチェックを外しておけば、フォルダ構成は維持されるんだけど、自動管理チェック外す人はいないと思う)
mp4 ファイルにタグをつける
簡単なのはmp4tags コマンドを使う。m4a やmp4 はこっちを使う。
アーティスト名を変更してみる
mp4tags -a "初音ミク" "/Users/takuya/Music/iTunes/iTunes Media/Music/Unknown Artist/Unknown Album/sm24902307-【Miku hatsune】Ageage Again【PV】.mp4"
itunesを起動すると、itunesがフォルダを監視しているので、自動的に該当フォルダに仕分けられる。
便利。
サムネイルも変換できる
MP4のサムネイルも変更できます
好きな位置でサムネイルを作って
ffmpeg -i "sm24902307-【Miku hatsune】Ageage Again【PV】.mp4" -vframe -ss 168 -fimage2 out.jpg
サムネイルをmp4 ファイルにタグとして登録する
mp4tags -picture out.jpg "/Users/takuya/Music/iTunes/iTunes Media/Music/初音ミク/Unknown Album/sm24902307-【Miku hatsune】Ageage Again【PV】.mp4"
変更された。
スクリーンショット 2014-11-16 16.31.03
mp4tags のインストール
brew install mp4v2
windowsなひとはバイナリのダウンロード
https://code.google.com/p/mp4v2/downloads/detail?name=mp4v2-r479-windows-binaries.zip&can=2&q=
あとはこれを find と組合せて使えば最強
cd ~/Music
find . -type f -name "*ミク*.mp4" -exec mp4tags -a "初音ミク" {} \;
ただし、find -exec は処理が遅いので、 xargs がオススメ
find ./iTunes/iTunes\ Media/Music/ -type f -name "*.mp4" | xargs -P0 -I@ mp4tags -g ニコニコ動画 @
使い方は至ってシンプル
takuya@rena:~/Desktop$ mp4tags
mp4tags: You must specify at least one MP4 file.
usage mp4tags OPTION... FILE...
Adds or modifies iTunes-compatible tags on MP4 files.
-help Display this help text and exit
-version Display version information and exit
-A, -album STR Set the album title
-a, -artist STR Set the artist information
-b, -tempo NUM Set the tempo (beats per minute)
-c, -comment STR Set a general comment
-C, -copyright STR Set the copyright information
-d, -disk NUM Set the disk number
-D, -disks NUM Set the number of disks
-e, -encodedby STR Set the name of the person or company who encoded the file
-E, -tool STR Set the software used for encoding
-g, -genre STR Set the genre name
-G, -grouping STR Set the grouping name
-H, -hdvideo NUM Set the HD flag (1\0)
-i, -type STR Set the Media Type(tvshow, movie, music, ...)
-I, -contentid NUM Set the content ID
-j, -genreid NUM Set the genre ID
-l, -longdesc STR Set the long description
-L, -lyrics NUM Set the lyrics
-m, -description STR Set the short description
-M, -episode NUM Set the episode number
-n, -season NUM Set the season number
-N, -network STR Set the TV network
-o, -episodeid STR Set the TV episode ID
-O, -category STR Set the category
-p, -playlistid NUM Set the playlist ID
-P, -picture PTH Set the picture as a .png
-B, -podcast NUM Set the podcast flag.
-R, -albumartist STR Set the album artist
-s, -song STR Set the song title
-S -show STR Set the TV show
-t, -track NUM Set the track number
-T, -tracks NUM Set the number of tracks
-x, -xid STR Set the globally-unique xid (vendor:scheme:id)
-X, -rating STR Set the Rating(none, clean, explicit)
-w, -writer STR Set the composer information
-y, -year NUM Set the release date
-z, -artistid NUM Set the artist ID
-Z, -composerid NUM Set the composer ID
-r, -remove STR Remove tags by code (e.g. "-r cs"
removes the comment and song tags)
参考資料
mp4tagsを使って動画ファイルの整理をするメモ (blog@browncat.org)
2016-05-01 追記
ffmpeg でも同じことが出来るようです。
ffmpeg \ -metadata title="Video Title"\ -metadata artist="Video Artist"\ -metadata genre="Video Genre"\ -metadata comment="Video Comment" \ -acodec copy -vcodec copy -i "inputfile.mp4" out.mp4
http://askubuntu.com/questions/29513/tag-and-manage-video-files
2023/09/26 追記 / Debian MultiMedia
debian で つかうときは、インストールが必要
apt-get install mp4v2-utils
mp4v2-utilsには debian multimedia が必要
## wget https://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb dpkg -i deb-multimedia-keyring_2016.8.1_all.deb ## echo deb https://www.deb-multimedia.org $(lsb_release -sc) main non-free \ | tee /etc/apt/sources.list.d/debian-mutltimedia.list # apt update # apt install mp4v2-utils
ちょっと面倒くさいから、やっぱりffmpeg でやるべきかもしれない。
関連資料
ニコニコ動画をダウンロードする。Rubyで。 - それマグで!