Skip to content

fix: Compatible with flv video stream decoding without audio#253

Open
UmbraCi wants to merge 5 commits into
xqq:masterfrom
UmbraCi:fix/miss-audio-flv
Open

fix: Compatible with flv video stream decoding without audio#253
UmbraCi wants to merge 5 commits into
xqq:masterfrom
UmbraCi:fix/miss-audio-flv

Conversation

@UmbraCi
Copy link
Copy Markdown

@UmbraCi UmbraCi commented May 29, 2025

Summary

This PR improves playback availability for non-standard FLV inputs in two practical scenarios:

  1. No-audio (non-standard) FLV can still play normally

    • The fix avoids relying on FLV header audio flags alone.
    • It uses bounded body-level detection to confirm whether audio tags actually exist, then safely falls back to video-only when needed.
    • This prevents the player from waiting incorrectly for missing audio and improves real-world availability.
  2. Some non-standard dropped-frame videos no longer freeze playback

    • The fix improves tolerance for abnormal frame/slice parsing cases.
    • Instead of entering a freeze-prone path, playback can continue with robust fallback behavior.
    • This addresses player stuck issues observed on irregular FLV samples and improves availability.

Production Validation

These fixes have been used at high frequency in our internal video business for about one year. In production practice, they have shown strong usability and stability.

Given this validation, we sincerely hope this PR can be merged into the main branch and that a new npm version can be released.

Sandbox

@veovera
Copy link
Copy Markdown

veovera commented May 29, 2025

Great find! Curious, have you thought about using these flags to set hasAudio or hasVideo?

hasAudioTrack: hasAudio,
hasVideoTrack: hasVideo

@UmbraCi
Copy link
Copy Markdown
Author

UmbraCi commented May 29, 2025

Great find! Curious, have you thought about using these flags to set hasAudio or hasVideo?很棒的发现!好奇,你有没有想过用这些标志来设置 hasAudio 或 hasVideo?

hasAudioTrack: hasAudio,
hasVideoTrack: hasVideo

I don't see this configurable property in the api.doc file, and I haven't tried it. Have you encountered the same problem and solved it by using this property configuration?

@veovera
Copy link
Copy Markdown

veovera commented May 29, 2025

I have not tried it. That said probe() reads the flv header which basically states weather audio is present in the flv. Knowing that allows you to avoid waiting 3 seconds to see if audio is present?

See https://rtmp.veriskope.com/pdf/video_file_format_spec_v10_1.pdf#page=74

@UmbraCi
Copy link
Copy Markdown
Author

UmbraCi commented Apr 9, 2026

I have not tried it. That said probe() reads the flv header which basically states weather audio is present in the flv. Knowing that allows you to avoid waiting 3 seconds to see if audio is present?

See https://rtmp.veriskope.com/pdf/video_file_format_spec_v10_1.pdf#page=74

Partially correct. The FLV header’s TypeFlagsAudio only indicates that audio is expected, but it doesn’t guarantee actual audio data. To be certain, you still need to check for audio tags (TagType = 8) in the file body.

@UmbraCi
Copy link
Copy Markdown
Author

UmbraCi commented Apr 10, 2026

@xqq
The sandbox has been provided and is expected to be merged into the main branch and released. It has been verified in the high-frequency business for half a year
已经提供了sandbox,期望合并到主分支并且发版,已经在高频业务稳定验证了半年
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants