Webcodecs: VideoEncoder format:{avc:avc}

902 views
Skip to first unread message

amythical

unread,
Aug 2, 2023, 3:03:28 AM8/2/23
to medi...@chromium.org
Hi,
    Very excited about webcodecs and using them to encode and decode videos in the browser.

Goal - Generate VideoFrames from a HTML Canvas Element, encode chunks using the VideoEncoder with format{avc:avc} and mux the chunks into a h264/mp4.

I have recently hit a roadblock and there are no demos, documentation is vague around the avc formats output in the Video Encoder.

The chunks that I get from the VideoEncoder when format:{avc:avc} is used, cannot be muxed into a h264, throws up an error. 
My source is a set of VideoFrames generated from a html canvas.

I did some reading and I understand that some extra data needs to be appended to each chunk for decoding.
I assumed this would be generated by the encoder and I printed the meta along with the chunk but the description is empty but there is other meta data inside the decoderConfig (colors, width, height, hardware-preference and so on)

PS - The annexb chunks work fine , but the quality is very bad with pixelation.

Any help or pointers would be appreciated.

Thanks,
Amit Deshpande



Dale Curtis

unread,
Aug 4, 2023, 12:22:51 PM8/4/23
to amythical, medi...@chromium.org
avc vs annexb just changes the bitstream layout, it won't affect quality. annexb is correct for writing into a '.h264' file as understood by ffmpeg. You likely need to try some different encoding settings particularly bitrate and bitrateMode to improve quality.

- dale

--
You received this message because you are subscribed to the Google Groups "media-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to media-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/media-dev/CAFeJyjBqNvRu92vcSqbhJHd_6L4ywmmTGshm7Z-zRUMoHYZR9Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages