You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

highlight-pipeline-planning.org 5.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. * Highlight Generator Pipeline Planning
  2. ** Overview
  3. [[file:~/downloads/highlightgeneration-process.svg]]
  4. [[https://roberthallam.com/files/highlightgeneration-process.svg]]
  5. ** Pipeline `API'
  6. *** Input
  7. User-driven selection of input videos.
  8. - files :: /user-selected/ list of ≥1 input files to be processed
  9. - (optional) time restriction :: start and end time (or: start time + duration?) of file to restrict highlight generation to (format: s & H:M:s ?) (see note)
  10. - (optional, /stretch/) feature extractor mapping :: a map of files to feature exactors, eg:
  11. #+BEGIN_SRC yaml
  12. video1:
  13. path: /video/directory/video1.mkv
  14. feature_extractors:
  15. - laughter-detection
  16. - loud-moments
  17. video2:
  18. path: /video/directory/video2.mp4
  19. start: 10:00
  20. end: 50:00
  21. feature_extractors:
  22. - word-recognition
  23. #+END_SRC
  24. **** Time Restriction
  25. To properly operate on a restricted range, this can create a temporary media file (using eg ffmpeg) for operation on by the *Feature Selection* step.
  26. Creating a temporary file can be avoided by ensuring each /Feature Selector/ respects a custom duration, but since some are third-party they may need their implementation updated.
  27. *Discussion point*: pros and cons of updating 3P feature selectors
  28. **** Output
  29. Conceptually, a list of files (either original path, or path to temporary time-restricted version) and associated options for each. This will either be a language-specific object, or the equivelent JSON.
  30. Example:
  31. #+BEGIN_SRC json
  32. {
  33. source_videos: [
  34. { "path": "/video/director/video1.mkv",
  35. "feature_extractors": [
  36. "laughter-detection",
  37. "loud-moments",
  38. ],
  39. },
  40. { "path": "/tmp/videohighlights/inputclip0001.mkv",
  41. "feature_extractors": [
  42. "word-recognition"
  43. ],
  44. }
  45. ]
  46. }
  47. #+END_SRC
  48. **** Further Considerations
  49. - time specification formats -- start & end ? start & duration? either? negative times for specifying time distance from /end/ of file?
  50. *** Source / Feature Selection
  51. A ~Source~ is an automation-driven /method/ of figuring out what bits of an *input video* to keep.
  52. **** Input
  53. A ist of input videos as in *Input*
  54. **** Options
  55. - ~Source~-specific /options/ (eg min duration, threshold etc for laughter-detection),
  56. - /working directory/
  57. - minimum duration (see /Further Considerations/)
  58. **** Output
  59. A set of ≥0 /Feature/-type objects or equivalent JSON.
  60. **** Further Considerations
  61. At time of writing the feature selection drivers conceptually output timestamps, as opposed to durations; but conceptually durations make more sense. It may be worthwhile to automatically promote any `point' timestamps to a duration.
  62. Pros: makes the next step in the pipeline more uniform
  63. Cons: will probably over-sample
  64. Consequent consideration: does that mean we should let the user adjust the /pre-consolidation/ times too? Probably, but doing that it a UX-friendly way will potentially take some doing.
  65. *** Consolidation
  66. The consolidation stage takes a list of timestamps (across videos) and /consolidates/ / merges proximal times to create *clip definitions* across *sources*.
  67. - input :: a list of *video files* with associated *timestamps* or *time ranges* (and their sources), eg in JSON:
  68. #+BEGIN_SRC json
  69. { "videos": [ "/path/to/videos/video1.mp4": [ { "time": 180, "source": "laughter-detect" },
  70. { "time": 187, "source": "laughter-detect" },
  71. { "time": 295, "source": "loud-detect" },
  72. { "time": 332, "source": "laughter-detect" }
  73. ],
  74. "/path/to/videos/video2.mp4": [ { "start": 45, "end": 130, "source": "segmenter" } ],
  75. ]
  76. }
  77. #+END_SRC
  78. **** Approach
  79. The input list of feature times goes through comparison process: if a feature has /overlap/ with another (that is, starts or ends within the time period of another feature), those two features are consolidated into one. This comparison can be done with a /delta/, a small amount of time (eg 15s) for which `nearby' intervals can be considered overlapping.
  80. **** Options
  81. - maximum delta between clips to be consolidated (default: 15s [rationale: Stetson-Harrison approach[fn:stetson])
  82. - maximum duration of a consolidated clip (default: 60s [rationale: max duration of YT shorts?])
  83. - maximum number of consolidated clips to output (default: unlimited)
  84. [fn:stetson] The [[https://english.stackexchange.com/a/426717][Stetson-Harrison]] approach
  85. *** Refinement
  86. User-driven process of /selection/ and applying /operators/ to clips before final output.
  87. **** 1. Selection
  88. User choice of which clips to keep.
  89. **** 2. Process
  90. User applies (video) ~Processes~ to the clip(s):
  91. - duration :: select start and end time (possibly before/after generated clip's boundaries)
  92. - join :: further join clips which were not joined at consolidation stage
  93. - filters :: eg sharpen / slomo / (de)saturate etc [stretch]
  94. - split ::
  95. *Note*: need to be careful not to reimplement an NLE here!
  96. *** Highlights
  97. Ultimate output.