WMVをプログレッシブ対応mp4

Blogに動画を貼る場合、一番簡単な方法は、Youtubeやニコニコ動画に動画ファイルをアップしておいて、そこへのリンクを貼り付けることだ。

ただ、やっぱり自前のサーバに動画ファイルを置いておきたい。ということで、あちこちにある、無料のFlash動画プレーヤー。

ふらだんすとは、(株)ストリーミング・ジャパンで提供されている無料のFlash動画プレーヤー。こいつを貼り付けておけば、mp4の動画ファイルを自分のサーバに置いて、Blogに貼り付けられる。

まぁこの手の無料のFlash動画プレーヤーはこれだけじゃなく、いろいろあるので探して欲しい。

それはさておき、この手のFlash動画プレーヤーに食わせるファイルは、flv、mp4、f4vなどが多い。

僕は、MacならばiMovie、WindowsならWindows Live Movie Makerを使って動画編集することが多いので、それらが出力する、mp4やWMVをどのように該当するファイルに変換するのに頭を抱えた。

ということで、その対策のメモ。

準備

qt-faststartの作成。Mac上で行う

shell> svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
shell> cd ffmpeg
shell> ./configure
shell> make
shell> make tools/qt-faststart

ここで作ったffmpegは使用しない。現在、僕が使用しているffmpegはmac portsで導入したもの。

shell> /opt/local/bin/ffmpeg

ffmpeg version 0.7.13, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 1 2012 21:08:35 with clang 3.1 (tags/Apple/clang-318.0.58)
configuration: –prefix=/opt/local –enable-swscale –enable-avfilter –enable-libmp3lame –enable-libvorbis –enable-libtheora –enable-libdirac –enable-libschroedinger –enable-libopenjpeg –enable-libvpx –enable-libspeex –disable-libopencore-amrnb –disable-libopencore-amrwb –mandir=/opt/local/share/man –enable-shared –enable-pthreads –cc=/usr/bin/clang –arch=x86_64 –enable-yasm –enable-gpl –enable-postproc –enable-libx264 –enable-libxvid
libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

実際の作業

Mac上で行う

wmvをmp4に変換。

shell> /out/local/bin/ffmpeg -i input.wmv -vcodec libx264 -acodec libfaac -f mp4 output.mp4

これでうまくいかなかったら、

shell> /opt/local/bin/ffmpeg -i input.wmv -vcodec libx264 -f mp4 output.mp4

いや、libfaacなんてconfigureしてないんだから、下じゃないとうまくいくわけ無いんだけど。。。

参考文献 : k3k1::log [Linux][ソフトウエア] Fedora 9 で ffmpeg で wmv 形式から mp4 (h.264+aac) 形式に変換

mp4をプログレッシブ再生に対応させるために、メタデータ(moov atom)をファイルの先頭に配置する

shell> tools/qt-faststart input.mp4 output.mp4

参考文献:bash bang Progressive download mp4 with JW Player

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください