[spam][crazy][fiction][random] Non-Canon MCBoss Spinoffs
Undescribed Horrific Abuse, One Victim & Survivor of Many
gmkarl at gmail.com
Fri Sep 1 21:49:08 PDT 2023
Splitting a Video into Shots with TransNetV2 (2020)
YOUTUBE_ID=asdfadsf
VIDEOFILE=asdfadsf # output filename of yt-dlp
!python3 -m pip uninstall ffmpeg || true
!python3 -m pip install git+https://github.com/soCzech/TransNetV2
yt-dlp ffmpeg-python
# get video
!yt-dlp https://www.youtube.com/watch?v=$YOUTUBE_ID
# loads every frame into ram together raw then duplicates the entire
buffer and processes each with 100 copied neighbors
!transnetv2_predict "$VIDEOFILE"
# extract each shot as a separate video
import ffmpeg, tqdm
video = ffmpeg.input(VIDEOFILE)
with open(f'{VIDEOFILE}.scenes.txt') as shots:
total = len(list(shots))
shots.seek(0)
for num, shot in enumerate(tqdm.tqdm(shots, desc='transcoding',
unit='shot', total=total)):
startstr, endstr = shot.strip().split(' ')
video.trim(start_frame=int(startstr),
end_frame=int(endstr)).output(f'{num}.mkv').run()
More information about the cypherpunks
mailing list