fork(8) download
  1. #!/bin/bash
  2.  
  3. awk -F= -v duration=$((45 * 60)) '
  4. function chapter(start, end, title) {
  5. print "[CHAPTER]"
  6. print "TIMEBASE=1/1000"
  7. print "START=" start "000"
  8. print "END=" end "000"
  9. print "title=" title }
  10. BEGIN { print ";FFMETADATA1" }
  11. { split($1, hms, ":") ;
  12. end=3600 * hms[1] + 60 * hms[2] + hms[3] }
  13. title { chapter(start, end, title) }
  14. { start=end; title=$2 }
  15. END { chapter(start, duration, title) }'
Success #stdin #stdout 0.01s 5516KB
stdin
00:00:00=Intro
00:02:12=What are selections
00:03:19=Booleans
stdout
;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1000
START=0000
END=132000
title=Intro
[CHAPTER]
TIMEBASE=1/1000
START=132000
END=199000
title=What are selections
[CHAPTER]
TIMEBASE=1/1000
START=199000
END=2700000
title=Booleans