Problems building WebRTC native code for Android with ffmpeg H264 Software Video Decoder

1,430 views
Skip to first unread message

baayal_dev

unread,
Mar 21, 2019, 8:38:26 AM3/21/19
to discuss-webrtc
Now i know that the H264 ffmpeg Decoder is not officially supported on the Android platform but still i am trying to get it working so bear with me please.

I am working with the example AppRTC Application and i have already created the necessary JNI API for creating the
ffmpeg decoder from the Java code. I have also set the necessary flags for compiling and including the ffmpeg library.
Flags i have set:

-target_os="android"
-target_cpu="arm"
-rtc_use_h264=true
-ffmpeg_branding="Chrome"
-use_openh264=true
-proprietary_codecs=true


I have also modified the ffmpeg_generated.ini to include the same source files as the linux configuration.

But when finally running the application and connecting to a client it tries to create the decoder but fails 
with this error: 
E/h264_decoder_impl.cc: (line 198): FFmpeg H.264 decoder not found.

I know the error basically means that the library was not build/included correctly but I dont know what else i can do so if someone has an Idea that could help me that would be great.

李晓帆

unread,
Mar 21, 2019, 11:12:18 AM3/21/19
to discuss...@googlegroups.com
Hi,

1.enable openh264 by set 'rtc_use_h264 = true ffmpeg_branding = "Chrome" '
2.after this you need modify  third_party/ffmpeg/chromium/config/Chrome/android/arm-neon/libavcodec/parser_list.c and third_party/ffmpeg//chromium/config/Chrome/android/arm-neon/libavcodec/codec_list.c files, add h264 parse, like:

--- a/chromium/config/Chrome/android/arm-neon/libavcodec/parser_list.c
+++ b/chromium/config/Chrome/android/arm-neon/libavcodec/parser_list.c
@@ -4,4 +4,5 @@ static const AVCodecParser * const parser_list[] = {
     &ff_mpegaudio_parser,
     &ff_opus_parser,
     &ff_vorbis_parser,
+    &ff_h264_parser,
     NULL };

--- a/chromium/config/Chrome/android/arm-neon/libavcodec/codec_list.c
+++ b/chromium/config/Chrome/android/arm-neon/libavcodec/codec_list.c
@@ -13,4 +13,5 @@ static const AVCodec * const codec_list[] = {
     &ff_pcm_s32le_decoder,
     &ff_pcm_u8_decoder,
     &ff_libopus_decoder,
+    &ff_h264_decoder,
     NULL };

Your error was caused by step 2, if I am correct ^_^

baayal_dev <frok...@gmail.com> 于2019年3月21日周四 下午8:38写道:
--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/e2110af4-a152-40ee-a5c1-85a40feba98a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

baayal_dev

unread,
Mar 22, 2019, 4:58:18 AM3/22/19
to discuss-webrtc
wow thank you ! It works now. have a great day :)

Xu Yu

unread,
Apr 11, 2019, 8:43:23 AM4/11/19
to discuss-webrtc
Hi, baayal_dev, I met the same problem, could you please tell me how to implement sw decode H.264 through Java?
I create peerconnection but there is no H264 description in local sdp. Thank u very much~


在 2019年3月21日星期四 UTC+8下午8:38:26,baayal_dev写道:

hieu...@tamdongtam.vn

unread,
Apr 11, 2019, 10:57:38 AM4/11/19
to discuss-webrtc
Sorry for my post, becaus I report issue on github but no one care, 
Anyone who deploy apprtc successfully?
I have an Issue that android app cannot connect to my server but chrome is OK, here is log:
https://github.com/webrtc/apprtc/issues/619

I understand some of deploy step, any question with me, welcome!

Piasy Xu

unread,
Apr 11, 2019, 8:18:41 PM4/11/19
to discuss-webrtc
Maybe you can try this: https://github.com/Piasy/WebRTC-Docker

在 2019年4月11日星期四 UTC+8下午10:57:38,hieu...@tamdongtam.vn写道:

Hieu than hieu

unread,
Apr 12, 2019, 1:07:22 AM4/12/19
to discuss...@googlegroups.com

Thank you, I will try this.

 

Sent from Mail for Windows 10

--


---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Xu Yu

unread,
Apr 12, 2019, 1:07:26 AM4/12/19
to discuss-webrtc
Hi, baayal_dev, I met same problem with you, could you please tell me how to implement sw decode H.264 through Java ?
I create peerconnection but there is no H264 description in local sdp. Thank u very much~

在 2019年3月21日星期四 UTC+8下午8:38:26,baayal_dev写道:
Now i know that the H264 ffmpeg Decoder is not officially supported on the Android platform but still i am trying to get it working so bear with me please.

Rohit N

unread,
Dec 18, 2019, 10:13:04 AM12/18/19
to discuss-webrtc
That was highly specific answer to a highly specific question! Thanks a lot! Saved me a lot of hours!  
To unsubscribe from this group and stop receiving emails from it, send an email to discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages