AviSource のバックアップの現在との差分(No.2)


  • 追加された行はこの色です。
  • 削除された行はこの色です。
 AviSource(string filename [, ... ], [bool audio = true], [string pixel_type = YV12], [string fourCC])
#pre{{
AVISource (string filename [, ...], bool "audio" = true, string "pixel_type" = YV12, [string fourCC])
OpenDMLSource (string filename [, ...], bool "audio" = true, string "pixel_type" = YV12, [string fourCC])
AVIFileSource (string filename [, ...], bool "audio" = true, string "pixel_type" = YV12, [string fourCC])
WAVSource (string filename [, ...])
}}

 OpenDMLSource(string filename [, ... ], [bool audio = true], [string pixel_type = YV12], [string fourCC])
AVISource は、引用符で囲まれた 1 つ以上のファイル名を実引数として取り、Video-for-Windows の「AVIFile」インターフェイスか AviSynth 組み込みの(VirtualDub から取り入れられた) OpenDML コードを使って、ファイルを読み込みます。このフィルタは、AVIFile ハンドラを持つどんなファイルをも読み込むことができます。これには、AVI ファイルだけでなく、WAV ファイル、AVS (AviSynth スクリプト)ファイルや VDR (VirtualDub フレームサーバー)ファイルも含まれます。実引数として複数のファイル名を指定した場合、それらのクリップは、UnalignedSplice を使って継ぎ合わされる(spliced)でしょう。audio パラメータはオプションで、デフォルトは true です。

 AviFileSource(string filename [, ... ], [bool audio = true], [string pixel_type = YV12], [string fourCC])
AVISource フィルタは、ファイルのタイプを決定するためにそのファイルを調べ、AVIFile ハンドラか OpenDML ハンドラのいずれか適切な方へ渡します。どちらか一方のハンドラでトラブルが生じた場合には、OpenDMLSource フィルタや AVIFileSource フィルタを使用することもできます。これらのフィルタは、いずれか一方のハンドラを強制的に使用します。どちらのハンドラも通常の(2GB 未満の) AVI ファイルについては読み取ることができますが、2GB 以上の AVI ファイルを読み取れるのは OpenDML ハンドラだけで、逆に WAV、VDR や AVS のようなその他のファイルタイプを読み取ることができるのは AVIFile ハンドラだけです。

 WavSource(string filename [, ... ])
v2.04 まで、WAVSource は AVIFileSource の別名でした。それ以降のバージョンでは、WAVSource はもうビデオストリームを開こうとはしません。これは、オーディオストリームを取り出したいにもかかわらず、ビデオストリームが破損していたり、圧縮方法があなたのシステムでサポートされていないような場合に役に立ちます。

AviSource takes as argument one or more file name in quotes, and reads in the file(s) using either the Video-for-Windows "AVIFile" interface, or AviSynth's built-in [[OpenDML]] code (taken from VirtualDub). This filter can read any file for which there's an AVIFile handler. This includes not only AVI files but also WAV files, AVS (AviSynth script) files, and VDR (VirtualDub frameserver) files. If you give multiples filenames as arguments, the clips will be spliced together with UnalignedSplice. The bool argument is optional and defaults to "true".
v2.04 から、ACM (Audio Compression Manager)音声(例えば mp3-AVI)に対して内部サポートしています。また AVISource は、もう WAV ファイルを開くことはできません。WAV ファイルについては、WAVSource を使ってアクセスしなければなりません。

The AviSource filter examines the file to determine its type and passes it to either the AVIFile handler or the OpenDML handler as appropriate. In case you have trouble with one or the other handler, you can also use the OpenDMLSource and AviFileSource filters, which force the use of one or the other handler. Either handler can read ordinary (< 2GB) AVI files, but only the OpenDML handler can read larger AVI files, and only the AVIFile handler can read other file types like WAV, VDR and AVS.
v2.06 から、'''pixel_type''' パラメータ(デフォルト YUY2)を使って、デコーダの出力フォーマットを選択することができます。有効な値は、"YUY2"、"RGB32" と "RGB24" です。省略された場合、AviSynth は、デコーダによってサポートされているフォーマットのうち、(YUY2、RGB32、RGB24 の順番で)最初のフォーマットを使用します。映像が非圧縮フォーマットの場合にはデコーダが使用されないため、このパラメータは何の効果もありません。v2.5 から、'''pixel_type''' パラメータのデフォルトは、YV12 に変更されました。別の言葉に置き換えるなら、'''pixel_type''' パラメータを指定しなかった場合、AVISource フィルタはその AVI を YV12 として出力しようと試み、もしそれが不可能なら YUY2 として、さらにそれも無理なら RGB として出力します。

Up to v2.04, WavSource was an alias to AviFileSource. In later versions, WavSource doesn't try to open the video stream anymore. It can be useful if you want to retrieve the audio stream from an AVI file but the video stream is damaged or its compression method is not supported on your system.
AviSynth v2.5 で DivX のクリップを読み込むと、(5.02 以前の) DivX のバグにより、色がおかしくなることがあります(色差チャンネルの U と V がスワップされます)。それを訂正するために、SwapUV を使用することができます。

From v2.04 up there is built-in support for ACM (Audio Compression Manager) audio (e.g. mp3-AVIs). AviSource is also no longer able to open WAV-files, which must be accessed by using WavSource
v2.53 から、AVISource は、DV type 1 形式のビデオ入力も開くことができます(映像のみ、音声不可)。

From v2.06 the pixel_type parameter (default YUY2) allows you to choose the output format of the decompressor. Valid values are "YUY2", "RGB32" and "RGB24". If omitted, AviSynth will use the first format supported by the decompressor (in the following order: YUY2, RGB32, RGB24). This parameter has no effect if the video is in an uncompressed format (YUY2, RGB32 or RGB24), because no decompressor will be used in that case. From v2.5 the default pixel_type parameter is changed to YV12. To put it in different words: if you don't specify something it will try to output the AVI as YV12, if that isn't possible it tries YUY2 and if that isn't possible it tries RGB.
v2.55 から、'''fourCC''' オプションが追加されています。fourCC は、おもに AVI に関連した、メディアファイルの先頭にある 4 文字のコード(FOUR Character Code)のことで、そのファイルをデコードするためにあなたのシステムがどのコーデックを使用するべきかを教えてくれます。このオプションを使うと、AviSource に強制的に別のコーデックを使って AVI ファイルを開かせることができます。FOURCC の一覧表は、[[こちら:http://www.fourcc.org/index.php?http%3A//www.fourcc.org/codecs.php]] にあります。デフォルトでは、その AVI の fourCC が使用されます。

Sometimes the colors will be distorted when loading a DivX clip in AviSynth v2.5 (the chroma channels U and V are swapped), due to a bug in [[DivX]] (5.02 and older). You can use [[SwapUV>Swap]] to correct it.
MJPEG コーデックや DV コーデックの中には、AVISource を使った時に、ITU-R BT.601 に適合した正しい出力を返さないものもあります。この問題は、コーデックの入出力のカラーフォーマットが異なる場合に起こります。例えば、入力のカラーフォーマットが YUY2 で出力のカラーフォーマットが RGB である場合や、またその逆の場合などがそうです。これを解決するには、次の 2 つの方法があります:

From v2.53 AVISource can also open DV type 1 video input (only video, not audio).
1) 強制的に出力を入力のカラーフォーマットと同じにする。例えば、以下のように(入力が RGB の場合):

From v2.55, an option fourCC is added. FourCC, is a FOUR Character Code in the beginning of media file, mostly associated with avi, that tells what codec your system should use for decoding the file. You can use this to force AviSource to open the avi file using a different codec. A list of FOURCCs can be found [[[here]:http://www.fourcc.org/index.php?http%3A//www.fourcc.org/codecs.php]]. By default, the fourCC of the avi is used.
#pre{{
AVISource("file.avi", pixel_type="RGB32")
}}

Some MJPEG/DV codecs do not give correct CCIR 601 compliant output when using AVISource. The problem could arise if the input and output colorformat of the codec are different. For example if the input colorformat is YUY2, while the output colorformat is RGB, or vice versa. There are two ways to resolve it:
2) [[ColorYUV]] フィルタを使って補正する:

