Genymobile / Genymobile/scrcpy

[server] ERROR: Encoding error: java.lang.IllegalStateException: releaseOutputBuffer() is valid only at Executing states; currently at Released state

Open
#5,502 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
150k
Forks
13.7k
Avg merge
4d 13h
Merged PRs (30d)
2

Description

## Environment

- **OS:** Windows
- **Scrcpy version:** 2.7
- **Installation method:** Windows release
- **Device model:**Oneplus Ace 3v
- **Android version:** 14

## Describe the bug
When running scrcpy for a random time(several minutes to hours), the mirror get stuck, shut down and give error logs like this, I've used the command `scrcpy --turn-screen-off --stay-awake --no-audio -m2768 --print-fps --display-buffer=50 --video-codec=h265 --video-encoder="c2.qti.hevc.encoder"`

```
[server] ERROR: Encoding error: java.lang.IllegalStateException: releaseOutputBuffer() is valid only at Executing states; currently at Released state

[server] INFO: Retrying...
INFO: 63 fps
INFO: 51 fps (+3 frames skipped)
INFO: 64 fps
INFO: 59 fps
INFO: 58 fps (+7 frames skipped)
INFO: 52 fps (+1 frames skipped)
INFO: 61 fps (+1 frames skipped)
INFO: 57 fps
INFO: 64 fps
INFO: 58 fps
INFO: 57 fps (+1 frames skipped)
INFO: 50 fps
ERROR: [FFmpeg] Could not find ref with POC 396
ERROR: [FFmpeg] Invalid number of merging MVP candidates: 6.
WARN: [FFmpeg] Error parsing NAL unit #1.
ERROR: Decoder 'video': could not send video packet: -1094995529
ERROR: Demuxer error
```

I've also tried the default encoder with the command `scrcpy --turn-screen-off --stay-awake --no-audio -m2768 --print-fps --display-buffer=50` , it gets stuck as the same, but it can resume after several retries with the logs like:

```
[server] ERROR: Encoding error: java.lang.IllegalStateException: releaseOutputBuffer() is valid only at Executing states; currently at Released state

[server] INFO: Retrying...
INFO: 72 fps
INFO: 64 fps
INFO: 76 fps
INFO: 77 fps
INFO: 76 fps
INFO: 76 fps
INFO: 75 fps
INFO: 80 fps
INFO: 75 fps
INFO: 71 fps
INFO: 79 fps
INFO: 75 fps
INFO: 77 fps
ERROR: [FFmpeg] Could not find ref with POC 503
INFO: 42 fps
INFO: 60 fps (+16 frames skipped)
INFO: 77 fps (+5 frames skipped)
INFO: 58 fps
[server] ERROR: Encoding error: java.lang.IllegalStateException: releaseOutputBuffer() is valid only at Executing states; currently at Released state

IN[server] INFO: Retrying...
FO: 61 fps
INFO: 52 fps (+6 frames skipped)
INFO: 52 fps
INFO: 54 fps
INFO: 62 fps
INFO: 66 fps
INFO: 59 fps
ERROR: [FFmpeg] Could not find ref with POC 87
INFO: 47 fps
INFO: 23 fps (+2 frames skipped)
INFO: 90 fps (+17 frames skipped)
INFO: 62 fps
INFO: 105 fps (+4 frames skipped)
INFO: 158 fps (+10 frames skipped)
INFO: 77 fps (+67 frames skipped)
INFO: 77 fps (+93 frames skipped)
INFO: 166 fps (+4 frames skipped)
INFO: 140 fps (+4 frames skipped)
ERROR: [FFmpeg] Could not find ref with POC 562
INFO: 85 fps (+15 frames skipped)
INFO: 179 fps (+5 frames skipped)
INFO: 140 fps (+2 frames skipped)
INFO: 171 fps
INFO: 152 fps
INFO: 152 fps
INFO: 168 fps
INFO: 168 fps
INFO: 133 fps
INFO: 103 fps (+2 frames skipped)
INFO: 67 fps (+33 frames skipped)
INFO: 78 fps (+12 frames skipped)
INFO: 76 fps (+11 frames skipped)
INFO: 173 fps
INFO: 183 fps
INFO: 78 fps
INFO: 60 fps (+1 frames skipped)
INFO: 94 fps
INFO: 35 fps
INFO: 14 fps
INFO: 35 fps
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The report names only the scrcpy command lines and server/FFmpeg log output; start by reproducing the failure with the listed H.265 and default-encoder commands on the stated Windows, OnePlus, and Android setup. Compare the retry behavior and decoder errors, and consider the issue complete when the long-running mirror no longer reaches the reported stuck state or the failure has a verified diagnosis.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
audio-video-rtc, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.