Hardware accelerated H.264 encoding and streaming on Android

Stefan Persson johli392 at student.liu.se
Mon May 13 20:04:03 UTC 2019


Hi,

I have the following pipeline running on Android to stream real-time video
from the phone's webcam to a server also running GStreamer:
  ahcsrc ! video/x-raw, width=640, height=480 !
  tee name=t t. ! videoconvert ! autovideosink sync=true name=sink ! t. !
  x264enc speed-preset=ultrafast tune=zerolatency ! rtph264pay
config-interval=1 pt=96 !
  udpsink host=192.168.1.3 port=34455

For testing I'm also using a recorded video (30 fps):
  filesrc location=input.mp4 ! decodebin ! videoscale !
video/x-raw,height=480,width=640 !
  tee name=t...

This works far from perfect. Often the phone struggles with the stream
encoding (or perhaps transmission) and I want to achieve at least "okayish"
framerates, decent latency and no choppiness for these low-resolution
streams.

I've tried replacing x264enc with the accelerated codec
"amcvidenc-omxgoogleh264encoder ! video/x-h264", but none of the caps I
tried with videoconvert seem to work. I only got:
gst_amc_video_dec_set_format:<amcvideodec-omxqcomvideodecoderavc0> Codec
only supports GL output but downstream does not
gst_video_decoder_setcaps:<amcvideodec-omxqcomvideodecoderavc0> Subclass
refused caps
(Tested on an LG G6 with Qualcomm chips)
 
I've also tried to get it to work with encodebin, as from what I've
understood it uses hardware acceleration where available, but I struggle
with figuring out how the encoding profile
(https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/GstEncodingProfile.html)
should look for realtime ("zero-latency") H.264 encoding.

Does anyone have any hints how I can move forward with this problem?
Thanks for reading and sorry for taking up your valuable time.

Best Regards
Stefan



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list