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
チームが毎日小さな変化と適応を続けたら1年間でスケール可能なアジャイルチームができた話 / Building a Scalable Agile Team
kakehashi
2
230
KMP with Crashlytics
sansantech
PRO
0
240
AWSサービスアップデート 2024/12 Part3
nrinetcom
PRO
0
140
新しいスケーリング則と学習理論
taiji_suzuki
10
3.8k
アジャイルチームが変化し続けるための組織文化とマネジメント・アプローチ / Agile management that enables ever-changing teams
kakehashi
3
3.3k
AWSの生成AIサービス Amazon Bedrock入門!(2025年1月版)
minorun365
PRO
7
460
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
240
2024年活動報告会(人材育成推進WG・ビジネスサブWG) / 20250114-OIDF-J-EduWG-BizSWG
oidfj
0
200
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
510
dbtを中心にして組織のアジリティとガバナンスのトレードオンを考えてみた
gappy50
0
180
GeometryReaderやスクロールを用いた表現と紐解き方
fumiyasac0921
0
100
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
34
1.6k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Navigating Team Friction
lara
183
15k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Scaling GitHub
holman
459
140k
Docker and Python
trallard
43
3.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
We Have a Design System, Now What?
morganepeng
51
7.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
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