VideoGenerator[imagespec]
フレームが imagespec から生成された動画を生成する.
VideoGenerator[<|"Image"imagespec,"Audio"audiospec|>]
音声データが audioexpr から生成された動画を返す.
VideoGenerator[…,dur]
長さが dur の動画を生成する.
VideoGenerator
VideoGenerator[imagespec]
フレームが imagespec から生成された動画を生成する.
VideoGenerator[<|"Image"imagespec,"Audio"audiospec|>]
音声データが audioexpr から生成された動画を返す.
VideoGenerator[…,dur]
長さが dur の動画を生成する.
詳細とオプション
- VideoGeneratorを使ってアルゴリズム的に動画オブジェクトが生成できる.この関数は,主に,時変プロットや回転3Dオブジェクト等の動画の作成に使用される.
- imagespec は以下のいずれでもよい.
-
image 第1トラックで image を使う {image1,image2,…} 第1トラックで imageiのシーケンスを使う manipulate ManipulateまたはAnimatedImageアニメーション imagefunc 1つまたは複数の画像を作成する時間の関数 imagefunc - audiospec は以下のいずれでもよい.
-
audio 第1トラックで audio を使う {audio1,audio2,…} 第1トラックで audioiのシーケンスを使う audiofunc 音声サンプルのリストまたは行列を作成する時間の関数 audiofunc - 時間指定 dur は以下のいずれでもよい.
-
dur 秒で与えられる時間 Quantity[dur,"Seconds"] 秒または秒と互換の単位で与えられる時間 Quantity[n,"Frames"] フレーム数で与えられる時間 - 並列でフレームを生成したければ,Parallelize[VideoGenerator[…]]を使うとよい. »
- 次は,サポートされるオプションである.
-
AudioEncoding Automatic 使用する音声符号化 BitRate Automatic 使用するおおよそのビットレート CompressionLevel Automatic 使用する圧縮レベル FrameRate 30 使用するフレームレート GeneratedAssetFormat Automatic 結果のファイル形式 GeneratedAssetLocation $GeneratedAssetLocation 結果の場所 OverwriteTarget False 既存ファイルを上書きするかどうか RasterSize Automatic 式をラスタライズする際に使用するラスタサイズ SampleRate Automatic 使用する音声サンプルレート VideoEncoding Automatic 使用する動画符号化 VideoTransparency False 出力動画が透過チャンネルを持つべきかどうか
例題
すべて開く すべて閉じる例 (2)
スコープ (8)
画像からの動画 (3)
i = ResourceData["Sample Image: White Dog on a Beach"]v = VideoGenerator[i, Quantity[2, "Seconds"]]i = ResourceData["Sample Image: White Dog on a Beach"];
v = VideoGenerator[i, Quantity[36, "Frames"]]Import[Information[v, "ResourcePath"], "FrameCount"]i = ResourceData["Sample Image: White Dog on a Beach"];
listOfImages = NestList[ImageApply[RotateLeft, #]&, i, 2]v = VideoGenerator[listOfImages]VideoMapTimeSeries[Mean[#Image]&, v]//ListLinePlot[#, Rule[...]]&関数からの動画 (3)
i = ResourceData["Sample Image: White Dog on a Beach"];dur = 3;
VideoGenerator[ImageRotate[i, 2π # / dur, Full, Masking -> Full, Padding -> "Fixed"]&, dur]時間を入力として取ってそれを画像にラスタライズする関数を使う:
f[time_] := Rasterize[Round[time, .01], RasterSize -> 300];
VideoGenerator[f, 3]i = ResourceData["Sample Image: White Dog on a Beach"];
f[time_] := {Blur[i, 20 * time], ColorQuantize[i, Round[2 + 2 * time]]};
v = VideoGenerator[f]この関数は,半径を大きくすることで最初のトラックのフレームをぼかす:
VideoFrameList[Video[v, VideoTrackSelection -> 1], 3]この関数は2番目のトラックの色を増やすことで量子化された画像を生成する:
VideoFrameList[Video[v, VideoTrackSelection -> 2], 3]音声がある動画 (2)
i = ResourceData["Sample Image: White Dog on a Beach"];
a = ExampleData[{"Audio", "PianoScale"}];v = VideoGenerator[<|"Image" -> i, "Audio" -> a|>, Duration[a]]Thumbnail /@ VideoFrameList[v, 2]AudioPlot[Audio[v]]i = ResourceData["Sample Image: White Dog on a Beach"];imageFunction[time_] := Blur[i, 20 * time];audioFunction[time_] := .5 * TriangleWave[300 time + 200 * time ^ 2];
v = VideoGenerator[<|"Image" -> imageFunction, "Audio" -> audioFunction|>]画像関数は時間を入力として取り,これをラスタライズしてImageにする:
VideoFrameList[v, 3]音声関数は時間を入力として取り,それを使って三角波の周波数を制御する:
Spectrogram[Audio[v]]オプション (13)
AudioEncoding (1)
AudioEncodingオプションを使って使用する音声符号化を指定する:
encoder = RandomChoice[$AudioEncoders["MP4"]]a = ExampleData[{"Audio", "PianoScale"}];v = VideoGenerator[<|"Image" -> ResourceData["Sample Image: White Dog on a Beach"], "Audio" -> a|>, Duration[a], AudioEncoding -> encoder[[1]]]Information[v, "AudioTracks"]BitRate (1)
CompressionLevel (1)
CompressionLevelオプションを使って結果のファイルサイズを制御する:
i = ResourceData["Sample Image: White Dog on a Beach"];
videos = Table[VideoGenerator[i, CompressionLevel -> c], {c, 0, 1, .2}];さまざまな圧縮レベルで,ファイルサイズと最終フレームの品質を比較する:
Labeled[VideoExtractFrames[#, Quantity[-1, "Frames"]], FileSize[Information[#, "ResourcePath"]]]& /@ videosFrameRate (1)
Information[VideoGenerator[RandomImage[]], "VideoTracks"][[1, "FrameRate"]]i = ResourceData["Sample Image: White Dog on a Beach"];
video = VideoGenerator[i, FrameRate -> 15];Information[video, "VideoTracks"][[1, "FrameRate"]]GeneratedAssetFormat (1)
GeneratedAssetLocation (2)
デジタルアセットは,$WolframDocumentsDirectory内の"Video"フォルダに自動的に生成される:
Information[VideoGenerator[RandomImage[]], "ResourcePath"]VideoGeneratorによって生成されたデジタルアセットの場所を指定する:
v = VideoGenerator[RandomImage[], GeneratedAssetLocation -> "file.mp4"];
Information[v, "ResourcePath"]LocalObjectを結果のVideoオブジェクトのデジタルアセットとして使う:
v = VideoGenerator[RandomImage[], GeneratedAssetLocation -> LocalObject[]];
Information[v, "ResourcePath"]OverwriteTarget (1)
デフォルトで,ファイルがすでに存在する場合,そのファイルは上書きされない:
VideoGenerator[RandomImage[], GeneratedAssetLocation -> "file.mp4"]OverwriteTargetTrueを指定して既存ファイルを上書きする:
v = VideoGenerator[RandomImage[], GeneratedAssetLocation -> "file.mp4", OverwriteTarget -> True];
Information[v, "ResourcePath"]RasterSize (1)
デフォルトで,動画トラック指定がGraphicsオブジェクトを生成するなら,結果はラスタライズされる:
v = VideoGenerator[Graphics[Disk[]]];
Information[v, "VideoTracks"]RasterSizeオプションを使ってラスタライズを制御する:
v = VideoGenerator[Graphics[Disk[]], RasterSize -> {100, 100}];
Information[v, "VideoTracks"]動画トラック指定がImageを生成するときにRasterSizeオプションを指定すると結果のサイズが変更される:
v = VideoGenerator[RandomImage[1, 400], RasterSize -> {100, 100}];
Information[v, "VideoTracks"]SampleRate (2)
デフォルトで,音声トラック指定がAudioオブジェクトのときは,同じレートが保持される:
a = Audio["ExampleData/rule30.wav"];
AudioSampleRate[a]v = VideoGenerator[<|"Image" -> RandomImage[], "Audio" -> a|>];
Information[v, "AudioTracks"]SampleRateオプションを使って音声入力をサンプルし直すことができる:
v = VideoGenerator[<|"Image" -> RandomImage[], "Audio" -> a|>, SampleRate -> 16000];
Information[v, "AudioTracks"]音声トラック指定が関数の場合は,デフォルトサンプルレートは
Hzである:
v = VideoGenerator[<|"Image" -> RandomImage[], "Audio" -> (Sin[4000#]&)|>];
Information[v, "AudioTracks"]SampleRateオプションを使って結果のサンプルレートを制御する:
v = VideoGenerator[<|"Image" -> RandomImage[], "Audio" -> (Sin[4000#]&)|>, SampleRate -> 16000];
Information[v, "AudioTracks"]VideoEncoding (1)
VideoEncodingオプションを使って使用する動画の符号化を指定する:
encoder = RandomChoice[$VideoEncoders["MP4"]]v = VideoGenerator[ResourceData["Sample Image: White Dog on a Beach"], VideoEncoding -> encoder[[1]]]Information[v, "VideoTracks"]VideoTransparency (1)
デフォルトで,生成されたフレームのアルファチャンネルは,出力には保持されない:
v = VideoGenerator[Plot[Sin[4 * # x], {x, 0, 10}]&];Information[VideoExtractFrames[v, Quantity[1, "Frames"]], "Transparency"]生成されたフレームのアルファチャンネルが出力でも保持されるように指定する:
v = VideoGenerator[Plot[Sin[4 * # x], {x, 0, 10}]&, VideoTransparency -> Automatic];Information[VideoExtractFrames[v, Quantity[1, "Frames"]], "Transparency"]アプリケーション (6)
a = ExampleData[{"Audio", "Drums"}]v = VideoGenerator[<|"Image" -> ExampleData[{"TestImage", "Moon"}], "Audio" -> a|>, Duration[a]]g = ExampleData[{"Geometry3D", "Cow"}][[1, 2]];VideoGenerator[Graphics3D[{EdgeForm[], GeometricTransformation[g, RotationTransform[360 / 5 # Degree, {0, 0, 1}]]}, SphericalRegion -> True, Boxed -> False]&, 5]bass = ExampleData[{"Geometry3D", "BassGuitar"}][[1]];trajectory[t_] := {1, 10Sin[2t], 4Cos[2t]}
ParametricPlot3D[trajectory[t], {t, 0, 5}]Videoを生成する:
VideoGenerator[Rasterize@Graphics3D[bass, ViewPoint -> trajectory[#], PlotRange -> {{-25, 25}, {-25, 25}, {-20, 25}}]&, 5]//Parallelizeセルオートマトンの進化を表示するVideoオブジェクトを作成する:
c = CellularAutomaton[30, {{1}, 0}, {{0, 200}}];
Image[c]VideoGenerator[Image@ArrayPad[c[[ ;; Round[1 + # * 100]]], {{0, 200 - Round[1 + # * 100]}, 0}]&, 2]階段を跳ね落ちていくVideoオブジェクトを作成する.
ballsteps = NDSolve[{x''[t] == 0, y''[t] == -9.8, y[0] == 6, y'[0] == 0, x[0] == 0, x'[0] == 1, a[0] == 5, WhenEvent[Mod[x[t], 1] == 0, If[a[t] > 0, a[t] -> a[t] - 1, "RemoveEvent"]], WhenEvent[y[t] == a[t], {x'[t], y'[t]} -> .9{x'[t], -y'[t]}]}, {x, y, a}, {t, 0, 15}, DiscreteVariables -> {a}];
trajectory = {x[t], y[t]} /. ballsteps[[1]]staircase = Plot[Clip[Floor[6 - x], {0, Infinity}], {x, -1, 15}, Filling -> 0, Exclusions -> None]VideoGenerator[Show[Graphics[{Red, Disk[trajectory /. t -> #, .2]}, PlotRange -> {{-1, 10}, {0, 7}}], staircase]&, 15, FrameRate -> 15]td = TravelDirections[{Entity["City", {"Champaign", "Illinois", "UnitedStates"}], Entity["City", {"Chicago", "Illinois", "UnitedStates"}]}]points = Join@@td["TravelPath"][[1]]["LatitudeLongitude"];
points//ShortVideoGenerator[
With[{i = Max[1, Round[# * Length[points] / 10]]}, GeoGraphics[{PointSize[Large], Red, Point@GeoPosition@points[[i]], Black, GeoPath[points[[Max[1, i - 400] ;; i]]]}, RasterSize -> {500, 500}]]&, 10, FrameRate -> 10]特性と関係 (3)
disk[time_] := Graphics[Disk[{0, 0}, .1 + time], PlotRange -> {{-1, 1}, {-1, 1}}]VideoGenerator[disk];//AbsoluteTimingParallelize[VideoGenerator[disk]];//AbsoluteTimingAnimateを使ってノートブック内にアニメーションを作成する:
Animate[Plot[Sin[x + a], {x, 0, 10}], {a, 0, 5}, AnimationRunning -> False]VideoGeneratorでも同じ結果に達するが,コントロールは何も表示されない:
VideoGenerator[Plot[Sin[x + #], {x, 0, 10}]&, 5]別々に生成した動画オブジェクトと音声オブジェクトをVideoCombineを使って統合することができる.
v = VideoGenerator[Plot[Sin[x + #], {x, 0, 10}]&, 5]a = AudioGenerator[TriangleWave[200#]&, 5]VideoCombineを使って2つを統合する:
VideoCombine[{v, a}]考えられる問題 (1)
disk[time_] := Graphics[Disk[{0, 0}, time], ImageSize -> {700, 700}]VideoGenerator[disk];//AbsoluteTimingParallelize[VideoGenerator[disk]];//AbsoluteTiming並列化は,すでに高速でマルチスレッドの関数にはメリットがない:
image[time_] := RandomImage[]VideoGenerator[image, 4];//AbsoluteTimingParallelize[VideoGenerator[image, 4]];//AbsoluteTiming関連するガイド
-
▪
- 動画計算機能の更新履歴 ▪
- 動画作成
テキスト
Wolfram Research (2020), VideoGenerator, Wolfram言語関数, https://reference.wolfram.com/language/ref/VideoGenerator.html (2021年に更新).
CMS
Wolfram Language. 2020. "VideoGenerator." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/VideoGenerator.html.
APA
Wolfram Language. (2020). VideoGenerator. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VideoGenerator.html
BibTeX
@misc{reference.wolfram_2026_videogenerator, author="Wolfram Research", title="{VideoGenerator}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/VideoGenerator.html}", note=[Accessed: 14-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_videogenerator, organization={Wolfram Research}, title={VideoGenerator}, year={2021}, url={https://reference.wolfram.com/language/ref/VideoGenerator.html}, note=[Accessed: 14-November-2026]}