1) Force the same output as the input colorformat. Thus for example (if the input is RGB):
#pre{{
AVISource("file.avi").ColorYUV(levels="PC->TV")
}}

 AVISource("file.avi", pixel_type="RGB32")
関連スレッド:~
[[MJPEG codecs:http://forum.doom9.org/showthread.php?s=&postid=330657]]~
[[DV codecs:http://forum.doom9.org/showthread.php?s=&threadid=58110]]

2) Correct it with the filter [[ColorYUV]]:
''使用例:''

 AVISource("file.avi").ColorYUV(levels="PC->TV")
#pre{{
# C プログラマのメモ: バックスラッシュ(訳者註: 日本語環境では、円記号(\)で表示されることが多い。)を二重にしない。フォワードスラッシュも機能する。
AVISource("d:\capture.avi")
AVISource("c:/capture/00.avi")
WAVSource("f:\soundtrack.wav")
WAVSource("f:/soundtrack.wav")

''関連スレッド:''
# 次は AVISource("cap1.avi") + AVISource("cap2.avi") と同じ:
AVISource("cap1.avi", "cap2.avi")

[[[MJPEG codecs]:http://forum.doom9.org/showthread.php?s=&postid=330657]]
# 音声を無効化して、RGB デコードをリクエストする
AVISource("cap.avi", false, "RGB32")

[[[DV codecs]:http://forum.doom9.org/showthread.php?s=&threadid=58110]]
# Canopus DV コーデックを使用して DV を開く
AviSource("cap.avi", false, fourCC="CDVC")

''例:''
# Xvid コーデックを使用して AVI (たとえば DivX3)を開く
AviSource("cap.avi", false, fourCC="XVID")

 AviSource("d:\capture.avi")  # Cプログラマーは注意する: バックスラッシュ((日本語環境では\マーク。))は二重にしないこと。
 AviSource("c:/capture/00.avi")  # 左下がりのスラッシュも動作する。
 WavSource("f:\soundtrack.wav")  # これは動作する。
 AviSource("cap1.avi", "cap2.avi")  # AviSource("cap1.avi")+AviSource("cap2.avi")と同じ。
 AviSource("cap.avi", false, "RGB32")  # 音声を無効化し、RGB32デコードを要求する。
 AviSource("cap.avi", false, fourCC="CDVC")  # Canopus DVコーデックを使って、DVを開く。
 AviSource("cap.avi", false, fourCC="XVID")  # avi(たとえばDivX3)をXviDコーデックを使って開く。
# いずれか一方が音声を含まない 2 つのクリップを結合する
# 結合時、これらのクリップは互換性がなければならない(同じビデオおよびオーディオのプロパティを持つ必要がある):
A = AviSource("FileA.avi")
B = AviSource("FileB.avi") # オーディオストリームなし
A ++ AudioDub(B, BlankClip(A))
}}

いくつかの圧縮フォーマットは、1 つのスクリプトの中で AviSource() を呼び出す回数に制限を課します。50 より少ない AviSource() 文でこの制限を経験した人もいます。[[こちらの議論:http://forum.doom9.org/showthread.php?t=131687]]を参照してください。

''更新履歴''
|v2.55|fourCCオプションを追加。|

// #hr
// 註: このページは、http://www.avisynth.org/AviSourceの日本語訳です。
|v2.55|fourCC オプションを追加。|

#hr

註: このページは、AviSynth 2.5.8 RC3 に同梱されている英語版ヘルプの日本語訳です。原文は、AviSynth をインストールしたフォルダ内の Docs/english/corefilters/avisource.htm にあります。なお、このページのテキストおよび画像のライセンスは、オリジナルのそれに準じます。詳しくは、[[AboutLicense]] を参照してください。