-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
3.0 version of HLS generates a large number of TS slice files. #1506
Comments
Your configuration is set to not clean up HLS, so of course there will be a lot of TS files.
|
Your stream will generate a large number of small TS files, with a duration exceeding 100 seconds, which is also a problem.
|
The fourth one is abnormal.
If audio is disabled and only video is pushed, there is no problem.
So this is definitely related to audio. The audio packet is over 500 bytes, which doesn't seem like a normal AAC packet. SRS uses the size of AAC packets to calculate timestamps, which makes it more accurate and avoids the problem of inaccurate timestamps causing audio distortion. Reference: #547 (comment) If it is changed to pure audio HLS, it will be easier to troubleshoot.
Debugging the received data, the first one is the audio sequence header encoding header, and the second packet is audio data with 501 bytes.
The third audio packet is 48 milliseconds and has 522 bytes.
Generally, AAC has a sampling rate of 44100Hz, and one frame contains 1024 samples, so one frame is usually 23 milliseconds.
However, this stream is 48 milliseconds, so it should contain 2048 samples, which is larger than the usual. Due to the previous logic being fixed at 1024 samples or 960 samples to calculate the timestamp, it resulted in incorrect calculations.
After modifying the guess algorithm for the number of samples, the pure audio slicing is working correctly. Please refer to 31f341e for more information.
After the modification, there are still abnormalities when audio and video are together, and the slices are getting smaller and smaller.
Debugging to retrieve two audio packets.
The timestamp of the initial AAC packet was 48ms, but later it changed to 32ms, which caused incorrect calculation of the audio's DTS. It seems that estimating the timestamp based on the AAC sample size is not accurate. It would be more reasonable to calculate it directly based on the timestamp. A configuration option needs to be added for this. Please refer to: b4870a6.
Improvement measures:
|
When the video is not encoded in H.264, it will cause SRS to crash.
In fact, this is actually encoding the video as H.263, which causes the codec to be unable to parse it.
As a result, format->vcodec and format-video are both NULL, triggering an assert error.
Fixed in 52c6c7c
|
Description
Version 3.0 generates a large number of ts slice files in HLS. Version 2.6 does not have this issue.
1. Operating System: CentOS 7
Environment
Streaming command: C:\MinGW\msys\1.0\bin>ffmpeg.exe -re -i c:/1.mp4 -vcodec libx264 -acodec aac -f
flv rtmp://192.168.0.39:1935/live/b1
Logs: srs.log
Configuration file: srs.conf.txt
Video file (28mb): https://pan.baidu.com/s/1hPu46MmYOllJe1C0AXiM8g (Password: 5vdm)
Image:
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: