I'd like to take some little videos I made in Mathematica and put them on YouTube. Is there a way to do this?
1 Answer
I built a service connection for this and blogged about it here: Playing with YouTube from Mathematica
Here's an example of how this works.
Connect to YouTube
First install the paclet:
PacletInstall["ServiceConnection_YouTube",
"Site"->
"http://www.wolframcloud.com/objects/b3m2a1.paclets/PacletServer/"
]
(source: wolframcloud.com)
Then connect:
$so = ServiceConnect["YouTube"]
(source: wolframcloud.com)
Upload Video
anim =
Export[
FileNameJoin@{$TemporaryDirectory, "plot3d.flv"},
Manipulate[
Plot3D[Sin[n x y],
{x, 0, 3}, {y, 0, 3},
ViewPoint -> Dynamic[{2, v, 2}], SphericalRegion -> True, Ticks -> None,
PerformanceGoal->"Quality"
],
{n, 1, 4},
{v, -2, 2}
]
];
upload = $so["UploadVideo", "part"->"id", "BodyContent"->anim];
Add Metadata
Because of how I built it you have to add the metadata after the upload. You do it like this:
$so["UpdateVideo", "id" -> upload["id"],
"part" -> "snippet",
"Title" -> "Mathematica Examples: Plot 3D",
"CategoryID" -> "22"
]
Get an IFrame for Embedding
$so["EmbedIFrame", "id"->upload["id"]]
<iframe id="ytplayer" type="text/html" width="640" height="360"
src="https://www.youtube.com/embed/Quzcr4Vuq_Q?autoplay=0"
frameborder="0"></iframe>
Here's the raw URL: https://www.youtube.com/watch/?v=Quzcr4Vuq_Q