Skip to content

[js/lite] VideoEncoder fails on Linux without H.264 hardware encoding - needs software fallback #852

@mondain

Description

@mondain

Problem

The hang webapp's video encoder fails on Linux systems without hardware H.264 encoding support. The encoder tries High Profile (avc1.640028) first and fails with "Encoder creation error" instead of falling back to a software-compatible configuration.

Environment

  • Linux (Ubuntu)
  • Chrome with WebCodecs
  • No hardware H.264 encoder available

Expected Behavior

The encoder should fall back to H.264 Baseline Profile with conservative settings that work with software encoding, similar to how the moxygen encoder does:

{                                                                                                                                                                                                                      
    codec: 'avc1.42001e',  // Baseline Profile, Level 3.0                                                                                                                                                              
    width: 320,                                                                                                                                                                                                        
    height: 180,                                                                                                                                                                                                       
    bitrate: 1_000_000,                                                                                                                                                                                                
    latencyMode: 'realtime'                                                                                                                                                                                            
}                                                                                                                                                                                                                      
                                                                                                                                                                                                                       
Actual Behavior                                                                                                                                                                                                        
                                                                                                                                                                                                                       
The encoder tries these codecs in order and fails completely:                                                                                                                                                          
- avc1.640028 (High Profile, Level 4.0)                                                                                                                                                                                
- avc1.4D401F (Main Profile, Level 3.1)                                                                                                                                                                                
- avc1.42E01E (Baseline Profile, Level 3.0)                                                                                                                                                                            
                                                                                                                                                                                                                       
Error: Encoder creation error                                                                                                                                                                                          
                                                                                                                                                                                                                       
Workaround                                                                                                                                                                                                             
                                                                                                                                                                                                                       
Patching the bundled JS to use avc1.42001e instead allows encoding to work.                                                                                                                                            
                                                                                                                                                                                                                       
Suggestion                                                                                                                                                                                                             
                                                                                                                                                                                                                       
Add fallback logic that:                                                                                                                                                                                               
1. Uses VideoEncoder.isConfigSupported() to test each codec/resolution combination                                                                                                                                     
2. Falls back to simpler Baseline Profile configs when hardware encoding unavailable                                                                                                                                   
3. Reduces resolution if needed for software encoding performance          

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions