Eyevinn / mp2ts-tools

Tools for MPEG-2 TS
MIT License
14 stars 0 forks source link

Add HEVC support #2

Closed tobbee closed 8 months ago

tobbee commented 8 months ago

Add support to show information about HEVC including parameter sets and NALUs.

The codec should be auto-detected and there should be tests for the output using new files.

Wkkkkk commented 8 months ago

A testing ts file (HEVC+AAC) was created with OBS studio. And it is parsed into:

{"pid":256,"codec":"HEVC","type":"video"}
{"pid":257,"codec":"AAC","type":"audio"}
{"pid":256,"parameterSet":"SPS","nr":0,"hex":"420101016000000300b00000030000030078a005020171f2e205ee45914bff2e7f13fa9a8080808040","length":41}
{"pid":256,"parameterSet":"PPS","nr":0,"hex":"4401c072f05324","length":7}
{"pid":256,"rai":true,"pts":1920,"nalus":[{"type":"SEI_39","len":31,"data":"SEI type 5, size=26, uuid=\"47564adc5c4c433f94efc5113cd143a8\", payload=\"\\x03\\xee\\x00\\x00\\xee\\x02\\x00\\x0fB@\""}]}
{"pid":256,"parameterSet":"SPS","nr":0,"hex":"420101016000000300b00000030000030078a005020171f2e205ee45914bff2e7f13fa9a8080808040","length":41}
{"pid":256,"parameterSet":"PPS","nr":0,"hex":"4401c072f05324","length":7}
{"pid":256,"rai":true,"pts":91920,"nalus":null}
{"SDT":[{"serviceId":1,"descriptors":[{"serviceName":"Service01","providerName":"FFmpeg"}]}]}

Somehow the nalus part seems to be incomplete.

Wkkkkk commented 8 months ago

Will try to add tests and compare with the results from AVC.

tobbee commented 8 months ago

Yes, there is probably some issue with parsing the nalus properly. You can use the same splitter as for AVC, but the headers are longer (2bytes). The first NALU in each images should be a AUD (35) (needed in TS, not in mp4).

Your should be able to transform into mp4 and see what mp4ff-nallister says about the nalus.

ffmpeg -i file.ts -c copy file.mp4 should work for that conversion.