[2018.10.3] Windows10 October2018!いまさら Unity を使ってみる(使えるのかな?)の巻。番組改編時期で新番組を見逃すな!古い録画ファイルをサクッと整理したいよね? Unity2018.2.10f1の開発環境は VisualStudio2017 Microsoft.Net.4.7.1.TargetingPack?

台風一過というか、台風が来るので通り過ぎるまで暇を潰そうというお話。
OSもリフレッシュしたし何か違うことをしよう!

背景:
TS録画ファイルがこんもりたまっている。キーワードで「新」なんてしておくと、新作タイトルどころが、新潟ローカル局の番組はほぼ全部録画されちゃいますil||li _| ̄|● il||li
まぁそんな設定はさておき、軽快なシークができるアプリがちょいとほしいんですが・・・というところで。
自前コンパイルビルド品のDGIndexがちょいちょい止まるんで、代替え品つくりたい感じですな。

普通に作ってもネタにならないので、マイナーキーワード探してググっていると Unity にも VideoPlayer 機能があるという。

仕様を見て躓く:
言語はC/C++。スクリプトがC#とか。最新版はC#[も]使えるらしい。
日曜大工てきなお気楽モードでは敷居が高い。VisualStudioのコーディング作業に慣れると他の言語の生産効率(デバッグ含む)がきつく感じてしまいます。
数年前まで、秀丸とgccでも平気だったのにねぇ・・・
おじいさんきついわぁ
モニタでかくてモニタ離が離れたせいで誤字脱字多いんで、コーディング中に単語チェックしてくれるVisualStudioから離れたくないw
C++は読めるけどコーディングもデバッグもしたくないなぁという、オートマに慣れたらマニュアルの利点すら憧れながらも我慢して乗り続けるみたいな・・・

Unityインストール:
・Unity を選択 + ダウンロード(←こちらをクリック。英語は避けて通ろう)
・Unity Hub をダウンロード(UnityHubの詳細に飛ぶと英語コミュニティーに飛ばされる(^◇^;)
 使わないと衰える英語長文・スラング読解(^◇^; いや~いや~めんどくちゃい。

Unity Personalをダウンロードしよう!
https://store.unity.com/ja/download?ref=personal
>会社の年間総売上が $100,000 を超えないようにしてください。$100,000 以上の資金調達を行っていません
よゆうっすね! $1でもお金欲しいくらいw

Unity バージョン用システム要件 2018.2.10
リリースしました: 26 September 2018
OS: Windows 7 SP1+, 8, 10; macOS 10.11+.
GPU: DirectX 9 相当 (シェーダーモデル 3.0) の性能を持つグラフィックスカード、またはDirectX11機能レベル9.3に対応

ゴシゴシっ(*_*) 2018.9.26リリースに見える。バージョンは2018.2.10
最新版っぽい?なんかぞわぞわするのは潔癖症のせいではあるまいw
本土に合わせたんだろうし仕方ないんだろうけど、バージョンに日付使うのとリリース費にギャップがある場合は意思疎通厳にしないとミスリード起こすから別の表記にした方が・・・いいよね?

UnityDownloadAssistant-2018.2.10f1.exe (778KB)
UnityDocumentationSetup.exe
UnitySetup64.exe
と、1GB暗いダウンロード

Microsoft.Net.4.7.1.TargetingPack が533MBとかあるので、混んでる時間帯は時間がかかります・゚・(ノД`)・゚・

実装としては、フレーム指定してPause(一時停止で)シークしていく感じでできればいいなぁと。
Unity使う分、最初の敷居は高いけど、こんごも3Dネタ作るときに使えればいいかもっていう打算の元、ちょっと踏み出してみる。
DirectX(DirectShowあたり)で普通に組んだ方が王道だとは思いますが、まずは脇道を潰してダメなら王道に向かいます^^;

↓基本的にはこんな感じのものを、こねこねごにょごにょしてみたい

UnityのVideoPlayerを使った!
http://bibinbaleo.hatenablog.com/entry/2017/06/28/103515

VideoPlayer
https://docs.unity3d.com/560/Documentation/ScriptReference/Video.VideoPlayer.html

// Examples of VideoPlayer function

using UnityEngine;

public class Example : MonoBehaviour
{
void Start()
{
// Will attach a VideoPlayer to the main camera.
GameObject camera = GameObject.Find(“Main Camera”);

// VideoPlayer automatically targets the camera backplane when it is added
// to a camera object, no need to change videoPlayer.targetCamera.
var videoPlayer = camera.AddComponent();

// By default, VideoPlayers added to a camera will use the far plane.
// Let’s target the near plane instead.
videoPlayer.renderMode = UnityEngine.Video.VideoRenderMode.CameraNearPlane;

// This will cause our scene to be visible through the video being played.
videoPlayer.targetCameraAlpha = 0.5F;

// Set the video to play. URL supports local absolute or relative paths.
// Here, using absolute.
videoPlayer.url = “/Users/graham/movie.mov”;

// Skip the first 100 frames.
videoPlayer.frame = 100;

// Restart from beginning when done.
videoPlayer.isLooping = true;

// Each time we reach the end, we slow down the playback by a factor of 10.
videoPlayer.loopPointReached += EndReached;

// Start playback. This means the VideoPlayer may have to prepare (reserve
// resources, pre-load a few frames, etc.). To better control the delays
// associated with this preparation one can use videoPlayer.Prepare() along with
// its prepareCompleted event.
videoPlayer.Play();
}

void EndReached(UnityEngine.Video.VideoPlayer vp)
{
vp.playbackSpeed = vp.playbackSpeed / 10.0F;
}
}