jasonjmcghee / rem

An open source approach to locally record and enable searching everything you view on your Mac.
https://rem.ing
MIT License
2.2k stars 63 forks source link

If quit before video processed, frames still exist in sqlite db, but produce grey screen #4

Open jasonjmcghee opened 6 months ago

jasonjmcghee commented 6 months ago

For example, frames without associated video:

sqlite> select * from video_chunks order by id desc limit 2;
10|/Users/jason/Library/Application Support/today.jason.rem/output-1703765761.890883.mp4
9|/Users/jason/Library/Application Support/today.jason.rem/output-1703765749.5049071.mp4

sqlite> select * from frames order by id desc limit 2;
80|11|1|2023-12-28T12:16:06.476|System Settings
79|11|0|2023-12-28T12:16:04.026|System Settings
cparish312 commented 2 months ago

@jasonjmcghee I think I have a potential solution: 1) Move let _ = DatabaseManager.shared.startNewVideoChunk(filePath: outputPath) to the end of the processChunk() and check that the ffmpegProcess exited successfully 2) Change getCurrentChunkId() in DB.swift to return the chunkId of the last inserted frame 3) Any process accessing the frames can ignore frames whose chunks don't exist in the videoChunks table

jasonjmcghee commented 2 months ago

That sounds like a good plan.

We might even be able to get all available frames joined on video chunks table (paginated) and select from those