I am currently writing a script for my raspberry pi 3B that calls FFmpeg to write m3u8 streams to a .TS file. However since I am recording hour long streams, some that aren't needed, I also wrote side script that will run at 5 second intervals, seek to a timestamp in the writing video and save a frame from it to be compiled into a timelapse-like video later. The current command I am using is...
ffmpeg -n -ss second_to_process -i "test.ts" -frames:v 1 "test.jpg"'
The problem right now is that frame capture operation seems to be very cpu intensive on my pi. Recording the m3u8 streams take barely any cpu since it seems to be I/O driven, but running 2-3 operations of the frame capture script eats up 75% of my cpu. I'm looking to record anywhere from 4-12 streams at any time.
Current thoughts are to try and seek keyframes/i-frame times and to save them out, since I think the intensive part is the encoding aspect when seeking, but I'm not sure if doing that is any less intensive. I've tried using opencv with python, and the processing is about the same. Open to suggestions