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
280
既存アプリをvisionOS対応してリリースした話/visionOS LT vol5
noppefoxwolf
0
170
UIのブラックボックスを探る/iOSDC23
noppefoxwolf
3
3.9k
CoreGraphicsでドット絵を描こう/iOSDC22
noppefoxwolf
0
2.1k
ランタイムデバッグのススメ/iOSDC21
noppefoxwolf
1
4.3k
google/mediapipe で始めるARアプリ開発/iOSDC2020
noppefoxwolf
1
1.4k
モバイルファーストなアプリを作るためにvearがしたこと/xRDCC
noppefoxwolf
0
93
ソーシャルライブサービスにおけるデジタル化粧の仕組みと実装/iOSDC19
noppefoxwolf
4
5.3k
Limited import clarification and its effect/tryswift2019
noppefoxwolf
2
1.2k
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
140
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
Click-free releases & the making of a CLI app
oheyadam
2
110
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
Realtime API 入門
riofujimon
0
150
C++でシェーダを書く
fadis
6
4.1k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
100
Arm移行タイムアタック
qnighy
0
320
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
Featured
See All Featured
Gamification - CAS2011
davidbonilla
80
5k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Optimizing for Happiness
mojombo
376
70k
GraphQLとの向き合い方2022年版
quramy
43
13k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Documentation Writing (for coders)
carmenintech
65
4.4k
Side Projects
sachag
452
42k
Facilitating Awesome Meetings
lara
50
6.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
BBQ
matthewcrist
85
9.3k
Designing the Hi-DPI Web
ddemaree
280
34k
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