SlideShare a Scribd company logo
FFMS2: Indexing, Edge Cases, and Insanity
Hiding the Complexity of Frame-Accurate Seeking
derek@videolan.org
@daemon404
Derek Buitenhuis
15 September 2018
Amsterdam, NL
$ whoami
115 September 2018
• Senior Video Encoding Engineer at Vimeo
• Distributed transcoder
• On-the-fly image service (before it was cool)
• HLS/DASH on-the-fly packager
• Subtitles / captions ingest and output
• Open Source Multimedia Developer
• FFmpeg, L-SMASH, FFMS2, etc.
• Daemon404 on freenode
• VideoLAN Non-Profit Association Member
EBU OPEN SOURCE MEETUP
Frame / Sample Accurate Seeking is Hard
215 September 2018
• Not everyone is lucky enough to get known-format deliverables (iTunes, IMF, DPP, etc.)
• User-generated content can, and will by anything
EBU OPEN SOURCE MEETUP
Frame / Sample Accurate Seeking is Hard
215 September 2018
• Not everyone is lucky enough to get known-format deliverables (iTunes, IMF, DPP, etc.)
• User-generated content can, and will by anything
• Streams can be (extremely non-exhaustive):
• Non-indexed (MPEG-TS, MPEG-PS, etc.)
• Corrupt
• Contain virtual timelines (edit lists, ordered chapters)
• Have invisible frames
• Crazy timestamps
EBU OPEN SOURCE MEETUP
Frame / Sample Accurate Seeking is Hard
215 September 2018
• Not everyone is lucky enough to get known-format deliverables (iTunes, IMF, DPP, etc.)
• User-generated content can, and will by anything
• Streams can be (extremely non-exhaustive):
• Non-indexed (MPEG-TS, MPEG-PS, etc.)
• Corrupt
• Contain virtual timelines (edit lists, ordered chapters)
• Have invisible frames
• Crazy timestamps
• Only feasible solution is FFmpeg (libavcodec / libavformat)
• Doesn’t seek frame accurately out of the box
• Unstable, verbose, massive API (much of which is missing, and actually in ffmpeg.c)
EBU OPEN SOURCE MEETUP
FFMS2: We Go Crazy So You Don’t Have To
315 September 2018
• Indexes files or streams and builds packet-to-frame map
• Non-trivial due to things like NVOPs, alt-refs, PAFF, libavformat’s implementation of edit lists, etc.
• Proper concept of timestamps (each frame has multiple types!)
EBU OPEN SOURCE MEETUP
FFMS2: We Go Crazy So You Don’t Have To
315 September 2018
• Indexes files or streams and builds packet-to-frame map
• Non-trivial due to things like NVOPs, alt-refs, PAFF, libavformat’s implementation of edit lists, etc.
• Proper concept of timestamps (each frame has multiple types!)
• Stable, mature, threadsafe, easy to use C API
• Fully documented (whack me if not!)
• Stable ABI (10 years!)
• AviSynth and VapourSynth plugins; built into x264
• Proper support for mid-stream changes, real colorspace info (HDR included), etc.
• Proper / useful error handling
• MIT licensed
EBU OPEN SOURCE MEETUP
FFMS2: Coming Soon
415 September 2018
EBU OPEN SOURCE MEETUP
• Custom I/O Callbacks
• Caller-owned Frame Buffers
• Mid-stream codec changes (“soon”)
• Virtual Timeline Metadata Export (need to finish upstreaming new APIs to FFmpeg first)
Links and Info!
515 September 2018
EBU OPEN SOURCE MEETUP
• FFMS2 (source, docs, binaries): https://github.com/ffms/ffms2/
• FFMS2 Index Parsing in Go (and JSON dump util): https://github.com/dwbuiten/dumpindex/
• VapourSynth: https://vapoursynth.com / https://github.com/vapoursynth/vapoursynth/
• avformat Timeline API RFC v1: http://ffmpeg.org/pipermail/ffmpeg-devel/2018-March/227437.html
• v2 + implementation in the works

More Related Content

Similar to FFMS2: Indexing, Edge Cases, and Insanity

Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019
Lorenzo Miniero
 
Timed Text At Netflix
Timed Text At NetflixTimed Text At Netflix
Timed Text At NetflixRohit Puri
 
Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020
Lorenzo Miniero
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
Lorenzo Miniero
 
