Skip to content

[Feat]: MPEG-TS MediaEncoder packet const value 7 #245

@bkekelic2

Description

@bkekelic2

Version

3.0.0.-RC3

Environment that reproduces the issue

Samsung s25 ultra

Use case description

Hi,
I'm wondering if there is an option to have MPEG-TS MediaEncoder packet const value of 7.

From what I can observe on Wireshark, the packet size (SRT payload) is not constant, yet it varies between 1316 Bytes (7 packets) and lower values (lower num of packets: 3,4,5,6).
I'm not using variable bitrate option.

Often we can observe packets arriving like:

  • 1316 (7 packets)
  • 1316 (7 packets)
  • 1316 (7 packets)
  • 1128 (6 packets) or sometimes even less: 3, 4, 5.

Our use case requires constant bitrate (constant packet number = 7).
https://en.wikipedia.org/wiki/MPEG_transport_stream#Null_packets

What we can do is to enforce the SRT URL used against SRT server side on connection opening to have the parameters
payload_size=1316 and mss=1316
pkt_size is just an alias for payload size.

Testing with enforced payload_size and mss values does not change anything in the stream packeting during our local tests,
as these values just define the max size and do not limit sending smaller chunks.

Proposed solution

In order to achieve this, null packets could be introduced to fill missing packets. Check link above.

I checked MediaCodecEncoder and IEncoder but I don't see such mechanism/options exposed.

Found place to insert null packets in encoder, but yeah, maybe that's not it, check this.

Maybe this is not even option for encoder yet muxer?
Found this muxer for TS

Or, is there already a solution for this available?
Could some other constant bitrate option affect this?

Alternative solutions

I've tried streaming locally with ffmpeg and it produces const TS size 7.
Maybe diff is that I stream from cam and this test streams from file.
Tried with, and without pkt_size and it is the same, always const.
Command: ffmpeg -re -i input.mp4 -c copy -f mpegts "srt://192.168.1.69:9000?pkt_size=1316&mode=caller"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions