mpegtsmux
mpegtsmux muxes different streams into an MPEG Transport stream
SI sections can be specified through a custom event:
#include <gst/gst.h>
#include <gst/mpegts/mpegts.h>
#define PIPELINE_STR "videotestsrc num-buffers=100 ! x264enc ! queue ! mpegtsmux name=mux ! fakesink"
static void
_on_bus_message (GstBus * bus, GstMessage * message, GMainLoop * mainloop)
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
case GST_MESSAGE_EOS:
g_main_loop_quit (mainloop);
break;
default:
break;
}
}
static void
advertise_service (GstElement * mux)
{
GstMpegtsSDTService *service;
GstMpegtsSDT *sdt;
GstMpegtsDescriptor *desc;
GstMpegtsSection *section;
sdt = gst_mpegts_sdt_new ();
sdt->actual_ts = TRUE;
sdt->transport_stream_id = 42;
service = gst_mpegts_sdt_service_new ();
service->service_id = 42;
service->running_status =
GST_MPEGTS_RUNNING_STATUS_RUNNING + service->service_id;
service->EIT_schedule_flag = FALSE;
service->EIT_present_following_flag = FALSE;
service->free_CA_mode = FALSE;
desc = gst_mpegts_descriptor_from_dvb_service
(GST_DVB_SERVICE_DIGITAL_TELEVISION, "some-service", NULL);
g_ptr_array_add (service->descriptors, desc);
g_ptr_array_add (sdt->services, service);
section = gst_mpegts_section_from_sdt (sdt);
gst_mpegts_section_send_event (section, mux);
gst_mpegts_section_unref (section);
}
int
main (int argc, char **argv)
{
GstElement *pipeline = NULL;
GError *error = NULL;
GstBus *bus;
GMainLoop *mainloop;
GstElement *mux;
gst_init (&argc, &argv);
pipeline = gst_parse_launch (PIPELINE_STR, &error);
if (error) {
g_print ("pipeline could not be constructed: %s\n", error->message);
g_clear_error (&error);
return 1;
}
mainloop = g_main_loop_new (NULL, FALSE);
mux = gst_bin_get_by_name (GST_BIN (pipeline), "mux");
advertise_service (mux);
gst_object_unref (mux);
/* Put a bus handler */
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_signal_watch (bus);
g_signal_connect (bus, "message", (GCallback) _on_bus_message, mainloop);
/* Start pipeline */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_main_loop_run (mainloop);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
gst_object_unref (bus);
return 0;
}
Hierarchy
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstElement ╰──GstAggregator ╰──GstBaseTsMux ╰──mpegtsmux
Factory details
Authors: – Fluendo
Classification: – Codec/Muxer
Rank – primary
Plugin – gstmpegtsmux
Package – GStreamer Bad Plug-ins
Pad Templates
sink_%d
video/mpeg:
parsed: true
mpegversion: { (int)1, (int)2, (int)4 }
systemstream: false
video/x-dirac:
image/x-jpc:
video/x-h264:
stream-format: byte-stream
alignment: { (string)au, (string)nal }
video/x-h265:
stream-format: byte-stream
alignment: { (string)au, (string)nal }
audio/mpeg:
parsed: true
mpegversion: { (int)1, (int)2 }
audio/mpeg:
framed: true
mpegversion: 4
stream-format: adts
audio/mpeg:
mpegversion: 4
stream-format: raw
audio/x-lpcm:
width: { (int)16, (int)20, (int)24 }
rate: { (int)48000, (int)96000 }
channels: [ 1, 8 ]
dynamic_range: [ 0, 255 ]
emphasis: { (boolean)false, (boolean)true }
mute: { (boolean)false, (boolean)true }
audio/x-ac3:
framed: true
audio/x-dts:
framed: true
audio/x-opus:
channels: [ 1, 8 ]
channel-mapping-family: { (int)0, (int)1 }
subpicture/x-dvb:
application/x-teletext:
meta/x-klv:
parsed: true
image/x-jpc:
profile: [ 0, 49151 ]
src
video/mpegts:
systemstream: true
packetsize: { (int)188, (int)192 }
Properties
alignment
“alignment” gint
Number of packets per buffer (padded with dummy packets on EOS) (-1 = auto, 0 = all available packets, 7 for UDP streaming)
Flags : Read / Write
Default value : -1
bitrate
“bitrate” guint64
Set the target bitrate, will insert null packets as padding to achieve multiplex-wide constant bitrate (0 means no padding)
Flags : Read / Write
Default value : 0
latency
“latency” guint64
Additional latency in live mode to allow upstream to take longer to produce buffers for the current position (in nanoseconds)
Flags : Read / Write
Default value : 0
m2ts-mode
“m2ts-mode” gboolean
Set to TRUE to output Blu-Ray disc format with 192 byte packets. FALSE for standard TS format with 188 byte packets.
Flags : Read / Write
Default value : false
min-upstream-latency
“min-upstream-latency” guint64
When sources with a higher latency are expected to be plugged in dynamically after the aggregator has started playing, this allows overriding the minimum latency reported by the initial source(s). This is only taken into account when larger than the actually reported minimum latency. (nanoseconds)
Flags : Read / Write
Default value : 0
pat-interval
“pat-interval” guint
Set the interval (in ticks of the 90kHz clock) for writing out the PAT table
Flags : Read / Write
Default value : 9000
pcr-interval
“pcr-interval” guint
Set the interval (in ticks of the 90kHz clock) for writing PCR
Flags : Read / Write
Default value : 3600
pmt-interval
“pmt-interval” guint
Set the interval (in ticks of the 90kHz clock) for writing out the PMT table
Flags : Read / Write
Default value : 9000
prog-map
“prog-map” GstStructure *
A GstStructure specifies the mapping from elementary streams to programs
Flags : Read / Write
scte-35-null-interval
“scte-35-null-interval” guint
Set the interval (in ticks of the 90kHz clock) for writing SCTE-35 NULL (heartbeat) packets. (only valid if scte-35-pid is different from 0)
Flags : Read / Write
Default value : 27000000
scte-35-pid
“scte-35-pid” guint
PID to use for inserting SCTE-35 packets (0: unused)
Flags : Read / Write
Default value : 0
si-interval
“si-interval” guint
Set the interval (in ticks of the 90kHz clock) for writing out the ServiceInformation tables
Flags : Read / Write
Default value : 9000
start-time
“start-time” guint64
Start time to use if start-time-selection=set
Flags : Read / Write
Default value : 18446744073709551615
start-time-selection
“start-time-selection” GstAggregatorStartTimeSelection *
Decides which start time is output
Flags : Read / Write
Default value : zero (0)
GstBaseTsMuxPad
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstPad ╰──GstAggregatorPad ╰──GstBaseTsMuxPad
Signals
buffer-consumed
buffer_consumed_callback (GstElement * param_0, GstBuffer * arg0, gpointer udata)
def buffer_consumed_callback (param_0, arg0, udata):
#python callback for the 'buffer-consumed' signal
function buffer_consumed_callback(param_0: GstElement * param_0, arg0: GstBuffer * arg0, udata: gpointer udata): {
// javascript callback for the 'buffer-consumed' signal
}
Parameters:
param_0
–
arg0
–
udata
–
Flags: Run First
Properties
emit-signals
“emit-signals” gboolean
Send signals to signal data consumption
Flags : Read / Write
Default value : false
The results of the search are