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
Video decode on iOS
Search
noppefoxwolf
June 21, 2018
Programming
3
2k
Video decode on iOS
iOS上でビデオコンテナのデコード手法をAssetReaderとVTDecompressSessionの比較を通して学びます。
noppefoxwolf
June 21, 2018
Tweet
Share
More Decks by noppefoxwolf
See All by noppefoxwolf
iOSの隠されたAPIを解明し、開発効率を向上させる方法/iOSDC24
noppefoxwolf
2
360
既存アプリをvisionOS対応してリリースした話/visionOS LT vol5
noppefoxwolf
0
170
UIのブラックボックスを探る/iOSDC23
noppefoxwolf
3
3.9k
CoreGraphicsでドット絵を描こう/iOSDC22
noppefoxwolf
0
2.2k
ランタイムデバッグのススメ/iOSDC21
noppefoxwolf
1
4.3k
google/mediapipe で始めるARアプリ開発/iOSDC2020
noppefoxwolf
1
1.4k
モバイルファーストなアプリを作るためにvearがしたこと/xRDCC
noppefoxwolf
0
99
ソーシャルライブサービスにおけるデジタル化粧の仕組みと実装/iOSDC19
noppefoxwolf
4
5.3k
Limited import clarification and its effect/tryswift2019
noppefoxwolf
2
1.2k
Other Decks in Programming
See All in Programming
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
180
From Translations to Multi Dimension Entities
alexanderschranz
2
130
Criando Commits Incríveis no Git
marcelgsantos
2
170
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
talk-with-local-llm-with-web-streams-api
kbaba1001
0
170
たのしいparse.y
ydah
3
120
Security_for_introducing_eBPF
kentatada
0
110
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
170
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
Go の GC の不得意な部分を克服したい
taiyow
2
770
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
200
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Agile that works and the tools we love
rasmusluckow
328
21k
RailsConf 2023
tenderlove
29
940
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Optimizing for Happiness
mojombo
376
70k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Thoughts on Productivity
jonyablonski
67
4.4k
Speed Design
sergeychernyshev
25
670
Code Reviewing Like a Champion
maltzj
520
39k
Transcript
7JEFPEFDPEFPOJ04 QPUBUPUJQT ! !OPQQFGPYXPMG
OPQQF ‣ !OPQQFGPYXPMG ‣ ! ͖ͭͶ͖ ‣ J04ΞϓϦ։ൃ̔ %F/" ‣
ιʔγϟϧϥΠϒࣄۀ෦ ! !OPQQFGPYXPMG
! !OPQQFGPYXPMG
OPQQFGPYXPMG,JUTVOFCJ ಁաಈը࠶ੜϏϡʔϥΠϒϥϦ IUUQTHJUIVCDPNOPQQFGPYXPMG,JUTVOFCJ ! !OPQQFGPYXPMG
! !OPQQFGPYXPMG
,JUTVOFCJͷΈ ϏσΦͷσίʔυˠϚεΫ߹ˠඳը ! !OPQQFGPYXPMG
,JUTVOFCJͷΈ ϏσΦͷσίʔυˠϚεΫ߹ˠඳը ࠓ͜ͷลͷΛ͠·͢ ! !OPQQFGPYXPMG
ϏσΦϑΝΠϧͷલఏࣝ ྫ͑ɺNQNPWXNW ෳͷϝσΟΞίϯςφͷू·ΓɺओʹಈըͱԻ͕֨ ೲ͞Ε͍ͯΔͷ͕ҰൠతͳϑΥʔϚοτ ଞʹࣈນ੩ࢭըͷίϯςφؚ͕·ΕΔ͜ͱ͋Δ ! !OPQQFGPYXPMG
ϏσΦϑΝΠϧͷલఏࣝ ! !OPQQFGPYXPMG
ϏσΦϑΝΠϧͷσίʔυͱ ϝσΟΞίϯςφΛ࠶ੜग़དྷΔঢ়ଶʹ෮ݩ͢Δ ‣ ϏσΦίϯςφ͔Β̍ϑϨʔϜ͝ͱͷը૾Λऔಘ ‣ Իίϯςφ͔ΒԻใΛऔಘ ‣ ࣈນίϯςφ͔ΒจࣈྻΛऔಘ FUD ͜ΕΒΛߦͬͯಈըͱͯ͠࠶ੜ͢Δ
! !OPQQFGPYXPMG
ϏσΦͷίʔσοΫ ϏσΦίϯςφͷූ߸ԽʢΤϯίʔυʣํ๏ෳ͋ Δɻ ྫ͑ɺII71 ίʔσοΫͷҧ͍ʹΑͬͯѹॖॲཧʹඞཁͳύϫʔ ͕มΘΔɻ ! !OPQQFGPYXPMG
J04ͰͷϏσΦίϯςφͷσίʔυํ๏ ‣ "7"TTFU3FBEFS ‣ 75%FDPNQSFTTJPO4FTTJPO ‣ ⒎NQFH ! !OPQQFGPYXPMG
ରԠίʔσοΫͷ֬ೝ ͜ΕΒͷϑϨʔϜϫʔΫ෦Ͱ04ͷσίʔμ ͷ࣮Λར༻͍ͯ͠Δɻ ಉ͡NQͰ)͔)Έ͍ͨͳίʔσοΫͷҧ ͍͕͋Γɺ04ʹΑͬͯαϙʔτ͕ҟͳΔͷͰ ҙɻ ! !OPQQFGPYXPMG
ྫ͑)&7$Ұ෦ͷνοϓͰ͔͠ϋΠύϑΥʔϚϯεͳσίʔυΛ͢Δ͜ͱ͕Ͱ͖ͳ͍ɻ ! !OPQQFGPYXPMG
ରԠίʔσοΫͷ֬ೝ ެࣜαΠτͷ4QFDΈΕαϙʔτ͍ͯ͠ΔίʔσοΫ ͕Θ͔Δɻ ରԠίʔσοΫΛऔಘ͢Δϝιουݟ͔ͭΒͳ͔ͬ ͨɻ ! IUUQTXXXBQQMFDPNKQJQIPOFYTQFDTͱ͔ ! !OPQQFGPYXPMG
"7"TTFU3FBEFS let reader = try! AVAssetReader(asset: asset) let output =
AVAssetReaderTrackOutput(track: asset.videoTrack) reader.add(output) reader.startReading() output.copyNextSampleBuffer() output.copyNextSampleBuffer() output.copyNextSampleBuffer() ... ͱͯ؆୯ DPQZ/FYU4BNQMF#V⒎FSΛݺͿͨͼʹऔΕΔϑϨʔϜ ͷλΠϜελϯϓ͕ਐΉ ! !OPQQFGPYXPMG
"7"TTFU3FBEFSͷಛ ‣ ରԠίʔσοΫͰ͋ΕίʔσοΫΛؾʹͤͣʹσ ίʔυͰ͖Δ ‣ ඇৗʹ؆୯ͳΠϯλʔϑΣΠε ‣ ࣍ͷTBNQMF#V⒎FS͔͠औΕͳ͍ ! !OPQQFGPYXPMG
75%FDPNQSFTTJPO4FTTJPOͷಛ ϨΠϠʔͷϏσΦσίʔυ༻ϑϨʔϜϫʔΫ ଟ"7"TTFU3FBEFS"7"TTFU3FBEFS5SBDL0VUQVU ͜ΕΛ͍ͬͯΔʁ ෳࡶͰ໘ͳΘΓʹॊೈੑ͕ߴ͍ ! !OPQQFGPYXPMG
75%FDPNQSFTTJPO4FTTJPOͷྲྀΕ IBWDΛׂ ө૾ؚ͕·ΕΔνϟϯΫΛऔΓग़͢ 75%FDPNQSFTTJPO4FTTJPOΛੜ νϟϯΫΛ4FTTJPOʹ͢
σίʔυࡁΈͷ*NBHF#V⒎FS͕ίʔϧόοΫʹฦ͞ αϯϓϧͰྫͱͯ͠ΩʔϑϨʔϜΛऔΓग़͍ͯ͠Δ ! !OPQQFGPYXPMG
IBWDΛׂ /"-pMFGPSNBU ! !OPQQFGPYXPMG
! !OPQQFGPYXPMG
ө૾ؚ͕·ΕΔνϟϯΫΛऔΓग़͢ /"-ͷϔομΛࢀরͯ͠Yͷͷ͕ΩʔϑϨʔϜΛ ͍࣋ͬͯΔɻ ࠩใ͕ෆཁͳશͳϑϨʔϜ ! !OPQQFGPYXPMG
OBMVOJUUZQF *40*&$Ͱఆٛ IUUQXXXTUBSPDFBOTPSHFCPPL*40QEG ! !OPQQFGPYXPMG
75%FDPNQSFTTJPO4FTTJPOΛੜ VTDecompressionSessionCreate(_:, _:, _:, _:, _:, _:) ҾʹίʔϧόοΫઌϑϨʔϜͷใ QJYFM'PSNBU )ͷύϥϝʔλ
͕ඞཁ ! !OPQQFGPYXPMG
νϟϯΫΛ4FTTJPOʹ͢ CMSampleBufferCreateReady(sampleBuffer) VTDecompressionSessionDecodeFrame(_:, _:, _:, _:, &sampleBuffer) CZUFྻΛ͢ࣄग़དྷͳ͍ͷͰɺCZUFྻ͔Β ࡞ͬͨ#MPDL#V⒎FSΛݩʹ4BNQMF#V⒎FSΛ࡞Γ͢ɻ !
!OPQQFGPYXPMG
σίʔυࡁΈͷ*NBHF#V⒎FS͕ίʔϧόοΫʹฦ͞Ε Δ callback.decompressionOutputCallback = { (_, _, _, _, imageBuffer,
_, _) in // imageBuffer } 4FTTJPOʹొͨ͠DBMMCBDLσίʔυ͞Εͨ JNBHF#V⒎FS͕ฦͬͯ͘Δ ! !OPQQFGPYXPMG
! !OPQQFGPYXPMG
1SPT$POT &BTZ 4USFBNJOH 1FSGPSNBODF $VTUPNJ[F "7"TTFU3FB EFS P Y P
˚ 75%FDPNQSF TTJPO4FTTJPO Y P P P ϦϞʔτͷΞηοτͷQJYFM#V⒎FSऔΕͳ͍ ! !OPQQFGPYXPMG
75%FDPNQSFTTJPO4FTTJPO ‣ ετϦʔϛϯάͰΩϟϓνϟ͕औΕΔ ‣ "7"TTFU3FBEFSʹόά͕͋ͬͯେৎ ‣ ࢄͯ͠Τϯίʔυ͍ͨ࣌͠ͱ͔ʹศར ‣ ΤϥʔνΣοΫͱ͔ͪΌΜͱ͠ͳ͍ͱ͍͚ͳ͍ !
!OPQQFGPYXPMG
)%FDPEF4BNQMF IUUQTHJUIVCDPNOPQQFGPYXPMG)%FDPEF4BNQMF ! !OPQQFGPYXPMG
OPQQFGPYXPMG,JUTVOFCJ VTDecompressionSessionະαϙʔτ ύϑΥʔϚϯεʹҰఆͷޮՌ͕͋Γͦ͏Ͱ͋Ε࣮༧ ఆ ! !OPQQFGPYXPMG
J04%$ͷ$G1ग़ͯ͠Έ·ͨ͠ɻ ࠓճͷͷ΄͔ɺ,JUTVOFCJΛ.FUBMରԠͤͯ͞Ͳ͏ͳ Δͷ͔ͱ͔ൺֱͯ͠Έ͍ͨͱࢥ͍ͬͯ·͢ ! !OPQQFGPYXPMG