Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Commands (run in an MSYS2 shell):
- ffmpeg -i presage.mkv -filter:v "select='gt(scene,0.5)',showinfo" -f null - 2> PresageSC.txt
- grep showinfo PresageSC.txt | grep -o "pts:[\ 0-9.]*" | grep -o "[0-9.]*" > pts.txt
- Python scripts:
- select.py, to select timestamps at least 150 seconds apart:
- ---
- filePTS = open('pts.txt', 'r')
- PTSArray = []
- for line in filePTS:
- PTSArray.append(float(line)/1000)
- filePTS.close()
- startPTS = 0
- for PTS in PTSArray:
- if (PTS - startPTS) >= 150:
- print PTS
- startPTS = PTS
- ---
- gencmd.py, to generate the ffmpeg cmdline to split the video:
- ---
- filePTS = open('selectedPTS.txt', 'r')
- PTSArray = [0.000]
- for pts in filePTS:
- PTSArray.append(float(pts))
- filePTS.close()
- PTSIndex = 1
- while PTSIndex < len(PTSArray):
- print 'ffmpeg -ss %0.3f -to %0.3f -i presage.mkv %d.y4m' % (PTSArray[PTSIndex-1], PTSArray[PTSIndex], PTSIndex)
- PTSIndex += 1
- print 'ffmpeg -ss %0.3f -i presage.mkv %d.y4m' % (PTSArray[PTSIndex-1], PTSIndex)
- ---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement