Investigate and fix frames dropping issues in videocapture found in ses-20240830 #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is brother of issue #68 we have with frames dropping. Got this issue in ReproNim ses-20240830 time calibration session. Closes #112. Closes #113. Closes #114.
Proposal is listed below:
Re-configure
reprostim-videocapture
/ffmpeg
with options:v_enc
:-preset ultrafast
- fastest encoding, lowest compression efficiency.-crf 18
- consider CRF value 17 or 18 to be visually lossless or nearly.-tune zerolatency
- reduce latency during encoding, to improove timing in recorded videos.-b:v 2M
- cut video bitrate to 2 Mbps (this rate can be changed later).-maxrate 2M
- set the same as plain bitrate, and don't allow encoder to exceed it even temporarily.-bufsize 4M
- hardcode video buffer size to 4 Mbps.-vf setpts=PTS-STARTPTS
- apply filter to reset the timestamps of the video frames, starting from 0. ?? Consider in future explict frame rate specification via-r ***
option like 60 FPS.n_threads
:-threads 4
- force ffmpeg to use only 4 CPU/threads explicitly. Consider in furture 2 or 3 values according to reproiner box hardware (it's 4 core box by now).a_enc
:-af asetpts=PTS-STARTPTS
- apply filter to reset the timestamps of the audio frames, starting from 0. ?? Consider in future explicit-ar ***
sample rate values extracted from ALSA/Magewell (44.1K, 48K etc) to improove timing and synchronization with video stream.Current results of applied options on dev PC:
Current results of applied options @reproiner:
-b:v 8M -maxrate 8M -bufsize 16M
and monitor CPU, *.mkv size and quality.