Creating MPEG-TS output with MPEG audio

Following composition will create MPEG-2 video and MPEG Layer 2 audio in MPEG Transport Stream container, with following properties:

  • 23.976 framerate
  • progressive field order
  • 1920 x 1080 image size
  • 300000 bits/s bitrate
  • square pixels aspect ratio
  • GOP: IBBPBBPBBPBBPBB (M = 2, N = 15)
  • Closed GOP set to false (determines if B and P frames can reference frames located outside their GOP)

Audio stream in this case will be MPEG Layer 2 audio 44.1 kHz and 128 kbit/s bitrate.

{
    "input": {
        "container": [
            {
                "properties": {
                    "Timebase": "zero"
                },
                "settings": {
                    "kind": "media"
                },
                "name": "input-container",
                "audio": [
                    {
                        "name": "Audio Stream 1",
                        "select": {
                            "track": 1
                        }
                    }
                ],
                "subtitle": [],
                "video": [
                    {
                        "name": "Video Stream 1",
                        "select": {
                            "track": 1
                        }
                    }
                ]
            }
        ],
        "reference": "input-container"
    },
    "output": {
        "container": [
            {
                "type": "m2ts",
                "name": "TS-output",
                "path": "output.mpg",
                "audio": [
                    {
                        "name": "Audio Output 1",
                        "properties": {
                            "Format": "mpga"
                        },
                        "sample_rate": {
                            "denominator": 1,
                            "numerator": 44100
                        },
                        "encode": {
                            "properties": {
                                "BitRate": 128000,
                                "Layer": 2,
                                "Version": 2
                            }
                        },
                        "route": {
                            "name": "Audio Stream 1"
                        }
                    }
                ],
                "subtitle": [],
                "video": [
                    {
                        "name": "Video Output 1",
                        "properties": {
                            "Format": "mpg2"
                        },
                        "sample_rate": {
                            "denominator": 1001,
                            "numerator": 24000
                        },
                        "height": 1080,
                        "pixel_aspect_ratio": {
                            "denominator": 1,
                            "numerator": 1
                        },
                        "width": 1920,
                        "encode": {
                            "properties": {
                                "BitRate": 300000,
                                "Chroma": "422",
                                "ClosedGOP": false,
                                "FieldOrder": "progressive",
                                "Level": "high",
                                "Profile": "main",
                                "M": 2,
                                "N": 15,
                                "StartWithIFrame": true
                            }
                        },
                        "route": {
                            "name": "Video Stream 1"
                        }
                    }
                ]
            }
        ]
    }
}