Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Inconsistent FPS during recording to mp4

Open
#1,817 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
android, java, kotlin, nginx

Research direction

The report covers Camera2Source with GenericStream in the Android library and gives no file name, test, or reproduction steps. Start by finding where the recorder and the video frame timestamps are handled, but expect to reproduce the drop on a device first. Done would mean a root cause for the intermittent fps drop, confirmed by a fix or a reproduction in the maintainer's own footage.

Written by the indexing model from the issue text.

Description

Describe the bug
We have seen footage recorded have a transient bug which causes the FPS to drop while recording to an MP4 file. We are using h264 encoding w/ 1280x720p @ 30fps (android fps Range [30, 30]) w/ 4Mbps bitrate with AAC audio encoding @ 96Kbps bitrate. Normally, all the footage recorded follows the consistent 30fps setting, with ffprobe reporting ~29.82 fps or similar values. However, footage which have the bug present, will report an average fps from ffprobe of ~22fps or even as low as ~5 or ~6fps, which is below even the variable FPS range supported on our device (the lowest FPS range with a 30fps maximum is [7, 30]). This has become a problem because when footage is finished being recorded, the audio and video appear out of sync. For now, we have a process which detects footage with this bug, and simply trans-codes it to keep both tracks in sync by inserting duplicate frames. This makes the footage appear choppy or slowed, which is not ideal for our customers.

I know this is not a great description in terms of debugging, but we have not been able to reliably reproduce the problem yet. We are still trying, but currently we have only seen the issue on customer devices, and we cannot provide their footage as example. We are working to get example footage of our own, and to narrow down steps to reproduce the bug.

The devices which are recording the footage are all the same model of device, so this is not a device variation issue. The device runs AOSP version 9 (SDK 28).

Expected behavior
Recorded footage should maintain avg. fps @ 30 ([30, 30] on android).

Smartphone (please complete the following information):

  • Library version: 2.5.5 & 2.6.0
  • Device: Cammpro C8
  • OS: Android 9
  • Media server: nginx-rtmp
  • Class used: GenericStream w/ Camera2Source.
Dominant language
Kotlin
Stars
3k
Forks
946
Avg merge
4d 6h
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pedroSG94/RootEncoder

All issues in pedroSG94/RootEncoder

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.