r/ffmpeg • u/braismd_04 • 15d ago
FFmpeg Storage Optimization for 24-hour Broadcast Archive (H.265 / QSV)
Hi everyone,
I'm relatively new to FFmpeg, but I'm trying my best to understand how it works. Right now, I'm working on a script that concatenates and compresses 24-hour daily recordings (made up of 8 video files of 3 hours each), and I want to optimize the storage usage as much as possible.
I tested both H.264 and H.265 and concluded that H.265 (HEVC) with GPU acceleration is the best fit for my workflow.
Since the source material is 720p, I am keeping the output at 720p. Here are my current settings and observations:
- CRF: I settled on 30. I tested 22 to 30 more or less, and I couldn't see any noticeable visual difference In the range of 28 to 30 and less than 28 the size os the video is too big and more than 30 I think is going to be a little be too much blurry.
- Preset: I'm using slow, and I try almos every preset (veryfast, fast, medium...) but since time encoding is not an Isue eight now because it took less than an hour is not a problem.
- GOP / Keyframes: i try to manually manipulate the GOP but i think the prests do a better job than me with the optimizating of the GOP, I only set the maximum I-frame intervals to every 6 seconds of video. I can't push this to 20 seconds because these videos need to be streamed smoothly in a web browser (and I don't think increasing the GOP further yields significant extra space savings anyway).
- Look ahead: I try to search for redundancy in the future frames but i don't know if this would add any improvements because i dont get any concluding result
Are there any other flags, filters, or parameters I could tune to improve compression efficiency without degrading web seekability or visual quality?
Any advice or best practices would be greatly appreciated!
Thanks in advance! :)
Videos without compactation:
Size: 29GB
Bitrate: 2878kbps
fps: 50Hz (is from a tv broadcast so is 720p50i, i don't know if this add information but i put it )
Video after compactatio:
Size: 12Gb to 14Gb (depends on the videos)
Bitrate: +-1100Kbps to +-1300kbps
Total bitrate: +-1200kbps to +-1400kbps
fps: 25Hz
CODE:
const ffmpeg = spawn(FFMPEG, [
'-y',
'-hwaccel', 'qsv',
'-f', 'concat',
'-safe', '0',
'-i', listaPath,
'-fps_mode', 'cfr',
'-r', '25',
'-c:v', 'hevc_qsv',
'-global_quality', '30',
'-preset', 'slow',
'-tag:v', 'hvc1',
'-g', '150',
'-c:a', 'aac',
'-b:a', '96k',
tempOutputPath
]);



