Closed shish closed 1 year ago
While trying to make sure this generates exactly-compatible outputs with pm2, I found a bug - PM2 generates the output filename based on the hash of the input media, not the input file -- ie, the filename for the generated subtitles is based on the input video. So when the input video changes, the subtitles are re-encoded; but when the input subtitles are changed, output subtitles are left alone... That explains why I was having trouble getting it to recognise my subtitle typo fixes >_<
I spent a few days trying to add threading into processmedia2 and gave up as I kept running into caching and stateful-ness issues; so now I'm trying a version that has minimal caching and no state. No unit tests yet, but everything else seems to work:
source
directory, we cache hash, duration, lyrics, and tagsPractical benefits:
ffmpeg -threads N
map()
with a progress bar).json
files from themeta
directoryNotes for code review:
main.py
covers the same phases as processmedia2 (scan, encode, export, cleanup)lib/kktypes.py
has classes to represent Source (a file in the source dir), Target (a file in the processed dir), and Track (an entry in tracks.json, which connects sources to targets)lib/tag_processsor.py
is copy-pasted from processmedia2lib/subtitle_processor.py
is copy-pasted from processmedia2lib/encoders.py
is a list of encoding methods for source and target pairs, eg "given 'an image and an audio track', how can we generate 'a .webm file with av1 video and aac audio'?"