mpegtsmux pmt-interval/pat-interval

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

mpegtsmux pmt-interval/pat-interval

gstahl
Hello,

I am attempting to build a gstreamer pipe that captures video, encodes it, puts it into a transport stream and then broadcasts over the network.  Using the below command I am able to start VLC listening on the port for the RTP stream, execute the pipeline and everything works perfectly.  However if I execute the pipeline and then start VLC listening the stream never comes through, monitoring the network traffic I see that either way there is data being sent from the machine that is executing the pipeline.  


gst-launch-1.0 ! x265enc ! mpegtsmux pat-interval=3000 pmt-interval=3000 ! rtpmp2tpay ! udpsink host=192.168.11.255 port=26000 auto-multicast=TRUE sync=true


While trying to debug the problem I executed the below pipelines and received the included output and it seems to indicate that the mpegtsmux is only sending the PMT and PAT at the very beginning of each stream and never again.  I have left this running for multiple minutes and receive only the first line of output within the first 100mS of execution of the pipeline.


gst-launch-1.0 --gst-debug=mpegtsmux:6 videotestsrc ! x265enc ! mpegtsmux pat-interval=3000 pmt-interval=3000 ! rtpmp2tpay ! udpsink host=192.168.11.255 port=26000 auto-multicast=TRUE sync=true 2>&1 | grep --ignore-case pmt
0:00:00.096035356  1856      0x27ad450 DEBUG              mpegtsmux tsmux.c:1222:tsmux_write_pmt: PMT for program 1 has 1 streams


gst-launch-1.0 --gst-debug=mpegtsmux:6 videotestsrc ! x265enc ! mpegtsmux pat-interval=3000 pmt-interval=3000 ! rtpmp2tpay ! udpsink host=192.168.11.255 port=26000 auto-multicast=TRUE sync=true 2>&1 | grep --ignore-case pat
0:00:00.070643306  1886      0x156a450 DEBUG              mpegtsmux tsmux.c:1156:tsmux_write_pat: PAT has 1 programs


Is there a known bug with mpegtsmux, or a problem with how I'm using it that is keeping it from sending the PMT and PAT periodically? (I have tried without specifying the pat-interval and pmt-interval properties on the command line with the same results)

Thanks!
Greg S

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

Re: mpegtsmux pmt-interval/pat-interval

Nicolas Dufresne-5
Le jeudi 12 octobre 2017 à 15:14 -0600, Greg Stahl a écrit :

> I am attempting to build a gstreamer pipe that captures video,
> encodes it, puts it into a transport stream and then broadcasts over
> the network.  Using the below command I am able to start VLC
> listening on the port for the RTP stream, execute the pipeline and
> everything works perfectly.  However if I execute the pipeline and
> then start VLC listening the stream never comes through, monitoring
> the network traffic I see that either way there is data being sent
> from the machine that is executing the pipeline.  
>
>
> gst-launch-1.0 ! x265enc ! mpegtsmux pat-interval=3000 pmt-
> interval=3000 ! rtpmp2tpay ! udpsink host=192.168.11.255 port=26000
> auto-multicast=TRUE sync=true

Isn't the issue because you have only 1 keyframe ? Have you try setting
key-int-max=(numb of frames) on x265enc ?

regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: mpegtsmux pmt-interval/pat-interval

gstahl
That option doesn't seem to exist according to gst-inspect (output copied below) but there is an "option-string" property though there doesn't seem to really be any documentation on it.


Factory Details:
  Rank                     primary (256)
  Long-name                x265enc
  Klass                    Codec/Encoder/Video
  Description              H265 Encoder
  Author                   Thijs Vermeir <[hidden email]>

Plugin Details:
  Name                     x265
  Description              x265-based H265 plugins
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstx265.so
  Version                  1.8.3
  License                  GPL
  Source module            gst-plugins-bad
  Source release date      2016-08-19
  Binary package           GStreamer Bad Plugins (Ubuntu)

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstVideoEncoder
                         +----GstX265Enc

Implemented Interfaces:
  GstPreset

Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: { I420, Y444, I420_10LE, Y444_10LE }
              framerate: [ 0/1, 2147483647/1 ]
                  width: [ 4, 2147483647 ]
                 height: [ 4, 2147483647 ]

  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h265
              framerate: [ 0/1, 2147483647/1 ]
                  width: [ 4, 2147483647 ]
                 height: [ 4, 2147483647 ]
          stream-format: byte-stream
              alignment: au
                profile: { main }


Element Flags:
  no flags set

Element Implementation:
  Has change_state() function: gst_video_encoder_change_state

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "x265enc0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  bitrate             : Bitrate in kbit/sec
                        flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
                        Unsigned Integer. Range: 1 - 102400 Default: 2048 
  qp                  : QP for P slices in (implied) CQP mode (-1 = disabled)
                        flags: readable, writable
                        Integer. Range: -1 - 51 Default: -1 
  option-string       : String of x264 options (overridden by element properties)
                        flags: readable, writable
                        String. Default: ""
  log-level           : x265 log level
                        flags: readable, writable
                        Enum "GstX265LogLevel" Default: -1, "none"
                           (-1): none             - No logging
                           (0): error            - Error
                           (1): warning          - Warning
                           (2): info             - Info
                           (3): debug            - Debug
                           (4): full             - Full
  speed-preset        : Preset name for speed/quality tradeoff options
                        flags: readable, writable
                        Enum "GstX265SpeedPreset" Default: 6, "medium"
                           (0): No preset        - No preset
                           (1): ultrafast        - ultrafast
                           (2): superfast        - superfast
                           (3): veryfast         - veryfast
                           (4): faster           - faster
                           (5): fast             - fast
                           (6): medium           - medium
                           (7): slow             - slow
                           (8): slower           - slower
                           (9): veryslow         - veryslow
                           (10): placebo          - placebo
  tune                : Preset name for tuning options
                        flags: readable, writable
                        Enum "GstX265Tune" Default: 2, "ssim"
                           (0): No tunning       - No tunning
                           (1): psnr             - psnr
                           (2): ssim             - ssim
                           (3): grain            - grain
                           (4): zerolatency      - zerolatency
                           (5): fastdecode       - fastdecode


Greg S

On Thu, Oct 12, 2017 at 6:08 PM, Nicolas Dufresne <[hidden email]> wrote:
Le jeudi 12 octobre 2017 à 15:14 -0600, Greg Stahl a écrit :
> I am attempting to build a gstreamer pipe that captures video,
> encodes it, puts it into a transport stream and then broadcasts over
> the network.  Using the below command I am able to start VLC
> listening on the port for the RTP stream, execute the pipeline and
> everything works perfectly.  However if I execute the pipeline and
> then start VLC listening the stream never comes through, monitoring
> the network traffic I see that either way there is data being sent
> from the machine that is executing the pipeline.
>
>
> gst-launch-1.0 ! x265enc ! mpegtsmux pat-interval=3000 pmt-
> interval=3000 ! rtpmp2tpay ! udpsink host=192.168.11.255 port=26000
> auto-multicast=TRUE sync=true

Isn't the issue because you have only 1 keyframe ? Have you try setting
key-int-max=(numb of frames) on x265enc ?

regards,
Nicolas
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: mpegtsmux pmt-interval/pat-interval

gstahl
It looks like the option-string property is parsed using the "gst_x265_enc_parse_options" function on line 578 in "gstx265enc.c" (https://github.com/GStreamer/gst-plugins-bad/blob/master/ext/x265/gstx265enc.c) Then the "x265_param_parse" function is called, but I can't find any definition of this anywhere in the entire gst-plugins-bad repository.


Greg S

On Fri, Oct 13, 2017 at 8:55 AM, Greg Stahl <[hidden email]> wrote:
That option doesn't seem to exist according to gst-inspect (output copied below) but there is an "option-string" property though there doesn't seem to really be any documentation on it.


Factory Details:
  Rank                     primary (256)
  Long-name                x265enc
  Klass                    Codec/Encoder/Video
  Description              H265 Encoder
  Author                   Thijs Vermeir <[hidden email]>

Plugin Details:
  Name                     x265
  Description              x265-based H265 plugins
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstx265.so
  Version                  1.8.3
  License                  GPL
  Source module            gst-plugins-bad
  Source release date      2016-08-19
  Binary package           GStreamer Bad Plugins (Ubuntu)

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstVideoEncoder
                         +----GstX265Enc

Implemented Interfaces:
  GstPreset

Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: { I420, Y444, I420_10LE, Y444_10LE }
              framerate: [ 0/1, <a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647/1 ]
                  width: [ 4, <a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647 ]
                 height: [ 4, <a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647 ]

  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h265
              framerate: [ 0/1, <a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647/1 ]
                  width: [ 4, <a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647 ]
                 height: [ 4, <a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647 ]
          stream-format: byte-stream
              alignment: au
                profile: { main }


Element Flags:
  no flags set

Element Implementation:
  Has change_state() function: gst_video_encoder_change_state

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "x265enc0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  bitrate             : Bitrate in kbit/sec
                        flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
                        Unsigned Integer. Range: 1 - 102400 Default: 2048 
  qp                  : QP for P slices in (implied) CQP mode (-1 = disabled)
                        flags: readable, writable
                        Integer. Range: -1 - 51 Default: -1 
  option-string       : String of x264 options (overridden by element properties)
                        flags: readable, writable
                        String. Default: ""
  log-level           : x265 log level
                        flags: readable, writable
                        Enum "GstX265LogLevel" Default: -1, "none"
                           (-1): none             - No logging
                           (0): error            - Error
                           (1): warning          - Warning
                           (2): info             - Info
                           (3): debug            - Debug
                           (4): full             - Full
  speed-preset        : Preset name for speed/quality tradeoff options
                        flags: readable, writable
                        Enum "GstX265SpeedPreset" Default: 6, "medium"
                           (0): No preset        - No preset
                           (1): ultrafast        - ultrafast
                           (2): superfast        - superfast
                           (3): veryfast         - veryfast
                           (4): faster           - faster
                           (5): fast             - fast
                           (6): medium           - medium
                           (7): slow             - slow
                           (8): slower           - slower
                           (9): veryslow         - veryslow
                           (10): placebo          - placebo
  tune                : Preset name for tuning options
                        flags: readable, writable
                        Enum "GstX265Tune" Default: 2, "ssim"
                           (0): No tunning       - No tunning
                           (1): psnr             - psnr
                           (2): ssim             - ssim
                           (3): grain            - grain
                           (4): zerolatency      - zerolatency
                           (5): fastdecode       - fastdecode


Greg S

On Thu, Oct 12, 2017 at 6:08 PM, Nicolas Dufresne <[hidden email]> wrote:
Le jeudi 12 octobre 2017 à 15:14 -0600, Greg Stahl a écrit :
> I am attempting to build a gstreamer pipe that captures video,
> encodes it, puts it into a transport stream and then broadcasts over
> the network.  Using the below command I am able to start VLC
> listening on the port for the RTP stream, execute the pipeline and
> everything works perfectly.  However if I execute the pipeline and
> then start VLC listening the stream never comes through, monitoring
> the network traffic I see that either way there is data being sent
> from the machine that is executing the pipeline.
>
>
> gst-launch-1.0 ! x265enc ! mpegtsmux pat-interval=3000 pmt-
> interval=3000 ! rtpmp2tpay ! udpsink host=192.168.11.255 port=26000
> auto-multicast=TRUE sync=true

Isn't the issue because you have only 1 keyframe ? Have you try setting
key-int-max=(numb of frames) on x265enc ?

regards,
Nicolas
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: mpegtsmux pmt-interval/pat-interval

Nicolas Dufresne-5
Le vendredi 13 octobre 2017 à 09:13 -0600, Greg Stahl a écrit :
> It looks like the option-string property is parsed using the
> "gst_x265_enc_parse_options" function on line 578 in "gstx265enc.c" (
> https://github.com/GStreamer/gst-plugins-bad/blob/master/ext/x265/gst
> x265enc.c) Then the "x265_param_parse" function is called, but I
> can't find any definition of this anywhere in the entire gst-plugins-
> bad repository.

Sorry, I was assuming all properties from x264 has been added into the
x265 element. Best is to patch x265enc to support the same properties
as x264enc. For your interest, x265enc is base on x264enc which is
found in gst-plugins-ugly repository.

For the option string, you should be able to handle anything, but we
don't document this as it's a X265 feature. This property is intented
to be used by people that knows how the x265 command line option string
works.

regards,
Nicolas
_______________________________________________
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: mpegtsmux pmt-interval/pat-interval

gstahl
Ok, so switching to the x264enc module fixes the problem, even without using the "key-int-max" parameter, though setting the parameter to a low value does enable VLC to pick up the stream quicker than the default.  

Interestingly though the mpegtsmux is still only sending the PMT and PAT once according to log output even with the properties set to 3000:

gst-launch-1.0 --gst-debug=x264enc:6,mpegtsmux:9 videotestsrc ! x264enc ! mpegtsmux pat-interval=3000 pmt-interval=3000 ! rtpmp2tpay ! udpsink host=192.168.11.255 port=26000 auto-multicast=TRUE sync=true 2>&1 | grep --ignore-case pmt
0:00:00.059882508 32056      0x1c44850 DEBUG              mpegtsmux tsmux.c:1222:tsmux_write_pmt: PMT for program 1 has 1 streams

Greg S

On Fri, Oct 13, 2017 at 1:38 PM, Nicolas Dufresne <[hidden email]> wrote:
Le vendredi 13 octobre 2017 à 09:13 -0600, Greg Stahl a écrit :
> It looks like the option-string property is parsed using the
> "gst_x265_enc_parse_options" function on line 578 in "gstx265enc.c" (
> https://github.com/GStreamer/gst-plugins-bad/blob/master/ext/x265/gst
> x265enc.c) Then the "x265_param_parse" function is called, but I
> can't find any definition of this anywhere in the entire gst-plugins-
> bad repository.

Sorry, I was assuming all properties from x264 has been added into the
x265 element. Best is to patch x265enc to support the same properties
as x264enc. For your interest, x265enc is base on x264enc which is
found in gst-plugins-ugly repository.

For the option string, you should be able to handle anything, but we
don't document this as it's a X265 feature. This property is intented
to be used by people that knows how the x265 command line option string
works.

regards,
Nicolas
_______________________________________________
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