gstreamermp4mpegmpeg2-ts

Gstreamer pipeline to convert MPEG-4 video to MPEG-TS format


I am trying to write gstreamer pipeline to convert mpeg4 video to mpegts format.

I tried below pipeline but no luck

$ gst-launch-1.0 -e filesrc location=20200818125158_00001.ts.mp4 ! qtdemux name=mdemux ! \
h264parse ! video/x-h264,stream-format=byte-stream ! mpegtsmux name=mux ! filesink location=20200818125158_00001.ts

I get below error when I execute above pipeline

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstQTDemux:mdemux: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstQTDemux:mdemux:
failed delayed linking some pad of GstQTDemux named mdem

My Input format

gst-discoverer-1.0 vid.mp4 
Analyzing file:///vid.mp4
Done discovering file:///vid.mp4

Topology:
  container: Quicktime
    video: MPEG-4 Video (Simple Profile)

Properties:
  Duration: 0:00:07.267000000
  Seekable: yes
  Live: no
  Tags: 
      video codec: MPEG-4 video
      maximum bitrate: 8400000
      bitrate: 298925
      encoder: Lavf57.83.100
      container format: ISO MP4/M4A

My target format

Topology:
  container: MPEG-2 Transport Stream
    video: H.264 (High Profile)

Properties:
  Duration: 0:00:09.900164000
  Seekable: yes
  Live: no
  Tags: 
      video codec: H.264

Solution

  • After spending multiple hours and reading more about gstreamer I figured out correct pipeline. Below pipeline works for me

    gst-launch-1.0 filesrc location=vid.mp4 ! qtdemux ! avdec_mpeg4 ! X264enc ! mpegtsmux  ! filesink location=vid.ts