Python Capitulo uno curso de programacion
Python Capitulo uno curso de programacionPython Capitulo uno curso de programacion
Python Capitulo uno curso de programacion
Jesus Vilchez Sandoval
 
LORENZ Building an integrated digital media archive and legal deposit
LORENZ Building an integrated digital media archive and legal depositLORENZ Building an integrated digital media archive and legal deposit
LORENZ Building an integrated digital media archive and legal deposit
FIAT/IFTA
 
Non-Blocking Strategies for FFI
 Non-Blocking Strategies for FFI Non-Blocking Strategies for FFI
Non-Blocking Strategies for FFI
ESUG
 
Open Source Swift Under the Hood
Open Source Swift Under the HoodOpen Source Swift Under the Hood
Open Source Swift Under the Hood
C4Media
 
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Chris Adamson
 
Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020
Lorenzo Miniero
 
Janus + Audio @ Open Source World
Janus + Audio @ Open Source WorldJanus + Audio @ Open Source World
Janus + Audio @ Open Source World
Lorenzo Miniero
 
SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017
Lorenzo Miniero
 
WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022
Lorenzo Miniero
 
DPFManager workshop
DPFManager workshopDPFManager workshop
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Chris Adamson
 
Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...
Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...
Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...
Embarcados
 
Apache Tika end-to-end
Apache Tika end-to-endApache Tika end-to-end
Apache Tika end-to-end
gagravarr
 
Tutorial adaptive-streaming
Tutorial adaptive-streamingTutorial adaptive-streaming
Tutorial adaptive-streaming
JohnGregory89
 
C14 fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...
C14   fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...C14   fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...
C14 fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...FIAT/IFTA
 
SIP2SIP - Direcciones SIP gratuitas para las masas
SIP2SIP - Direcciones SIP gratuitas para las masasSIP2SIP - Direcciones SIP gratuitas para las masas
SIP2SIP - Direcciones SIP gratuitas para las masas
PaloSanto Solutions
 

Similar to FFMS2: Indexing, Edge Cases, and Insanity (20)

Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019Fuzzing RTC @ Kamailio World 2019
Fuzzing RTC @ Kamailio World 2019
 
Timed Text At Netflix
Timed Text At NetflixTimed Text At Netflix
Timed Text At Netflix
 
Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020Insertable Streams and E2EE @ ClueCon2020
Insertable Streams and E2EE @ ClueCon2020
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Python Capitulo uno curso de programacion
Python Capitulo uno curso de programacionPython Capitulo uno curso de programacion
Python Capitulo uno curso de programacion
 
LORENZ Building an integrated digital media archive and legal deposit
LORENZ Building an integrated digital media archive and legal depositLORENZ Building an integrated digital media archive and legal deposit
LORENZ Building an integrated digital media archive and legal deposit
 
Non-Blocking Strategies for FFI
 Non-Blocking Strategies for FFI Non-Blocking Strategies for FFI
Non-Blocking Strategies for FFI
 
Open Source Swift Under the Hood
Open Source Swift Under the HoodOpen Source Swift Under the Hood
Open Source Swift Under the Hood
 
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
Glitch-Free A/V Encoding (CocoaConf Boston, October 2013)
 
Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020
 
Janus + Audio @ Open Source World
Janus + Audio @ Open Source WorldJanus + Audio @ Open Source World
Janus + Audio @ Open Source World
 
SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017SIP/WebRTC load testing @ KamailioWorld 2017
SIP/WebRTC load testing @ KamailioWorld 2017
 
WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022WHIP WebRTC Broadcasting @ FOSDEM 2022
WHIP WebRTC Broadcasting @ FOSDEM 2022
 
DPFManager workshop
DPFManager workshopDPFManager workshop
DPFManager workshop
 
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
Building A Streaming Apple TV App (CocoaConf DC, Sept 2016)
 
Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...
Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...
Webinar gravado: Programando Microcontroladores ARM da Microchip usando MPLAB...
 
Apache Tika end-to-end
Apache Tika end-to-endApache Tika end-to-end
Apache Tika end-to-end
 
Tutorial adaptive-streaming
Tutorial adaptive-streamingTutorial adaptive-streaming
Tutorial adaptive-streaming
 
C14 fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...
C14   fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...C14   fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...
C14 fiatifta dubai 2013, the mpeg-7 audiovisual description profile standar...
 
