Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPS,SPS,PPS not fully accumulate #2

Open
marakew opened this issue Apr 5, 2024 · 5 comments
Open

VPS,SPS,PPS not fully accumulate #2

marakew opened this issue Apr 5, 2024 · 5 comments

Comments

@marakew
Copy link

marakew commented Apr 5, 2024

iam again

do you think VPS SPS PPS can be only once per PES ?
no
is can split per PES
as example i have AVC PES stream
AUD[2],SPS[23],PPS[4],PPS[95],PPS[5],SEI[8],I(1)Slice(7)[40793]

per AVC/HEVC Config Record
VPS can be 15 counts
SPS can be 31 counts
PPS can be 255 counts

so i think place where assign VPS,SPS,PPS should be impove or reimplement

m_vps.assign(nal, nal + len);
ParseVps(m_vps);

as example, this is wrong
it should accumulate ber counts, after counts overflow, should ParseXXX

yes, usefull info which used for produce mp4 can be at first VPS,SPS,PPS counts, but anyway
it can make incorrect
parameterChanged = true;

@xtne6f
Copy link
Owner

xtne6f commented Apr 11, 2024

As you say, especially for PPS, it should be accumulated each pic_parameter_set_id separately.
I don't know if there are any practical examples of using multiple VPS/SPS.

The problem is that Fragmented MP4 seems not to support multiple PPS.
I have looked into related stackoverflow, and there appears to be multiple (probably unofficial) ways to do it.

https://stackoverflow.com/questions/61190529/fragmented-mp4-video-with-multiple-sets-of-sps-and-pps-with-avcc-encoding
https://stackoverflow.com/questions/20682275/h264-with-multiple-pps-and-sps

@marakew
Copy link
Author

marakew commented Apr 11, 2024

hardware dvb encoder can produce this

as example terra

vps,sps,pps store at VisualSampleEntry of mp4 as ConfigurationRecord

just move check the same and analyze out of from ParseNals function

inside the function just accumulate

@xtne6f
Copy link
Owner

xtne6f commented Jun 8, 2024

Sorry for my long silence. I have just released master-240608 for other commits.

I want to fix about this issue, but currently I don't know how to generate or get a stream with multiple PPS.
If you have any information, please let me know (FFmpeg commands, sample URLs, etc..)

@marakew
Copy link
Author

marakew commented Jun 8, 2024 via email

xtne6f added a commit that referenced this issue Jul 1, 2024
Streams with multiple SPS/VPS are not supported (due to lack of actual samples).
Changing SPS/VPS/PPS in midstream is also not supported currently.
@xtne6f
Copy link
Owner

xtne6f commented Jul 13, 2024

I modified master to allow storing multiple PPS in VisualSampleEntry of hvcC/avcC.
Since there are no samples for VPS and SPS, I will leave them as is for now.

The sample attached to ffmpeg/ticket/6864 was MP1 audio, so I converted it to AAC using the following command:
ffmpeg -i Multiple.PPS.ts -c:v copy -c:a aac -f mpegts MultipleAAC.PPS.ts
Then I generated a fragmented MP4 using tsmemseg:
tsmemseg -4 - < MultipleAAC.PPS.ts > MultipleAAC_fmp4.PPS.mp4

VLC media player (3.0.19,Windows), Firefox (127.0.2,Windows), and Chrome (126.0,Android) were able to play the MP4.
I don't know why but Microsoft Edge (126.0,Windows) couldn't play it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants