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

"TS packet did not start with 0x47" on AES-128 HLS (with AAC sound) #3772

Closed
chthomos opened this issue Apr 14, 2021 · 5 comments · Fixed by #3782
Closed

"TS packet did not start with 0x47" on AES-128 HLS (with AAC sound) #3772

chthomos opened this issue Apr 14, 2021 · 5 comments · Fixed by #3782
Labels
Bug Regression A bug introduced in a recent release
Milestone

Comments

@chthomos
Copy link

chthomos commented Apr 14, 2021

hls.js playback fails with "fragParsingError" "TS packet did not start with 0x47" in id:"audio" stream for AES-128 encrypted file

For testing, I have downloaded a sample MP4 file https://www.appsloveworld.com/download-sample-mp4-video-mp4-test-videos/ and generated an m3u8 as follows:

  • Split audio and video using ffmpeg
    (ffmpeg -y -i %INPUT_FILE% -c:v copy -an -f mp4 -movflags faststart+frag_every_frame+empty_moov+default_base_moof %TEMP_FOLDER%\video.mp4) and (-vn -c:a copy %TEMP_FOLDER%\audio.m4a)
  • Fragment using bento4 (both audio and video)
    mp4fragment --fragment-duration %FRAGMENT_DURATION% %TEMP_FOLDER%\audio.m4a %TEMP_FOLDER%\audio_f.m4a
  • Encrypt and package to hls
    mp4hls --hls-version 4 --output-dir=%HLS_FOLDER% --force --encryption-key=7cc723769be333bc4703df267e2833c4 --output-encryption-key --encryption-mode=AES-128 %TEMP_FOLDER%\audio_f.m4a %TEMP_FOLDER%\video_f.mp4

When I try the file via hls.js the file does not play. The player error handler returns the following:
type: "mediaError", details: "fragParsingError", fatal: false, reason: "TS packet did not start with 0x47"

I tried the same mp4hls without encryption and it works fine, so it should not be a codec issue.
Same if I omit the audio_f.m4a source from the m3u8, the video only m3u8 works fine

You can download and try to replicate from here

Tested on Chrome latest, Firefox latest (Win 10 )

Any ideas on how fix this would be greatly appreciated.

@robwalch
Copy link
Collaborator

Hi @chthomos,

You'll need to provide us a hosted test stream. I will not download from dropbox. Thank you.

@chthomos
Copy link
Author

Hello @robwalch ,

I have uploaded the test stream here: https://rivubox.com/hlstest/master.m3u8 ,

Tested it via https://hls-js-dev.netlify.app/demo/ and the problem is shown in the log.

@robwalch robwalch added this to the 1.0.2 milestone Apr 15, 2021
@robwalch robwalch added Bug Regression A bug introduced in a recent release labels Apr 15, 2021
@robwalch robwalch added this to Top priorities in Release Planning and Backlog via automation Apr 15, 2021
robwalch pushed a commit that referenced this issue Apr 15, 2021
@robwalch
Copy link
Collaborator

robwalch commented Apr 15, 2021

Thanks @chthomos,

I'll have a PR up shortly. I also want to include the test stream in our demo/test suite. I hope that's OK.

It would make a good replacement for the ABR AES-128 stream we currently have if only it had multiple variants.

@chthomos
Copy link
Author

@robwalch Sure thing, I will keep the stream there for your tests to run.

@robwalch
Copy link
Collaborator

I will keep the stream there for your tests to run.

I copied it to our stream archive so no need. Thank you for putting it up so that I could verify the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Regression A bug introduced in a recent release
Projects
Release Planning and Backlog
  
Top priorities
Development

Successfully merging a pull request may close this issue.

2 participants