SIP2SIP - Direcciones SIP gratuitas para las masas
SIP2SIP - Direcciones SIP gratuitas para las masasSIP2SIP - Direcciones SIP gratuitas para las masas
SIP2SIP - Direcciones SIP gratuitas para las masas
 

Recently uploaded

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 

Recently uploaded (20)

Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 

FFMS2: Indexing, Edge Cases, and Insanity

  • 1. FFMS2: Indexing, Edge Cases, and Insanity Hiding the Complexity of Frame-Accurate Seeking derek@videolan.org @daemon404 Derek Buitenhuis 15 September 2018 Amsterdam, NL
  • 2. $ whoami 115 September 2018 • Senior Video Encoding Engineer at Vimeo • Distributed transcoder • On-the-fly image service (before it was cool) • HLS/DASH on-the-fly packager • Subtitles / captions ingest and output • Open Source Multimedia Developer • FFmpeg, L-SMASH, FFMS2, etc. • Daemon404 on freenode • VideoLAN Non-Profit Association Member EBU OPEN SOURCE MEETUP
  • 3. Frame / Sample Accurate Seeking is Hard 215 September 2018 • Not everyone is lucky enough to get known-format deliverables (iTunes, IMF, DPP, etc.) • User-generated content can, and will by anything EBU OPEN SOURCE MEETUP
  • 4. Frame / Sample Accurate Seeking is Hard 215 September 2018 • Not everyone is lucky enough to get known-format deliverables (iTunes, IMF, DPP, etc.) • User-generated content can, and will by anything • Streams can be (extremely non-exhaustive): • Non-indexed (MPEG-TS, MPEG-PS, etc.) • Corrupt • Contain virtual timelines (edit lists, ordered chapters) • Have invisible frames • Crazy timestamps EBU OPEN SOURCE MEETUP
  • 5. Frame / Sample Accurate Seeking is Hard 215 September 2018 • Not everyone is lucky enough to get known-format deliverables (iTunes, IMF, DPP, etc.) • User-generated content can, and will by anything • Streams can be (extremely non-exhaustive): • Non-indexed (MPEG-TS, MPEG-PS, etc.) • Corrupt • Contain virtual timelines (edit lists, ordered chapters) • Have invisible frames • Crazy timestamps • Only feasible solution is FFmpeg (libavcodec / libavformat) • Doesn’t seek frame accurately out of the box • Unstable, verbose, massive API (much of which is missing, and actually in ffmpeg.c) EBU OPEN SOURCE MEETUP
  • 6. FFMS2: We Go Crazy So You Don’t Have To 315 September 2018 • Indexes files or streams and builds packet-to-frame map • Non-trivial due to things like NVOPs, alt-refs, PAFF, libavformat’s implementation of edit lists, etc. • Proper concept of timestamps (each frame has multiple types!) EBU OPEN SOURCE MEETUP
  • 7. FFMS2: We Go Crazy So You Don’t Have To 315 September 2018 • Indexes files or streams and builds packet-to-frame map • Non-trivial due to things like NVOPs, alt-refs, PAFF, libavformat’s implementation of edit lists, etc. • Proper concept of timestamps (each frame has multiple types!) • Stable, mature, threadsafe, easy to use C API • Fully documented (whack me if not!) • Stable ABI (10 years!) • AviSynth and VapourSynth plugins; built into x264 • Proper support for mid-stream changes, real colorspace info (HDR included), etc. • Proper / useful error handling • MIT licensed EBU OPEN SOURCE MEETUP
  • 8. FFMS2: Coming Soon 415 September 2018 EBU OPEN SOURCE MEETUP • Custom I/O Callbacks • Caller-owned Frame Buffers • Mid-stream codec changes (“soon”) • Virtual Timeline Metadata Export (need to finish upstreaming new APIs to FFmpeg first)
  • 9. Links and Info! 515 September 2018 EBU OPEN SOURCE MEETUP • FFMS2 (source, docs, binaries): https://github.com/ffms/ffms2/ • FFMS2 Index Parsing in Go (and JSON dump util): https://github.com/dwbuiten/dumpindex/ • VapourSynth: https://vapoursynth.com / https://github.com/vapoursynth/vapoursynth/ • avformat Timeline API RFC v1: http://ffmpeg.org/pipermail/ffmpeg-devel/2018-March/227437.html • v2 + implementation in the works