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

Audio ignored when the TS video file doesn't start with TS_SYNC_BYTE #53

Closed
gilbsgilbs opened this issue Oct 13, 2019 · 2 comments · Fixed by #55
Closed

Audio ignored when the TS video file doesn't start with TS_SYNC_BYTE #53

gilbsgilbs opened this issue Oct 13, 2019 · 2 comments · Fixed by #55

Comments

@gilbsgilbs
Copy link
Contributor

I noticed that the audio is completely dropped when the video file doesn't start with a TS packet immediately. After debugging a bit, it appears that the download_hls function expects to find a TS_SYNC_BYTE at the very beginning of the file which is not always the case on my streams: some of them have a FFMpeg header for instance.

Unfortunately, I can't share my m3u8 file publicly since I don't own the content of the stream and it's supposed to be behind a paywall, but here is the beginning of the video file:

0000000 7e 8d 1d 64 e0 e0 a2 37 1d 8f 17 da e6 d9 83 72
0000020 00 01 fc 80 14 48 12 01 06 46 46 6d 70 65 67 09
0000040 53 65 72 76 69 63 65 30 31 77 7c 43 ca ff ff ff
0000060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0000260 ff ff ff ff ff ff ff ff ff ff ff ff 47 40 00 16
                                            ^ First TS packet here
0000300 00 00 b0 0d 00 01 c1 00 00 00 01 f0 00 2a b1 04
0000320 b2 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0000340 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0000560 ff ff ff ff ff ff ff ff 47 50 00 16 00 02 b0 12
                                ^ the next here
0000600 00 01 c1 00 00 e1 00 f0 00 1b e1 00 f0 00 15 bd
0000620 4d 56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0000640 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0001060 ff ff ff ff 47 41 00 3d 07 50 00 08 b8 6c 7e 00
                    ^ and so on
0001100 00 00 01 e0 00 00 80 c0 0a 31 00 4b 06 21 11 00

A fix could be to start parsing the file as soon as a couple of TS_SYNC_BYTE are encountered. Let me know what you think.

@selsta
Copy link
Owner

selsta commented Oct 14, 2019

Thanks for reporting this. Would it be possible that you PR a fix for this issue? :)

@gilbsgilbs
Copy link
Contributor Author

I actually have a dirty fix running locally. I'll try to improve it a bit before submitting a PR.

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

Successfully merging a pull request may close this issue.

2 participants