3

iOSデバイスでスローモーションでビデオを表示したいのですが。

私のビューには、ビデオ(〜2秒の長さ)とスライダーが含まれています。

ユーザーはスライダーを動かして、フレームごとにムービーをステップ(前後)移動できます。

MPMoviePlayerControllerフレームごとにステップする機能がありません。

について読んだMVAssetReaderのですが、具体的な使い方がわかりません。

固定のフレームレートがないので、ビデオのメタデータからこの情報を削除する必要があります。私は本当にすべてのフレームを表示する必要があります。

誰かが私に手がかりを与えることができますか?

4

2 に答える 2

3

AV Player Demo WWDC 2010 サンプル コードのサンプル コードは、作業に役立ちます。

ビデオからのサムネイルのカットについては、WWDC 2010 AV Editing with AV Foundation Framework で説明されており、サンプル コードを使用したオーディオとビデオの編集に関するその他の多くのことも説明されています。

開発者アカウント(有料)をお持ちの方はiTunesで動画をご覧いただけます

于 2012-05-26T14:49:07.573 に答える
1

AVFoundation は非常に強力なフレームワークですが、MPMoviePlayerController よりも入力と理解が少し必要です。WWDC のビデオを見て、サンプル コードを見て、ドキュメントを読むことを強くお勧めします。ドキュメンテーションは概念を理解するのに非常に適していますが、実際のビデオ形式の詳細に関しては、いくつかの詳細が欠けています. そのためには、サンプル コードと実験が有効です。

フレームごとに移動したい場合は、AVPlayerItem stepByCount: が適していると思います。

// Setup a PlayerItem and a Player
NSURL* movieURL = [NSBundle URLForResource:@"movie" withExtension:@"mov" subdirectory:@"" inBundleWithURL:[NSBundle mainBundle].bundleURL];
AVURLAsset* movieAsset = [AVURLAsset assetWithURL:movieURL];
AVPlayerItem* playerItem = [AVPlayerItem playerItemWithAsset:movieAsset];
AVPlayer* player = [AVPlayer playerWithPlayerItem:playerItem];

// setup the layer so you can see it
AVPlayerLayer* playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
playerLayer.frame = self.view.bounds;
[self.view.layer addSublayer:playerLayer];

// Verify our assumptions, in production code you should do something better
NSAsset(player.currentItem.canStepForward, @"Assume this format can step forward");    
NSAsset(player.currentItem.canStepBackward, @"Assume this format can step backward");


[player.currentItem stepByCount:1];  // step forward a frame

[player.currentItem stepByCount:-1];  // step backward a frame
于 2013-06-26T22:02:04.720 に答える