Section2 AviSynth and frameserving のバックアップソース(No.9)

#contents
#br
***Q2.1: フレームサービング(frameserving)って何ですか?また、どんなメリットがありますか? [#l517d3ad]

A: [[[Lukes homepage]:http://neuron2.net/LVG/frameserving.html]]((Donald Graft氏によるミラーサイトです。))に素晴らしい説明があります:

"フレームサービングとは、それによって、あるプログラムから別のプログラムへと、直接、ビデオデータを転送する方法のことです。中間ファイルや一時ファイルは生成されません。ソースファイルを開いて、そのビデオデータを出力するプログラムは、フレームサーバー(frameserver)と呼ばれます。そのデータを受け取るプログラムは、どのようなタイプのビデオ・アプリケーションでも構いません。

あなたがビデオをフレームサーブしたいと思うであろう、2つの主な理由があります:

+ ディスクスペースの節約: フレームサービング・アプリケーションによって、あなたは常に、あなたのビデオがフレームサーブされているものとして、それを編集したり処理したりすることができます。フレームサービングは中間ファイルを生成しないので、あなたは追加のディスクスペースを必要とすることなく、あなたのビデオに変更を加えるためにフレームサーバーを使うことができます。たとえば、あなたが2つのビデオファイルを結合し、リサイズして、別のビデオ・アプリケーションにフィードしたいと考えるなら、フレームサービングを利用すれば、巨大な中間ファイルを作成することなく、これを行うことができます。
+ 高められる互換性: フレームサーブされたビデオを受け取るビデオ・アプリケーションにとって、入力ファイルは、比較的小さな、非圧縮のビデオファイルであるように思えます。しかし実際には、フレームサーバーが転送しているソースファイルは、たとえば非常に圧縮されたMPEG-1ビデオということもありえます。もし、あなたのビデオ・アプリケーションがMPEG-1ファイルに対応していないとしても、それは問題ではありません。なぜなら、そのアプリケーションは、フレームサーバーから標準的な非圧縮ビデオを受け取るだけだからです。フレームサービングのこの特徴は、アプリケーションが標準でサポートしていない種類のファイルを開くことを可能にします。

さらにビデオ・アプリケーションは、ソースビデオを1フレームずつフィードされるため、そのソースビデオのファイルサイズについては何も知りません。それゆえ、もしあなたのアプリケーションが、入力サイズ関して2GBないし4GBの制限を持っていたとしても、フレームサーブされたビデオには何の影響もありません。2GBの制限があるアプリケーションに、フレームサーバー経由で100GBのビデオをフィードすることもできますし、また、それによって何の問題も起こらないでしょう。"

***Q2.2: AviSynthをフレームサーバーとして使うには、どうすればいいですか? [#se564caa]

A: テキストエディタを使って、スクリプトを書きます。AviSynthにクリップを読み込み、必要なフィルタリングを行って、そのAVSファイルをエンコーダ/アプリケーション某(AVIファイルを読むことができるエンコーダなりアプリケーションでなければなりません。[[Q2.3>#content_1_2]]と[[Q2.4>#content_1_3]]参照)で読み込みます。

***Q2.3: AVSファイルをエンコーダ/アプリケーション某にフレームサーブするには、どうすればいいですか? [#o8cc88df]

A:

+TMPGEnc、CCE SP、VirtualDub、またはWMP6.4へのフレームサービング:~
単純に、TMPGEnc、CCE SP、VirtualDub、またはWMP6.4(もしくは、あなたが使用するエンコーダ/アプリケーションならどんなものでも)で、AVSファイルを開いてください。[[Q2.4>#content_1_3]]をご覧下さい。
+VFAPIへのフレームサービング:~
VFAPIのためには、[[[ReadAVS]:http://www.videohelp.com/forum/userguides/87270.php]]プラグインをインストールする必要があります。ReadAVS.dllをVFAPIリーダーのディレクトリにコピーし、regファイルをメモ帳で開いて、関連しているパスを変更します。それを保存し、ダブルクリックしてレジストリに登録します。
+PremiereやUleadへのフレームサービング:~
--Premiereへのフレームサービングのためには、"IM-Avisynth.prm"インポート・プラグインがあります。オリジナル版は、[[[Benのサイト]:http://neuron2.net/www.math.berkeley.edu/benrg/avisynth-premiere.html]]((Donald Graft氏によるミラーサイトです。))からダウンロードすることができます。改良版は、[[[Video Editors Kit sourceforge page]:http://sourceforge.net/projects/videoeditorskit/]]からダウンロードすることができます。こちらは、現在のところ、Premiere 5.x、6.xとProで動作します。
--また、[[[makeAVIS (ffdshowに含まれる)]:http://ffdshow.sourceforge.net/tikiwiki/tiki-view_articles.php]](AVI Wrapperです)というプログラムをダウンロードすることができます。[[[ディスカッション]:http://forum.doom9.org/showthread.php?s=&threadid=49964]]。AviSynth v2.52のインストールにも含まれています。Uleadのためには、このプログラムを使わなければなりません。
+ Windows Media 9 エンコーダへのフレームサービング:~
NicのWindows Media 9 エンコーダをダウンロードしてください。また、あらかじめWindows Media 9 コーデックをインストールしておいてください。ともに[[[こちら]:http://nic.dnsalias.com/WM9Enc.html]]で見つかります。

***Q2.4: エンコーダ某がAVSファイルを読み込むときに問題は? [#f438da54]

A:

+なぜTMPGEncでAVSファイルを開くことができないのですか(古いバージョンのTMPGEncで発生します)?
--TMPGEnc用のVFAPIプラグインをインストールしてください。
--TMPGEncのDirect Show Filterを無効にし、フレームサービングする前にVirtualDubのproxyを切ってください。
--AVSファイルの最後に"ConvertToRGB24"を追加してください。
--[[[Huffyuv]:http://neuron2.net/www.math.berkeley.edu/benrg/huffyuv.html]]やDivX5などのコーデックをインストールしてください。TMPGEncでAVIを読み込むときに、そのコーデックがデコードしてくれます。
--[[[ReadAVS]:http://www.vcdhelp.com/forum/userguides/87270.php]]プラグインをインストールしてください。
+AVSファイルを読み込むときに、CCE SPがクラッシュします。どうすればいいですか?
--Windows2000を使っているなら、WinNT4-SP5互換モードでCCEを動作させてください。
--AviSynth v1.0x/v2.0xでフレームサービングしているなら、たとえ音声がないAVSファイルの場合でも、"ResampleAudio(44100)"をスクリプトに追加してください。
--AviSynth v2.5xでフレームサービングしているなら、ResampleAudioのトリックはもう使えません。というのも、ResampleAudioがビデオクリップに音声ストリームを追加しないからです。その代わりに、("addaudio.avsi"と呼ばれる)スクリプトを作成して、プラグイン・ディレクトリに入れて下さい。"addaudio.avsi"については、[[[こちら]:http://www.avisynth.org/index.php?page=AddAudio]]に書かれています。
+(CCE SP v2.62/v2.64のような)エンコーダ/プレイヤーはAVSファイルを読み込めない?多くの"新しい"プログラムは、AVIファイルの読み込みにWindowsのファンクションを使用''しません''。もし、それらのプログラムが標準的なWindowsファンクションを使ってい''ない''なら、AviSynthスクリプトファイルは動作しないでしょう。それらのルーチンを使わ''ない''プログラムとして知られているのが、 CCE SP v2.62やWindows Media Encoder vx.xです。さらに、Windows Media Player 7に関する問題を報告する人もいます。
--CCE SP v2.50とWMP6.4 ("Program Files"->"Windows Media Player"以下に"mplayer2.exe"という名前のファイルがあります。これが WMP6.4です) を使ってください。Windows Media Encoderを使いたい場合は、代わりにAVIラッパー"makeAVIS"を利用することができます([[Q2.3>#content_1_2]]参照)。Windows Media Encoder 9に関しては、[[Q2.3>#content_1_2]]を見てください。
--もし、まだCCE SP v2.62を使いたいのなら、次のことを試すことができます: makeAVISでCCE SP v2.62にフレームサーブ。AVSスクリプトを作成してから、makeAVISで疑似AVIを作ってください。
--Cinemacraftは、CCE SP v2.66はAviSynthのスクリプトを受け入れることができると言っています。もし、あなたがこのバージョンを持っているのなら、間違いはないでしょう。
+不適切なYUY2コーデックは、AviSynthスクリプトをTMPGEncへフィードする際に、色空間エラーを引き起こします。私は少し前に、AviSynthスクリプトでTMPGEncへフィードすると、色空間変換エラーのような結果になることを、突然、発見しました。まるで、ビデオが24ビットから8ビットにディザー処理されたようになってしまったのです! (..)
--もし、そのような問題が起こったなら、スクリプトの最後の行に"ConvertToRGB24"を付け加えるか、[[[colorspace conversion errors]:http://forum.doom9.org/showthread.php?s=&threadid=27932]]スレッドを見て、提案された解決法を参考にしてください。

***Q2.5: Premiere/Ulead/VegasからAviSynthへフレームサーブするには、どうすればいいですか? [#kd3f4c60]

A: AviSynth互換の(インポート)フレームサーバーを試すことができます。[[[PluginPace frameserver (by Satish Kumar)]:http://www.debugmode.com/pluginpac/frameserver.php]]: SonicFoundry Vegas (および、Vegas Video/VideoFactoryの古いバージョン)、Adobe PremiereやUlead MediaStudio ProからAviSynthへのフレームサービング用。[[[ディスカッション]:http://forum.doom9.org/showthread.php?s=&threadid=51242]]。

***Q2.6: フレームサービングする時に、次のメッセージが出ました: "Script error, there is no function named "xxx (フィルタ名)"" ? [#o7ac3db4]

A: あなたは、おそらく、そのフィルタを含まないバージョンのAviSynthをインストール/登録したのでしょう。他のバージョンが、あなたのハードディスクのどこかにないか確認してください(システムディレクトリにはないにも関わらず、あるバージョンが登録されている可能性があります)。正しいバージョンが登録されているかチェックしてください。また、[[Q1.19>Section1 About AviSynth#content_1_18]]も見てください。

***Q2.7: DVD2AVI v1.77.3を使って、VirtualDubでavsファイルを読み込もうとしたところ、unrecognized exception error(未承認の例外エラー)が出たのですが? [#xf0196c8]

A: DVD2AVI v1.77.3で生成される.d2vは、mpeg2dec.dllと互換性が''ありません''! 代わりにv1.76を使ってください。それでもなお、v1.77.3を使いたいのなら、AviSynth v2.5をインストールして、mpeg2dec3.dll v1.07 (または、もっと最新のバージョン) を使うようにしてください。

***Q2.8: How do I load my clip into AviSynth (video) ? [#w4372302]

A: Make a script containing the lines (replace the filename and the path of the filename):

-AVI-files (with uncompressed WAV, or CBR/VBR MP3-audio (v2.04)):~
 AviSource("d:\filename.avi")
disabling the audio:~
 AviSource("d:\filename.avi", false)

-AVI-files that AviSource doesn't support (for example "DV type I AVI-files"):~
 DirectShowSource("d:\filename.avi")  # no audio support yet

-MPEG1-files (extension mpg):~
Have a look at the [[Mpeg decoder plugins for AviSynth v1.0x/v2.0x:http://www.avisynth.org/Section+3%3A+Filters%2C+plugins+and+colorspaces#MpegDecoders]] and the [[Mpeg decoder plugins for AviSynth v2.5x:http://www.avisynth.org/Section+3%3A+Filters%2C+plugins+and+colorspaces#MpegDecoders2]]:~
Using AviSynth v2.0x/AviSynth v2.5x and MPEGdecoder.dll:~
 LoadPlugin("d:\MPEGdecoder.dll")
 mpegsource("d:\filename.mpg")

-MPEG2-files (extension m2p or m2v):~
Have a look at the [[Mpeg decoder plugins for AviSynth v1.0x/v2.0x:http://www.avisynth.org/Section+3%3A+Filters%2C+plugins+and+colorspaces#MpegDecoders]] and the [[Mpeg decoder plugins for AviSynth v2.5x:http://www.avisynth.org/Section+3%3A+Filters%2C+plugins+and+colorspaces#MpegDecoders2]]. Some examples:~
--Using AviSynth v2.0x and mpeg2dec.dll:~
Make a DVD2AVI project file and save it (filename.d2v) and load this clip into AviSynth:~
 LoadPlugin("d:\mpeg2dec.dll")
 mpeg2source("d:\filename.d2v")
--Using AviSynth v2.5x and MPEGdecoder.dll:~
 LoadPlugin("d:\MPEGdecoder.dll")
 mpegsource("d:\filename.m2p")
or (only the video stream)~
 LoadPlugin("d:\MPEGdecoder.dll")
 mpegsource("d:\filename.m2v", -2, "raw")

-VOB-files:~
Have a look at the [[Mpeg decoder plugins for AviSynth v1.0x/v2.0x:http://www.avisynth.org/Section+3%3A+Filters%2C+plugins+and+colorspaces#MpegDecoders]] and the [[Mpeg decoder plugins for AviSynth v2.5x:http://www.avisynth.org/Section+3%3A+Filters%2C+plugins+and+colorspaces#MpegDecoders2]]. Some examples:~
--Using AviSynth v2.0x and mpeg2dec.dll:~
Make a DVD2AVI project file and save it (filename.d2v) and load this clip into AviSynth:~
 LoadPlugin("d:\mpeg2dec.dll")
 mpeg2source("d:\filename.d2v")
--Using AviSynth v2.5x and MPEGdecoder.dll:~
 LoadPlugin("d:\MPEGdecoder.dll")
 mpegsource("d:\filename1.vob+d:\filename2.vob")

-ATSC transport streams (extension *.trp or *.ts):
--Using AviSynth v2.0x:~
Download mpeg2dec2 and a special version of [[[dvd2avi]:http://www.trbarry.com/DVD2AVIT3.zip]]. Don't forget to specify the video and audio pid's in the DVD2AVI.ini file:~
 LoadPlugin("d:\mpeg2dec2.dll")
 mpeg2source("d:\filename.d2v")
--Using AviSynth v2.0x/v2.5x:
Download mpeg2dec3 v1.07 (or a more recent version) or mpegdecoder and a special version of [[[dvd2avi]:http://www.trbarry.com/DVD2AVIT3.zip]]:~
 LoadPlugin("d:\mpeg2dec3.dll")
 mpeg2source("d:\filename.d2v")
or if you want to used mpegdecoder:~
 LoadPlugin("d:\mpegdecoder.dll")
 mpegsource("d:\filename.d2v")
If both methods fail you can try [[[HDTV2MPEG2]:http://www.avsforum.com/avs-vb/attachment.php?s=&postid=1408610]] (produces non dvd compliant mpeg2 files) to create a temporary mpeg2 file and import that in AviSynth with dvd2avi. For demuxing AAC audio: use [[[TSDemux]:http://www.avsforum.com/avs-vb/showthread.php?s=&threadid=222055]].~
The Moonlight [[[Xmuxer]:http://www.moonlight.co.il/download/?dl=xmuxer]] package has also a bunch of DirectShow filters that deal with muxing and demuxing MPEG-1/2 TS and PVA files.

-PVA transport streams:
You are out of luck here. AFAIK the only option is !PVAStrumento.
The Moonlight [[[Xmuxer]:http://www.moonlight.co.il/download/?dl=xmuxer]] package has also a bunch of DirectShow filters that deal with muxing and demuxing MPEG-1/2 TS and PVA files.

-d2v-files (DVD2AVI frameserver files):~
 LoadPlugin("d:\mpeg2dec.dll")
 mpeg2source("d:\filename.d2v")

-vdr-files (VirtualDub's frameserver files):~
 AviSource("d:\filename.vdr")

-ASF-files (the framerate has to be specified, right click on the file in windows explorer):~
 DirectShowSource("d:\filename.asf", fps=15)

-tpr-files (TMPGEnc project files):
First note that the plugin GreedyHMA is proving to be a better IVTC solution (not to mention *MUCH* easier) than TMPGEnc. So if you want to use TMPGEnc for this get the GreedyHMA plugin (this plugin works in YUV-space). If you still want to import a tpr-file into an AVS-file, there are two possibilities:~
--first one: The TMPGEnc plugin is contained in the VFAPI Plugin zip file (ends with -vfp.zip) which can be download from Dooms site. (This method doesn't always work, some encoders like CCE SP can't read them.)~
 LoadVFAPIplugin("d:\TMPGenc.vfp","TMPGsource")
 TMPGsource("d:\filename.tpr")
 FlipVertical
--second one: Import the tpr-file in VFAPI, create a fake avi and then load it into AviSynth (note that VFAPI works in RGB-space). See also [[[1]:http://forum.doom9.org/showthread.php?s=&threadid=10007]].

-aup-files (AviUtl projects):
I don't know if it is possible to load it directly into AviSynth. Import the aup-file in VFAPI, create a fake avi and then load it into AviSynth (note that VFAPI works in RGB). See also [[[2]:http://forum.doom9.org/showthread.php?s=&threadid=10007]].

-QuickTime-files (see [[[3]:http://forum.doom9.org/showthread.php?s=&threadid=23139]]):~
 DirectShowSource("d:\filename.mov")
or if that doesn't work download a plugin (can be found in Dooms download section):~
 LoadVFAPIPlugin("C:\QTReader\QTReader.vfp", "QTReader")
 QTReader("C:\quicktime.mov")

-AVS-files:
Just import it at the beginning of your script:~
 Import("d:\filename.avs")
In v2.05 or a more recent version you can use the autoplugin loading. Just move your AVS-file in the autoloading plugindir, and rename the extension to 'avsi'.

***Q2.9: How do I load my clip into AviSynth (audio) ? [#d35eda2a]

A: This can be done in several ways:

-Using AviSource (with uncompressed WAV, CBR/VBR MP2-audio (starting from v2.04) or CBR/VBR MP3-audio (starting from v2.04)):~
 AviSource("d:\filename.avi")
Starting from v2.05 you can extract audio from a AVI-file in this way:~
 WavSource("d:\filename.avi")
-Use the audio decoder plugin MPASource, see [[Q3.4>Section3 Filters, plugins and colorspaces#content_1_3]] and [[Q3.5>Section3 Filters, plugins and colorspaces#content_1_4]] for importing mp1/mp2/mp3 audio.
-Put a WAV-header on your [[[mp2]:http://www.geocities.com/wilbertdijkhof/mpa2wav.zip]] or mp3 (with Besweet) audio file and use WavSource to import the audio. You also need ACM codecs for [[[mp2]:http://www.geocities.com/wilbertdijkhof/qmpeg_mp2.zip]], and for mp3 (Radium codec, see doom's download section). Use WavSource to load the WAV:~
 WavSource("d:\filename.wav")

Up to v2.07 the audio must be mono or stereo. Starting from v2.5 you can also import uncompressed multichannel audio.

***Q2.10: Can I load an audio file other than a WAV-file? [#b6864c01]

A: Yes:

-Uncompressed audio files (that is uncompressed WAV-files) can be loaded in all versions up to v2.03.
-Starting from v2.04 compressed WAV-files can be loaded (currently only MP2/MP3-files with a WAV-header).
-Starting from v2.5 you can also load uncompressed multichannel audio.
-Using the MPASource and AC3filter plugins you can import mp1/mp2/mp3 and AC3 audio.

See also [[Q2.9>#content_1_8]].

***Q2.11: How do I join video and audio ? [#z3cbd154]

A: Make an avs-file containing the lines (change the filenames and paths):

 video = AviSource("d:\filename1.avi")
 audio = ((AviSource|WavSource))("d:\filename2.wav")
 AudioDub(video, audio)

***Q2.12: I get an unrecognized exception in the line I use DirectShowSource? [#sd538e48]

A: Have you got VobSub installed? Have a look at this [[[thread]:http://forum.doom9.org/showthread.php?s=&threadid=34350]]. Upgrade to VobSub v2.20 or higher. If someone has an explanation, please post it in the thread.