Need help with common understanding of using libvpx

243 views
Skip to first unread message

Eugene Iceman

unread,
Jan 3, 2018, 5:48:58 AM1/3/18
to WebM Discussion
Hello!
My application streams a video from webcam and/or screen to server. The server sould write streams to disk and share on request a url of the video for the browser.
I had some experience with libx264, but the Chomium browsers does not support h264 codec, so I need to stream vp9 and write down webm on server's hdd.
I've build libvpx using mingw-w64 toolchain and got a libvpx.a file and nine includes - vp8.h, vp8cx.h, vp8dx.h, vpx_codec.h, vpx_decoder.h, vpx_encoder.h, vpx_frame_buffer.h, vpx_image.h, vpx_integer.h.
The libvpx is more complicated for me after x264 - I can't understand what data should I send to server, and how to write it to webm wideo on server side.
Of course I saw an examples that comes with libvpx sources, but there are to many *.c and *.h files which not included directly to library, so I'm not shure what to do with all of that... and no streaming examples at all.
If to drop all examples not related to build result, how to use the rest - lib file and nine includes? What can it do, what data will I receive on output?
During build I saw logs like "enable webm_io" - does it mean that the build contains all instuments to create webm video?

For example, with x264 I can write NAL units to file right after encoding and MediaPlayerClassic will play it. The same experiment with data.frame.buf of vpx_codec_cx_pkt_t fails - the file had some size but it was not playable. What resulting data should I use after calling vpx_codec_encode
and how to process it if nessesary?
And what a recommended parameters for vp9 streaming to process encoding as fast as possible with average quality?

Sorry for lot of questions, but I'm really confused with all this vpx stuff. Could you clarify it a bit for me (no code needed, just the order of actions)?
Thanks

James Zern

unread,
Jan 8, 2018, 4:39:04 PM1/8/18
to WebM Discussion
Hi,

On Wed, Jan 3, 2018 at 2:48 AM, Eugene Iceman <eugene...@gmail.com> wrote:
> Hello!
> My application streams a video from webcam and/or screen to server. The
> server sould write streams to disk and share on request a url of the video
> for the browser.
> I had some experience with libx264, but the Chomium browsers does not
> support h264 codec, so I need to stream vp9 and write down webm on server's
> hdd.
> I've build libvpx using mingw-w64 toolchain and got a libvpx.a file and nine
> includes - vp8.h, vp8cx.h, vp8dx.h, vpx_codec.h, vpx_decoder.h,
> vpx_encoder.h, vpx_frame_buffer.h, vpx_image.h, vpx_integer.h.
> The libvpx is more complicated for me after x264 - I can't understand what
> data should I send to server, and how to write it to webm wideo on server
> side.
> Of course I saw an examples that comes with libvpx sources, but there are to
> many *.c and *.h files which not included directly to library, so I'm not
> shure what to do with all of that... and no streaming examples at all.
> If to drop all examples not related to build result, how to use the rest -
> lib file and nine includes? What can it do, what data will I receive on
> output?

Start with vpxenc.c or examples/simple_encoder.c to get an idea of the
encode process. The main encode calls are vpx_codec_encode() [1] and
vpx_codec_get_cx_data() [2]. libvpx returns full frames which can then
be written to the webm file as simple blocks.

> During build I saw logs like "enable webm_io" - does it mean that the build
> contains all instuments to create webm video?
>

That's correct, libvpx relies on libwebm to write webm files.

> For example, with x264 I can write NAL units to file right after encoding
> and MediaPlayerClassic will play it. The same experiment with data.frame.buf
> of vpx_codec_cx_pkt_t fails - the file had some size but it was not
> playable. What resulting data should I use after calling vpx_codec_encode
> and how to process it if nessesary?
> And what a recommended parameters for vp9 streaming to process encoding as
> fast as possible with average quality?
>
> Sorry for lot of questions, but I'm really confused with all this vpx stuff.
> Could you clarify it a bit for me (no code needed, just the order of
> actions)?
> Thanks
>

[1] https://chromium.googlesource.com/webm/libvpx/+/v1.6.1/vpxenc.c#1552
[2] https://chromium.googlesource.com/webm/libvpx/+/v1.6.1/vpxenc.c#1651
Reply all
Reply to author
Forward
0 new messages