Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stream in h265 using gstreamer?

I am trying to use latest gstreamer and x265enc together. I saw that someone have already posted some commits in http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/log/ext/x265/gstx265enc.c Can anyone please give an example pipeline where it is known to working (gst-launch-1.0 pipeline example will be very helpful)

1) What is the current status of x265enc plugin for gstreamer ? does it work really ? Which branch of gstreamer I need to use to build x265enc? I want to build whole gsteamer source code which will be compatible with x265enc plugin. What are the system requirement for x265enc and how to build it ? Any wiki/basic instructions will be very helpful.

My goal is to broadcast my ip cameras (h264 streams) as h265 stream on vaughnlive.tv

Currently, I am using following pipeline to broadcast in h264 format:

GST_DEBUG=2 gst-launch-1.0 flvmux name=mux streamable=true ! rtmpsink sync=true location="rtmp://xxxxxxxxxxxx" rtspsrc location="rtsp://xxxxxxx" caps="application/x-rtp, media=(string)audio, clock-rate=(int)90000, encoding-name=(string)MPA, payload=(int)96" ! rtpmpadepay ! mpegaudioparse ! queue ! mad ! audioconvert ! queue ! voaacenc bitrate=128000 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw ! mux. rtspsrc location="rtsp://xxxxxxx" caps="application/x-rtp,media=(string)video,clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! video/x-h264,stream-format=avc,alignment=au,byte-stream=false ! queue ! decodebin ! queue ! videorate ! "video/x-raw,framerate=30/1" ! queue ! x264enc threads=4 speed-preset=ultrafast bitrate=3072 ! mux.

2) Can anyone please suggest on how should I change this pipeline to broadcast in h265 format using x265enc element?

like image 373
tapas .. Avatar asked Oct 19 '22 02:10

tapas ..


1 Answers

A little late but, maybe some people will find this question when seeking info about H.265 support in gstreamer nowadays. This is with gstreamer 1.6.1 compiled from source on Ubuntu 15.10 which has packages ready for libx265..

1,

Encoder There is x265enc which will be enabled when we have library libx265-dev. The encoder is inside gst-plugins-bad so after doing autogen.sh you should see x265enc enabled.

You may also need h265parse, rtph265pay/depay

Decoder

I see two decoders, dont know which one is working, I guess libde265dec there is also avdec_h265.

mux

For mux for x264 I was using mpegtsmux, but this does not support video/x265, some work has to be done. The matroskamux should be working when using filesink etc..

[16:39]  hi, which container is suitable for x265enc, for x264enc I was using mpegtsmux?
[16:54]  otopolsky: mpegts would work if you add support for h265 there, not very difficult[16:55]  slomo_: so we need to just add the caps compatibility?
[16:55]  otopolsky: otherwise, matroskamux supports it. mp4mux/qtmux could get support for it relatively easily too
[16:55]  otopolsky: a bit more than that. look at what tsdemux does for h265
[16:56]  otopolsky: and check the gst_mpegts_descriptor_from_registration related code in tsmux
[17:00]  slomo_: thanks 

2,

Questioned flvmux also does not support h265 only h264.. matroskamux cannot be used for streaming, so only way is to patch mpegtsmux or flvmux etc.

like image 119
nayana Avatar answered Oct 21 '22 22:10

nayana