Closed tobbee closed 7 months ago
Tool mp2ts-info
lists information about TS files, e.g. pids, bitrates, service, etc. If option service
is set, it prints out service.
go run . -service ../../tests/testdata/obs_h265_aac.ts
Example Output:
{"pid":256,"codec":"HEVC","type":"video"}
{"pid":257,"codec":"AAC","type":"audio"}
{"SDT":[{"serviceId":1,"descriptors":[{"serviceName":"Service01","providerName":"FFmpeg"}]}]}
Tool mp2ts-pslister
lists parameter sets in TS files. If option ps
is set, it prints out detailed SPS/PPS information.
go run . -max 30 ../../tests/testdata/obs_h265_aac.ts
Example Output:
{"pid":256,"codec":"HEVC","type":"video"}
{"pid":257,"codec":"AAC","type":"audio"}
{"pid":256,"parameterSet":"VPS","nr":0,"hex":"40010c01ffff016000000300b00000030000030078170240","length":24}
{"pid":256,"parameterSet":"SPS","nr":0,"hex":"420101016000000300b00000030000030078a005020171f2e205ee45914bff2e7f13fa9a8080808040","length":41}
{"pid":256,"parameterSet":"PPS","nr":0,"hex":"4401c072f05324","length":7}
Tool mp2ts-nallister
generates a list of nalus with information about timestamps, rai, SEI etc. If option sei
is set, it prints out SEI information.
go run . -max 35 -sei ../../tests/testdata/obs_h265_aac.ts
Example Output:
{"pid":256,"codec":"HEVC","type":"video"}
{"pid":257,"codec":"AAC","type":"audio"}
{"pid":256,"rai":true,"pts":1920,"dts":1920,"nalus":[{"type":"AUD_35","len":3},{"type":"VPS_32","len":24},{"type":"SPS_33","len":41},{"type":"PPS_34","len":7},{"type":"SEI_39","len":31,"data":"SEI type 5, size=26, uuid=\"47564adc5c4c433f94efc5113cd143a8\", payload=\"\\x03\\xee\\x00\\x00\\xee\\x02\\x00\\x0fB@\""},{"type":"RAP_IDR_20","len":12860}]}
{"pid":256,"rai":false,"pts":4920,"dts":4920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":409}]}
{"pid":256,"rai":false,"pts":7920,"dts":7920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":332}]}
{"pid":256,"rai":false,"pts":10920,"dts":10920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":427}]}
{"pid":256,"rai":false,"pts":13920,"dts":13920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":4952}]}
{"pid":256,"rai":false,"pts":16920,"dts":16920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":791}]}
{"pid":256,"rai":false,"pts":19920,"dts":19920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":616}]}
{"pid":256,"rai":false,"pts":22920,"dts":22920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":2400}]}
{"pid":256,"rai":false,"pts":25920,"dts":25920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":733}]}
{"pid":256,"rai":false,"pts":28920,"dts":28920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":719}]}
{"pid":256,"rai":false,"pts":31920,"dts":31920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":5505}]}
{"pid":256,"rai":false,"pts":34920,"dts":34920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":751}]}
{"pid":256,"rai":false,"pts":37920,"dts":37920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":796}]}
{"pid":256,"rai":false,"pts":40920,"dts":40920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":1662}]}
{"pid":256,"rai":false,"pts":43920,"dts":43920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":349}]}
{"pid":256,"rai":false,"pts":46920,"dts":46920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":254}]}
{"pid":256,"rai":false,"pts":49920,"dts":49920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":792}]}
{"pid":256,"rai":false,"pts":52920,"dts":52920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":257}]}
{"pid":256,"rai":false,"pts":55920,"dts":55920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":172}]}
{"pid":256,"rai":false,"pts":58920,"dts":58920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":692}]}
{"pid":256,"rai":false,"pts":61920,"dts":61920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":342}]}
{"pid":256,"rai":false,"pts":64920,"dts":64920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":458}]}
{"pid":256,"rai":false,"pts":67920,"dts":67920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":905}]}
{"pid":256,"rai":false,"pts":70920,"dts":70920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":423}]}
{"pid":256,"rai":false,"pts":73920,"dts":73920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":229}]}
{"pid":256,"rai":false,"pts":76920,"dts":76920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":602}]}
{"pid":256,"rai":false,"pts":79920,"dts":79920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":291}]}
{"pid":256,"rai":false,"pts":82920,"dts":82920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":153}]}
{"pid":256,"rai":false,"pts":85920,"dts":85920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":471}]}
{"pid":256,"rai":false,"pts":88920,"dts":88920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":352}]}
{"pid":256,"rai":true,"pts":91920,"dts":91920,"nalus":[{"type":"AUD_35","len":3},{"type":"VPS_32","len":24},{"type":"SPS_33","len":41},{"type":"PPS_34","len":7},{"type":"RAP_IDR_20","len":24298}]}
{"pid":256,"rai":false,"pts":94920,"dts":94920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":402}]}
{"pid":256,"rai":false,"pts":97920,"dts":97920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":400}]}
{"pid":256,"rai":false,"pts":100920,"dts":100920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":293}]}
{"pid":256,"rai":false,"pts":103920,"dts":103920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":566}]}
{"streamType":"HEVC","pid":256,"frameRate":30,"RAIGoPDuration":1,"IDRGoPDuration":1}
Hi @tobbee, I just made it into three commands but there are few things to review:
type Options struct {
MaxNrPictures int
Version bool
Indent bool
ShowStreamInfo bool
ShowService bool
ShowPS bool
VerbosePSInfo bool
ShowNALU bool
ShowSEI bool
ShowStatistics bool
}
and mp2ts-pslister
and mp2ts-nallister
are essentially using the same parsing logic. For example, to parse NALU information, we call the same parsing function avc.ParseAll
with different options enabled.
func parseNALUInfo(ctx context.Context, w io.Writer, f io.Reader, o common.Options) error {
return avc.ParseAll(ctx, w, f, o)
}
In comparison, mp2ts-info
implements its own parsing logic. What is your opinion about this? Is it a bad idea to share the options/logic?
Split ts-info into three tools with name starting with "mp2ts-" similar to what is done in "mp4ff".
These are all analogous to tools in the mp4ff repo.