w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.

Home Page:https://w3c.github.io/webcodecs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't use AVC video codecs on mp4 1920x1080 resolution

a-adly opened this issue · comments

I'm trying to apply AVC codec level 4 for encoding mp4 videos with size 1920x1080

videoEncoder.configure({
      codec: "avc1.640028", // or "avc1.64001E"
      width: 1920,
      height: 1080,
});

but always receive this error

Failed to execute 'encode' on 'VideoEncoder': Cannot call 'encode' on a closed codec.

Is there another avc codec supported or different settings to be able to encode big size video

If this is an issue in Chrome please file a bug at https://crbug.com/new with the details from chrome://gpu -- this succeeds on Chrome desktop for me. If it's Safari you can file an issue at https://bugs.webkit.org/

OK thanks @dalecurtis, yes in chrome://gpu report it says

Graphics Feature Status
Canvas: Hardware accelerated
Canvas out-of-process rasterization: Disabled
Direct Rendering Display Compositor: Disabled
Compositing: Hardware accelerated
Multiple Raster Threads: Enabled
OpenGL: Enabled
Rasterization: Unavailable
Raw Draw: Disabled
Video Decode: Hardware accelerated
Video Encode: Unavailable
Vulkan: Disabled
WebGL: Hardware accelerated
WebGL2: Unavailable
WebGPU: Hardware accelerated

but encoding works good for smaller size videos 1280x720

I'll try on different device with recent version of Chrome or fill a bug as you suggested

Works fine on my machine. Please file a bug against Chromium with more details.

You'll want to look at the "Video Acceleration Information" section of chrome://gpu to see what the supported resolutions are. If this is Android, resolution supported if very limited.

You can try different bitrates and resolutions here. FWIW, I'm not seeing any errors when encoding 1920 x 1080 resolution with codec string "avc1.640028".

Tried on a different machine & codec "avc1.640028" worked good

I've tried to encode mp4 videos on this example here taken from a source muxer library repo

You'll want to look at the "Video Acceleration Information" section of chrome://gpu to see what the supported resolutions are. If this is Android, resolution supported if very limited.

yes it was showing empty info on encoding part

You can try different bitrates and resolutions here. FWIW, I'm not seeing any errors when encoding 1920 x 1080 resolution with codec string "avc1.640028".

"avc1.640028" was giving same error on my 1st PC:

DOMException: Encoder initialization error.
Uncaught DOMException: Failed to execute 'encode' on 'VideoEncoder': Cannot call 'encode' on a closed codec.
    at encodeVideoFrame

but worked good on a different machine.

Also codec "avc1.42002A" seems working good on all machines

Thank you all, the issue was coming from the 1st machine I've tried on