UtVideo codec
ゴールデンウイークは動画ファイルの整理をしようと決めていたんですよ。ffmpegをインストールして、動画ファイルのいらない部分をカットして、ファイルサイズを小さくしようと。
で、ffmpegをbuildしようとすると、"--enable--libutvideo" というオプションを発見しました。
わたしがニコニコ動画に投稿する場合(これとか)、UtVideo codecで録画して、AviUtlで編集してh.264に変換後にニコニコ動画にアップロードしています。
なので、"--enable--libutvideo" を有効にしたいのですが、ffmpeg側の仕様により、UtVideoの最新版は使えないということが分かるまで約2日かかりました。その辺の話はffmpegのバグレポートサイトに報告済みなので詳しくは書きませんが。
で、こちらで作者様になんとかできませんか?と、すがってみたものの、それは作者が想定する目的外の使用方法とのことで、将来的にはどうするかは言えないけれども、現在のところ対応する予定はないとのこと。
それはそれで気長に待つとして、ゴールデンウイークはとりあえず動くものが欲しいということで、なんとか古いバージョンのUtVideoでffmpegとlinkさせて、ffplayでutvideoコーデックの動画ファイルを再生できるところまでこぎつけました。
で、HomebrewにUtVideoの libutvideo をbuildするスクリプトがなかったため、新しく作って pull requestを出したところ、「UtVideoには専用のwebサイトがない」という理由で却下されました。なんだそりゃ。
OSX用、Unofficial Homebrewスクリプト
- UtVideo ver. 14.2.1
- utvideo@14.rb
class Utvideo14 < Formula desc "Ut Video is lossless video codec." homepage "http://umezawa.dyndns.info/wordpress/?cat=28" url "http://umezawa.dyndns.info/archive/utvideo/utvideo-14.2.1-src.zip" sha256 "1e7fb0910f5a01fadbd7cb59480f7e65f8fffd91d57217f6adfcdebc93c4c2d1" resource "buildsystem" do url "https://github.com/qyot27/libutvideo.git", :branch => "15.1.0", :revision => "496f73af6ef04768d6553bc27d5de679b84236b7" end def install resource("buildsystem").stage do buildpath.install ["configure", "GNUmakefile", "config.guess", "config.sub"] end system "./configure", "--optlevel=3", "--enable-shared", "--disable-static", "--prefix=#{prefix}" inreplace "config.mak", " -s", "" system "make" inreplace buildpath/"libutvideo.pc", "lstdc++", "lc++" system "make", "install" end end
- UtVideo ver. 15.3.0
- utvideo@15.rb
class Utvideo15 < Formula desc "Ut Video is lossless video codec." homepage "http://umezawa.dyndns.info/wordpress/?cat=28" url "http://umezawa.dyndns.info/archive/utvideo/utvideo-15.3.0-src.zip" sha256 "81c93718bedb7f8fc324bfaa892a6380ea8df069b665d6ee732498b07032a935" resource "buildsystem" do url "https://github.com/qyot27/libutvideo.git", :branch => "buildsystem", :revision => "d2057eb3ea30d99041256a02d64f68d3935847e6" end def install resource("buildsystem").stage do buildpath.install ["configure", "GNUmakefile", "config.guess", "config.sub"] end # buildsystem supports 15.2.0, 4 files are added from 15.2.0 to 15.3.0. mv buildpath/"GNUmakefile", buildpath/"GNUmakefile.org" system "cat GNUmakefile.org |sed -e \'75s/^/utv_logl\\/LogPath.o\\\\\\\nutv_logl\\/LogReader.o\\\\\\\nutv_logl\\/LogUtil.o\\\\\\\nutv_logl\\/LogWriter.o\\\\\\\n/\' > GNUmakefile" system "./configure", "--optlevel=3", "--enable-shared", "--disable-static", "--prefix=#{prefix}" inreplace "config.mak", " -s", "" system "make" inreplace buildpath/"libutvideo.pc", "lstdc++", "lc++" system "make", "install" end end
- Unofficial patch
- ffmpeg 3.0.2にてUtVideo 15.3.0をリンクさせる時に要ると思われる。自己責任かつノークレームでお願いします。
diff -uprN ./org/ffmpeg-3.0.2/libavcodec/libutvideodec.cpp ./patch/ffmpeg-3.0.2/libavcodec/libutvideodec.cpp --- ./org/ffmpeg-3.0.2/libavcodec/libutvideodec.cpp 2016-03-29 11:27:11.000000000 +0900 +++ ./patch/ffmpeg-3.0.2/libavcodec/libutvideodec.cpp 2016-05-07 09:24:04.000000000 +0900 @@ -150,7 +150,7 @@ static int utvideo_decode_frame(AVCodecC pic->key_frame = 1; /* Decode the frame */ - utv->codec->DecodeFrame(utv->buffer, avpkt->data, true); + utv->codec->DecodeFrame(utv->buffer, avpkt->data); /* Set the output data depending on the colorspace */ switch (avctx->pix_fmt) { diff -uprN ./org/ffmpeg-3.0.2/libavcodec/libutvideoenc.cpp ./patch/ffmpeg-3.0.2/libavcodec/libutvideoenc.cpp --- ./org/ffmpeg-3.0.2/libavcodec/libutvideoenc.cpp 2016-03-29 11:25:17.000000000 +0900 +++ ./patch/ffmpeg-3.0.2/libavcodec/libutvideoenc.cpp 2016-05-07 09:24:04.000000000 +0900 @@ -131,8 +131,7 @@ FF_ENABLE_DEPRECATION_WARNINGS /* Get extradata from encoder */ avctx->extradata_size = utv->codec->EncodeGetExtraDataSize(); utv->codec->EncodeGetExtraData(info, avctx->extradata_size, in_format, - avctx->width, avctx->height, - CBGROSSWIDTH_WINDOWS); + avctx->width, avctx->height); avctx->extradata = (uint8_t *)info; /* Set flags */