Skip to content

[Bug] Subsequent video recordings are corrupted (only the last few seconds are playable) #2059

Description

@TroyTheGod

Describe the bug
When using the library to record multiple times, the first recorded video is perfectly fine. However, any subsequent video recordings (the second, third, etc.) are corrupted.

Even if the subsequent recording lasts for a while, the resulting MP4 file acts as if it's extremely short, and only the last few seconds of the footage can be played back.

This happens regardless of the recording duration, and regardless of how long I wait between stopping the previous recording and starting the next one. This issue can be consistently reproduced in the official Example App.

To Reproduce
Steps to reproduce the behavior:

  1. Open the RootEncoder Example App.
  2. Start a video recording on RotationActivity (recording duration doesn't matter).
  3. Stop the recording.
  4. Wait for any amount of time (does not need to be immediate).
  5. Start a second recording.
  6. Stop the second recording.
  7. Attempt to play the second MP4 file. You will notice it is corrupted (e.g., if you recorded for 30 seconds, the file might only play the last 3-5 seconds).

Expected behavior
Every recording session should produce a normal, fully playable MP4 file from start to finish, exactly like the first recording.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Library version 2.7.1
  • Device: should be all devices
  • OS: 16
  • Media server
  • Class used RtmpStream

Additional context
I am opening a new issue as I am not entirely sure if this is a duplicate of or directly related to #1880 and #1882.

However, I did some bisecting and can confirm the following:

  • Working commit: ab2efc52bc584493fdcad5d37475732c8da4a241 (The issue does NOT happen here).
  • Broken commit: 1a0dfaa6ab531fc6ac438ae5d12828ead04b2cba (The issue is consistently reproducible here).

This indicates it is likely a regression introduced between these commits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions