Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/OpenIPC.Viewer.Video/Pipeline/FfmpegVideoSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,10 @@ private unsafe void BuildOpts(AVDictionary** opts)
ffmpeg.av_dict_set(opts, "max_delay", "200000", 0); // 200ms reorder window
ffmpeg.av_dict_set(opts, "buffer_size", "1048576", 0);
ffmpeg.av_dict_set(opts, "reorder_queue_size", "0", 0);
ffmpeg.av_dict_set(opts, "fflags", "nobuffer", 0);
// No "fflags nobuffer": it throws away the packets read while
// avformat_find_stream_info probes, and some NVRs open every session
// with a keyframe that later frames keep referencing (POC 0). Without
// it neither software nor VideoToolbox can decode a frame (#94).
}

private static string BuildUrlWithCredentials(Uri uri, CameraCredentials? creds)
Expand Down
5 changes: 3 additions & 2 deletions src/OpenIPC.Viewer.Web/Api/LiveFfmpeg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public static Process Start(string rtspUrl, bool transcode)
};

// RTSP socket I/O timeout (µs) so a silent camera ends the process
// instead of holding a connection open forever.
var args = new List<string> { "-rtsp_transport", "tcp", RtspTimeoutFlag(), RtspTimeoutMicros, "-fflags", "nobuffer", "-i", rtspUrl };
// instead of holding a connection open forever. No "-fflags nobuffer":
// it drops the session's opening keyframe on some NVRs (#94).
var args = new List<string> { "-rtsp_transport", "tcp", RtspTimeoutFlag(), RtspTimeoutMicros, "-i", rtspUrl };

// Audio rides along in the same stream instead of getting its own ffmpeg
// session: AAC at 64 kbps is around a percent of the video bitrate, so
Expand Down
Loading