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

--sub-source results in Error: Failed to write subtitle stream # frame: Invalid argument. #109

Closed
bavdevc opened this issue Jan 22, 2023 · 7 comments

Comments

@bavdevc
Copy link

bavdevc commented Jan 22, 2023

Hello @rigaya

I tried adding an external PGS subtitle to the encoding process using the --sub-source option but it will always result to the following error message and the qsvenc aborts:

[matroska @ 00000182603214c0] Application provided invalid, non monotonically increasing dts to muxer in stream 3: 119800 >= 119797
avout: Error: Failed to write subtitle stream 3 frame: Invalid argument.

workaround: remux the input mkv file and the subtitle with MKVToolNix/mkvmerge into a new mkv file, then qsvenc runs without any error and the resulting file is correct incl. the subtitle and all the other specified options for that subtitle stream

@rigaya
Copy link
Owner

rigaya commented Jan 23, 2023

Thank you for letting me know the issue.

I've found out that it is required to insert "pgs_frame_merge" bitstream filter to avoid this error.

However, currently the bitstream filter is not included in the ffmpeg dlls, therefore I need to update ffmpeg and rebuild the dlls. Unfortunately, it might take time, as when updating the dlls, I need to test much more compared to ordinary updates.

@bavdevc
Copy link
Author

bavdevc commented Jan 23, 2023

no problem, workaround is fine for me - take all the time you need and tell me if you need help with testing something - atm. I'm creating a lot of CI/CD test cases for Intel GPU driver / ffmpeg / qsvenc and some automation scripts

rigaya added a commit that referenced this issue Jan 28, 2023
pgs_frame_merge bsfを適用することで解消するため、これを自動適用するようにする。ただし、これにはlibavcodec.dllの更新が必要。
@rigaya
Copy link
Owner

rigaya commented Jan 30, 2023

Thanks. The fix for this issue is now in the code but currently disabled, I'll update ffmpeg dlls once I've gone through tests to make sure the app works fine with the new dlls.

@rigaya
Copy link
Owner

rigaya commented Feb 5, 2023

QSVEnc 7.30 updates ffmpeg libs and now PGS subtitles file can be muxed in with --sub-source.

Thanks again for reporting this issue.

@bavdevc
Copy link
Author

bavdevc commented Feb 8, 2023

Hello rigaya,

I have good news and bad news after testing the 7.30 release.

good news:
--sub-source now works without any error that breaks qsvenc

bad news:
all subtitles, using --sub-copy or --sub-source turn out empty / 0 bytes in the resulting file when using 7.30 - working fine in 7.29 for --sub-copy

btw. there is a little typo in the https://github.com/rigaya/QSVEnc/blob/master/QSVEncC_Options.en.md#--sub-source-stringintparam1value1 for --sub-source example section:

Example2: --sub-source "<sub_file>":disposition=default;metadata=language=jpn
should be
Example2: --sub-source "<sub_file>:disposition=default;metadata=language=jpn"

otherwise you get a command line error

same goes for https://github.com/rigaya/QSVEnc/blob/master/QSVEncC_Options.en.md#--master-display-string-or-copy-hevc-av1

Example1: --master-display G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)
should be
Example1: --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)"

@rigaya
Copy link
Owner

rigaya commented Feb 9, 2023

Thank you, I made another fix with QSVEnc 7.33 fixing the problem with the subtitle.

@bavdevc
Copy link
Author

bavdevc commented Feb 9, 2023

re-test with 7.33 successful --sub-source now works without any error and the output is correct

fabulous work!!! Thank you very much

@bavdevc bavdevc closed this as completed Feb 9, 2023
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