I'm writing a program that needs to be able to place a very short media file in the middle of a longer media file. I want to use ffmpeg for this. I'm aware you can split the long file in half and then concat the 3 files together (first half of long video > short video > second half of long video). I tried doing this with the concat filter, but this takes an extremely long time as our managed kubernetes provider does not have an option for GPU resources.
I realized since the first and last clips will always be the exact same format (since they were split from the same source file), I could just convert only the middle very short clip to match the 2 halves. Then, all 3 clips would be in the format and I could simply use the concat remuxer.
The short clip was also generated by ffmpeg by looping the same single frame over and over again over an audio clip. Therefore, if my idea is possible, ffmpeg would only have to transcode the audio and the single looping frame. Way better then transcoding the entire long clip and the short clip from scratch.
How can I make ffmpeg re-encode a video to match another exactly so I can concat remux them together?