Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AV Foundation
Search
nakajijapan
February 01, 2014
Technology
4
780
AV Foundation
心霊動画アプリ「もう一度ご覧いただこう」を作成してみて
Conference With Developers 2014
nakajijapan
February 01, 2014
Tweet
Share
More Decks by nakajijapan
See All by nakajijapan
サービスにおけるDesign Systemの構築
nakajijapan
6
3.5k
Markdownをリアルタイムに解析する
nakajijapan
4
4.3k
Firebase Authorization
nakajijapan
0
220
Intoducing Izumo
nakajijapan
1
1.8k
Practical CloudKit
nakajijapan
1
1.7k
Introducing to Ajimi - プロダクトを味見していこう
nakajijapan
0
2.1k
Shari
nakajijapan
1
2.6k
Japan Apple Pay Development
nakajijapan
0
250
業務で絶対必要にならない技術
nakajijapan
0
780
Other Decks in Technology
See All in Technology
【Oracle Cloud ウェビナー】2025年のセキュリティ脅威を読み解く:リスクに備えるためのレジリエンスとデータ保護
oracle4engineer
PRO
1
100
タイミーのデータ活用を支えるdbt Cloud導入とこれから
ttccddtoki
1
260
「隙間家具OSS」に至る道/Fujiwara Tech Conference 2025
fujiwara3
7
6.5k
【JAWS-UG大阪 reInvent reCap LT大会 サンバが始まったら強制終了】“1分”で初めてのソロ参戦reInventを数字で振り返りながら反省する
ttelltte
0
140
CDKのコードレビューを楽にするパッケージcdk-mentorを作ってみた/cdk-mentor
tomoki10
0
210
Amazon Q Developerで.NET Frameworkプロジェクトをモダナイズしてみた
kenichirokimura
1
200
AWS re:Invent 2024 re:Cap Taipei (for Developer): New Launches that facilitate Developer Workflow and Continuous Innovation
dwchiang
0
170
Bring Your Own Container: When Containers Turn the Key to EDR Bypass/byoc-avtokyo2024
tkmru
0
860
【NGK2025S】動物園(PINTO_model_zoo)に遊びに行こう
kazuhitotakahashi
0
250
.NET 最新アップデート ~ AI とクラウド時代のアプリモダナイゼーション
chack411
0
200
技術に触れたり、顔を出そう
maruto
1
160
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.8k
Featured
See All Featured
Docker and Python
trallard
43
3.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
500
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Visualization
eitanlees
146
15k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
BBQ
matthewcrist
85
9.4k
Adopting Sorbet at Scale
ufuk
74
9.2k
A Philosophy of Restraint
colly
203
16k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Transcript
"7'PVOEBUJPO ৺ྶಈըΞϓϦʮ͏Ұ͝ཡ͍ͨͩ͜͏ʯΛ࡞ͯ͠Έͯ !OBLBKJKBQBO
ࠓ͢͜ͱ w ࣗݾհ w ΞϓϦհ w "7'PVOEBUJPOΛ࣮ͬͨ͋Ε͜Ε w ॴײ
ࣗݾհ !OBLBKJKBQBO QBQFSCPZDP
!JTPEJOF
!JTPEJOF ςϨϏͰΔΑ͏ͳ৺ྶ൪ Έ͍ͨͳಈը࡞Γ͍ͨΜʙ
͍
None
IUUQPXLSJOGPNPWJF ͏Ұ͝ཡ͍ͨͩ͜͏ ৺ྶಈըΞϓϦ
ओͳػೳ w ಈըը w ಈըʹ৺ྶΛೖΕΔ w ಈըʹςϩοϓͱϫΠϓ w ಈըͷγνϡΤʔγϣϯʹ߹ΘͤͯφϨʔγϣϯ ΛೖΕΔ
w ιʔγϟϧڞ༗
w .FEJB1MBZFS'SBNFXPSL w 6*,JU ্ҐͷϑϨʔϜϫʔΫ
"7'PVOEBUJPO
ௐࠪ
ௐࠪ w "7'PVOEBUJPO1SPHSBNNJOH(VJEF w .PWJOHUP"7,JUBOE"7'PVOEBUJPOr w $PSF*NBHF&GGFDUTBOE5FDIOJRVFTr w
"EWBODFE&EJUJOHXJUI"7'PVOEBUJPOr
ߏ
εϩʔϞʔγϣϯಈը TFD TFD TFD φϨʔγϣϯԻ ϫΠϓ ը૾߹ ಈը݁߹ ಈը݁߹
࣮
ಈը݁߹
// Assetੜ AVURLAsset *videoAsset = [[AVURLAsset alloc] initWithURL:movieURL options:nil]; !
// CompositionTrackੜ AVMutableCompositionTrack* compositionVideoTrack; compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; ! // Ξηοτ͔ΒτϥοΫΛऔಘ AVAssetTrack *videoTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; ! // ઃఆ [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:videoTrack atTime:self.currentTimeDuration error:nil]; [compositionVideoTrack setPreferredTransform:[[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] preferredTransform]]; AVMutableCompositionTrack *compositionAudioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; // Assetੜ [compositionAudioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:self.currentTimeDuration error:nil]; self.currentTimeDuration = [mixComposition duration]; ! // Layer InstructionͷՃ AVMutableVideoCompositionLayerInstruction *layerInstruction; layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:compositionVideoTrack]; ! [self.layerInstructions addObject:layerInstruction]; ϝσΟΞใΛอ࣋͠ɺͦͷใΛऔಘͰ͖Δ
// Assetੜ AVURLAsset *videoAsset = [[AVURLAsset alloc] initWithURL:movieURL options:nil]; !
// CompositionTrackੜ AVMutableCompositionTrack* compositionVideoTrack; compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; ! // Ξηοτ͔ΒτϥοΫΛऔಘ AVAssetTrack *videoTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; ! // ઃఆ [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:videoTrack atTime:self.currentTimeDuration error:nil]; [compositionVideoTrack setPreferredTransform:[[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] preferredTransform]]; AVMutableCompositionTrack *compositionAudioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; // Assetੜ [compositionAudioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:self.currentTimeDuration error:nil]; self.currentTimeDuration = [mixComposition duration]; ! // Layer InstructionͷՃ AVMutableVideoCompositionLayerInstruction *layerInstruction; layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:compositionVideoTrack]; ! [self.layerInstructions addObject:layerInstruction]; ө૾ΛऔΓग़͢ ԻΛऔΓग़͢
// Assetੜ AVURLAsset *videoAsset = [[AVURLAsset alloc] initWithURL:movieURL options:nil]; !
// CompositionTrackੜ AVMutableCompositionTrack* compositionVideoTrack; compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; ! // Ξηοτ͔ΒτϥοΫΛऔಘ AVAssetTrack *videoTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; ! // ઃఆ [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:videoTrack atTime:self.currentTimeDuration error:nil]; [compositionVideoTrack setPreferredTransform:[[[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] preferredTransform]]; AVMutableCompositionTrack *compositionAudioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid]; // Assetੜ [compositionAudioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration) ofTrack:[[videoAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:self.currentTimeDuration error:nil]; self.currentTimeDuration = [mixComposition duration]; ! // Layer InstructionͷՃ AVMutableVideoCompositionLayerInstruction *layerInstruction; layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:compositionVideoTrack]; ! [self.layerInstructions addObject:layerInstruction]; ίϯϙδγϣϯΛΈཱͯΔ
ը૾ͷ߹ͱ Ξχϝʔγϣϯ
None
// generate parent layer CALayer* layerRoot = [CALayer layer]; CALayer*
layerVideo = [CALayer layer]; . . . . videoComp = [AVMutableVideoComposition videoComposition]; videoComp.animationTool = [AVVideoCompositionCoreAnimationTool videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:layerVideo inLayer:layerRoot]; $"-BZFSʹ$"#BTJD"OJNBUJPOͰ ઃఆͨ͠ΞχϝʔγϣϯΛՃ͢Δ
ϫΠϓಈը
None
// Assetੜ AVURLAsset *videoAsset = [[AVURLAsset alloc] initWithURL:movieURL options:nil]; //
CompositionTrackੜ AVMutableCompositionTrack* compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; // Trackऔಘ AVAssetTrack* videoTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; ! // ઃఆ CMTime timeDuration; timeDuration = videoAsset.duration; ! [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, timeDuration) ofTrack:videoTrack atTime:kCMTimeZero error:nil]; [compositionVideoTrack setPreferredTransform:[videoTrack preferredTransform]]; AVMutableVideoCompositionLayerInstruction* layerInstruction; layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:compositionVideoTrack]; [layerInstruction setTransform:CGAffineTransformConcat(scale, trnsration) atTime:kCMTimeZero]; ! [self.layerInstructions addObject:layerInstruction]; ΞϑΟϯม
εϩʔϞʔγϣϯ
// શମʹରͯ͠εϩʔϞʔγϣϯॲཧΛ͔͚Δ CMTime durationSlow = CMTimeSubtract(videoAsset.duration, CMTimeMake(9, 1)); [mixComposition scaleTimeRange:CMTimeRangeMake(CMTimeMake(19,
1), durationSlow) toDuration:CMTimeMake(durationSlow.value * 2.0, durationSlow.timescale)]; ࣮ࡍͷө૾Λ̎ഒͷ࣌ؒͰग़ྗͤ͞Δ
εϩʔϞʔγϣϯ ϫΠϓಈը ը૾ͷ߹ͱΞχϝʔγϣϯ ಈը݁߹ ࣮
"7'PVOEBUJPO
ॴײ w Ϋϥε໊͔ͬͨΓ࣮ྔ͕ଟͯ͘େมʂ w ͱ͍͑ઃܭ͢Β͍͠ w ใ͕গͳ͍ w ϋϚΔͱ໎ঢ়ଶ w
ࣄͰશ͘׆͔ͤͳ͍ʂʂʂ
4BNQMF.PWJF IUUQTXXXZPVUVCFDPNXBUDI WLKPXF43%* %FNP.PWJF IUUQTXXXZPVUVCFDPNXBUDI WSKUNK:6
5IBOLT