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

ffmpeg: adjust pts to avoid duplicate frames in mp4 format #148

Merged
merged 1 commit into from
Jun 17, 2021

Conversation

guojiansheng0925
Copy link

fixes #147
validated with mp4/mkv/webm.
Signed-off-by: Guo Jiansheng jiansheng.guo@intel.com

@tianjunwork
Copy link
Contributor

Thank you Jiansheng for your effort of fixing this issue! Nice job!
The fix is the same for 4 patch file, right? Could you briefly describe the root cause and your fix in the commit message or in this page as a documentation for maintenance?
I saw lots of new lines with a space is added to the patch file. Could you remove them? The reason is better readability and less conflict of applying the patch.

@tianjunwork
Copy link
Contributor

Hi @Zvictoria, I wonder if you could try out the fix early on while Jiansheng clean up some minor formatting.

Signed-off-by: Guo Jiansheng <jiansheng.guo@intel.com>
@guojiansheng0925
Copy link
Author

Hi @tianjunwork ,
The 4 patch files have the same fix and I have removed the spaces in newlines.
The root cause is 4 one-byte repeated frames in SVT-VP9 encoder.
We need write packtet more times and adjust the pts/dts.
The pts turning by 1 in mkv/webm while it should tuning by packet duration in mp4 when writing packet.
There is no duplicate or missing frmes when tuning pts by pactet duration but it delayed for a little time at the begining.
The delay is caused by incorrect ctts which is calculatd by pts minus dts in mp4 format.
SVT-VP9 encoder may return negative dts. The negative dts leads to a large ctts so we offset it to start at 0.
The dts start from 0 may be larger than pts, it's ok becase FFmepg can replace the invalid dts by the middle value in dts, pts, the last mux dts.

@tianjunwork
Copy link
Contributor

Thank you @guojiansheng0925 for updating the patch and explaining the root cause.

@Zvictoria
Copy link
Contributor

@tianjunwork, I've checked the patch on my side and could confirm the problem has gone. However the ISV reporting this problem initially has found some workaround\another fix for this problem and therefore is not ready to evaluate this fix in foreseeable future. To keep you posted on any further update from them... and I'd accept this fix for now. Thanks again!

@tianjunwork
Copy link
Contributor

Thank you @Zvictoria for keeping us posted. Thank you @guojiansheng0925 for your effort on the issue👍

@tianjunwork tianjunwork merged commit bd6dfde into OpenVisualCloud:master Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mp4 video container in svt-vp9 ffmpeg plugin bug
4 participants