Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Allow choosing the video bitrate mode (CBR / VBR / CQ) instead of always forcing CBR

Aperta Adatta ai principianti
#2,213 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, kotlin
Ambito
backend

Direzione di ricerca

Inizia da VideoEncoder.prepareVideoEncoder() in VideoEncoder.java e leggi come vengono attualmente selezionate la modalità di bitrate e registrate le funzionalità del codec. Aggiungi il setter e il getter richiesti. Usa la modalità richiesta solo se supportata e, in caso contrario, mantieni il comportamento predefinito attuale. Il lavoro è completato quando i chiamanti possono selezionare una modalità supportata prima di prepareVideo() e le modalità non supportate ripiegano sul comportamento predefinito con un messaggio di log.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

VideoEncoder.prepareVideoEncoder() always sets KEY_BITRATE_MODE = BITRATE_MODE_CBR when the codec reports CBR support, and there is no way to change it from the app.

On some hardware encoders, CBR makes every keyframe come out noticeably more compressed than the frames around it. Viewers see a "pulse" (a short loss of sharpness) once per GOP. We measured it on a Samsung Galaxy S20 FE (Snapdragon 865, OMX.qcom.video.encoder.hevc) at 1080p30, 4.5 Mbps, GOP 2 s, by reading the per-frame slice QP of the recorded file:

Mode P-frames QP I-frame QP Real bitrate
CBR (current default) 24.4 28.0 (+3.6, visible pulse) 4.7 Mbps
VBR 24.0 23.2 (no pulse) 4.5 Mbps
VBR, H.264 High 24.0 23.5 (no pulse) 4.8 Mbps

With VBR the pulse disappears and the average bitrate stays at the requested value. On Android 13+ the requested VBR bitrate needs about 5/6 compensation on this device, but that is up to the app.

Proposal

  • Add setBitrateMode(int mode) / getBitrateMode() to VideoEncoder, taking MediaCodecInfo.EncoderCapabilities.BITRATE_MODE_* or -1.
  • -1, the default, keeps today's behavior exactly: CBR if supported, otherwise the codec default. Existing apps don't change.
  • If a mode is set, it is used only if the codec reports it as supported (EncoderCapabilities.isBitrateModeSupported); otherwise it falls back to the current logic and logs it.
  • Expose it in the stream classes the same way other encoder options are, e.g. stream.getVideoEncoder().setBitrateMode(...) before prepareVideo().

The change is about 20 lines in VideoEncoder.java, with no new dependencies. We have been running an equivalent patch in production in our app Score Catch (sports streaming with a live scoreboard), and we are happy to open a PR with the code if you agree with the approach.

Lingua principale
Kotlin
Stelle
3k
Fork
946
Merge medio
3g 17h
PR unite (30g)
9

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pedroSG94/RootEncoder

Tutte le issue di pedroSG94/RootEncoder

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.