Improved ffmpeg error resilience for ad stitched streams

This commit is contained in:
Trevor Mears
2026-01-01 00:33:10 -08:00
parent ea3aff2f04
commit 2531f1786f
2 changed files with 17 additions and 3 deletions
+8 -1
View File
@@ -26,7 +26,14 @@ router.get('/', (req, res) => {
const args = [ const args = [
'-hide_banner', '-hide_banner',
'-loglevel', 'warning', '-loglevel', 'warning',
'-fflags', '+genpts+discardcorrupt', // Error resilience: discard corrupt packets, generate timestamps
'-fflags', '+genpts+discardcorrupt+igndts',
// Ignore errors in stream and continue
'-err_detect', 'ignore_err',
// Reconnect settings for network drops
'-reconnect', '1',
'-reconnect_streamed', '1',
'-reconnect_delay_max', '5',
'-i', url, '-i', url,
// Copy ALL streams without re-encoding // Copy ALL streams without re-encoding
'-c', 'copy', '-c', 'copy',
+9 -2
View File
@@ -21,11 +21,18 @@ router.get('/', (req, res) => {
// FFmpeg arguments for transcoding // FFmpeg arguments for transcoding
// Optimized for VOD content with incompatible audio (Dolby/AC3/EAC3) // Optimized for VOD content with incompatible audio (Dolby/AC3/EAC3)
// NOT recommended for live streams - use HLS.js directly for those // Also works for live streams with ad stitching (Pluto TV, etc.)
const args = [ const args = [
'-hide_banner', '-hide_banner',
'-loglevel', 'warning', '-loglevel', 'warning',
'-fflags', '+genpts', // Error resilience: discard corrupt packets, generate timestamps
'-fflags', '+genpts+discardcorrupt+igndts',
// Ignore errors in stream and continue
'-err_detect', 'ignore_err',
// Reconnect settings for network drops (useful for live streams)
'-reconnect', '1',
'-reconnect_streamed', '1',
'-reconnect_delay_max', '5',
'-i', url, '-i', url,
// Video: passthrough (no re-encoding = fast!) // Video: passthrough (no re-encoding = fast!)
'-c:v', 'copy', '-c:v', 'copy',