Encode video using ffmpeg and vp8 codec

198 views
Skip to first unread message

Victor Canezin de Oliveira

unread,
Oct 27, 2015, 11:58:09 AM10/27/15
to Native-Client-Discuss
Hello,

I`m trying to develop a video encoder using Native Client.
I want the output file to be .webm I`m using ffmpeg example muxing.c.

When I run the example I get the error message: Could not find encoder for 'vp8'
When I put the output file to be .mp4 it works.

Can someone help me. Do I need to enable vp8 encoder for ffmpeg port?
What should I do?

Thanks!!

Sam Clegg

unread,
Oct 27, 2015, 1:21:03 PM10/27/15
to native-cli...@googlegroups.com
Take a look at the configure argument to ffmpeg (see
ports/ffmpeg/build.sh) and also the packages that it depends on (see
ports/ffmpeg/pkg_info). Most likely you will want to add a dependency
on libwebp and add am --enable-xxx flag. You might also need to
update the libwebp port (I think vp9 is part of libwebp but you should
verify this).


>
> Thanks!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Native-Client-Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to native-client-di...@googlegroups.com.
> To post to this group, send email to native-cli...@googlegroups.com.
> Visit this group at http://groups.google.com/group/native-client-discuss.
> For more options, visit https://groups.google.com/d/optout.

Victor Canezin de Oliveira

unread,
Oct 27, 2015, 5:29:30 PM10/27/15
to Native-Client-Discuss
Thanks, Sam!

It worked for me. I just added the dependency for libvpx on both build.sh and pkg_info and built it again.

Now I can encode using VP8, but It`s a lot slower than using h256.
Do you know if there are some tweaks I can do to make is faster. I need to encode a live stream in 1920x1080.

thanks!

Sam Clegg

unread,
Oct 27, 2015, 7:55:20 PM10/27/15
to native-cli...@googlegroups.com
I also just took a look at added libvpx
(https://codereview.chromium.org/1409393006/). For my port I disabled
all asm and used the C implementation. I imagine that porting the asm
paths to NaCl would be the biggest win. Is the VP8 encode under NaCl
much slower than a non-NaCl desktop build? It could be that VP8 is
not a sensible choice for realtime encoding (I'm not a codec expert).

cheers,

>
> thanks!

Victor Canezin de Oliveira

unread,
Oct 28, 2015, 8:37:36 AM10/28/15
to Native-Client-Discuss
And what is the difference between ffmpeg VP8 encoding and video_encode.cc VP8 encoding from Native Client examples? The last is way faster.

But the thing is that I need to encode audio as well, so the example doesn't work for me

Ben Smith

unread,
Oct 28, 2015, 3:38:15 PM10/28/15
to Native-Client-Discuss
On Wednesday, October 28, 2015 at 5:37:36 AM UTC-7, Victor Canezin de Oliveira wrote:
And what is the difference between ffmpeg VP8 encoding and video_encode.cc VP8 encoding from Native Client examples? The last is way faster.

video_encode.cc uses Chrome's vp8 encoder rather than the NaCl one, so it can use assembly optimizations. NaCl allows assembly as well, but it must be rewritten to conform to the validator. Also, NaCl does incur an overhead, so you may be seeing that.
 

But the thing is that I need to encode audio as well, so the example doesn't work for me

Maybe you can encode the audio stream with ffmpeg and the video stream using PPAPI. 

holla....@gmail.com

unread,
Nov 5, 2015, 2:20:48 AM11/5/15
to Native-Client-Discuss
Hi Victor/Sam,

Did you need to add libwebp as a dependency for this to work?

I tried the same and I get naclports: Package not found: libvpx.

I added --enable-libvpx to ./configure in build.sh  and 

DEPENDS=(lame libvorbis libtheora glibc-compat libwebp libvpx)  in pkg_info and still get the same error.

did you have to do something else in addition to the above to get it to work?

Also I am curious to know how you got H265 working?!? Have you tried H264?

Thank you very much in advance.
It will be of great help.

Thanks.

Sam Clegg

unread,
Nov 5, 2015, 10:39:39 AM11/5/15
to native-cli...@googlegroups.com
On Wed, Nov 4, 2015 at 11:20 PM, <holla....@gmail.com> wrote:
> Hi Victor/Sam,
>
> Did you need to add libwebp as a dependency for this to work?
>
> I tried the same and I get naclports: Package not found: libvpx.
>
> I added --enable-libvpx to ./configure in build.sh and
>
> DEPENDS=(lame libvorbis libtheora glibc-compat libwebp libvpx) in pkg_info
> and still get the same error.
>
> did you have to do something else in addition to the above to get it to
> work?

libvpx was recently added to naclports:
https://codereview.chromium.org/1409393006

It should be enough to sync to the latest version. No local changes
should be needed.

>
> Also I am curious to know how you got H265 working?!? Have you tried H264?
>
> Thank you very much in advance.
> It will be of great help.
>
> Thanks.
>
> On Tuesday, October 27, 2015 at 2:29:30 PM UTC-7, Victor Canezin de Oliveira
> wrote:
>>
>> Thanks, Sam!
>>
>> It worked for me. I just added the dependency for libvpx on both build.sh
>> and pkg_info and built it again.
>>
>> Now I can encode using VP8, but It`s a lot slower than using h256.
>> Do you know if there are some tweaks I can do to make is faster. I need to
>> encode a live stream in 1920x1080.
>>
>> thanks!
>

Akshay Holla

unread,
Nov 5, 2015, 1:37:37 PM11/5/15
to native-cli...@googlegroups.com
Thank you Sam. You are a life saver. Saw the commit that was done very recently.

You received this message because you are subscribed to a topic in the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/native-client-discuss/PqLifMcDXEA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to native-client-di...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages