Hardware accelerated H.264 encoding and streaming on Android

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Hardware accelerated H.264 encoding and streaming on Android

Stefan Persson
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/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Hardware accelerated H.264 encoding and streaming on Android

maestro157340
Hi,

I have a similar problem, my pipeline is:
"ahcsrc name=ahc device=0 !
video/x-raw,width=(int)640,height=(int)480,format=(string)NV21 ! queue !
videoconvert ! x264enc ! rtph264pay ! udpsink host=192.168.0.120 port=4567"

The pipeline delivers about 0.5 frames per second. I assume, that there is a
problem with the encoding or with the ahcsrc element directly.

Did you fix your problem yet?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Hardware accelerated H.264 encoding and streaming on Android

Nicolas Dufresne-5
Le jeudi 27 juin 2019 à 14:04 -0500, maestro157340 a écrit :
> Hi,
>
> I have a similar problem, my pipeline is:
> "ahcsrc name=ahc device=0 !
> video/x-raw,width=(int)640,height=(int)480,format=(string)NV21 ! queue !
> videoconvert ! x264enc ! rtph264pay ! udpsink host=192.168.0.120 port=4567"
>
> The pipeline delivers about 0.5 frames per second. I assume, that there is a
> problem with the encoding or with the ahcsrc element directly.

For software encoding, you will need a much lower complexity setting on
x264enc. You could try with tune=zerolatency to start with, and
configure a decent bitrate.

Though on hanghelf, I strongly suggest to use HW accelerator. These can
be abstracted by using encodebin.

>
> Did you fix your problem yet?
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Hardware accelerated H.264 encoding and streaming on Android

Jesse
In reply to this post by Stefan Persson
Hi,did you fixed the problem? I have a similar problem,I use plugins
"x264enc",but it failed with log "priv_gst_parse_yyparse no element
"x264enc", so I changed to use encodebin, but I don't know how to
set the encode pfofile, could you give me some clues?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel