-
-
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
The problem is that the MP4 files recorded by the DVR cannot be played on Safari browser, but they can be played on Google Chrome browser when hosted on an nginx server. #1105
Comments
Can the mp4 file provide a sample?
|
I added an attachment in the email and sent it. Can you receive it?
|
The link is invalid
|
FireFox browser abc.mp4 also cannot play. I will check it tomorrow.
|
Thanks in advance, bro.
|
Sorry, I have been busy these past few days and haven't had time to carefully read your question. However, while investigating the issue of some flv files not playing, I found a similar situation. I should have some clues. I will reply to you later.
|
This may be related to audio encoding. Check whether your audio encoding is MAIN-AAC or LC-AAC. Some players do not support MAIN-AAC.
|
It seems there is a bug with the MP4. A friend said they submitted a PR, but it seems I haven't seen it.
|
How to configure this to save as mp4? Every time I save it, it becomes flv instead.
|
Hello, how do I record mp4 files? I have set the .MP4 extension, but it still generates flv files???
|
Brother, regarding the issue of MP4 recording that can only be played on Google, can you give me some suggestions?
|
Record two MP4 files using SRS and FFMPEG, refer to the attachments below: Can be viewed using VLC, FFMPEG, and Chrome: Can be wrapped with H5:
FFMPEGYou can see that Chrome actually initiates multiple Range requests, the first one:
The second Range request initiated by Chrome is as follows:
The third request initiated by Chrome is as follows:
When playing, Chrome initiated another request:
Below is Safari's request: The MP4 generated by FFMPEG can be played on various browsers. SRSFor files generated by SRS, VLC and Chrome can play them, Safari cannot open them, and Firefox only plays audio without video. Comparing the descriptions of the two files using FFMPEG, there are no significant differences. It appears that the encoding is not a problem.
Additionally, in the Finder on Mac, the thumbnail of srs.mp4 cannot be seen. Using the tool provided by SRS, srs_mp4_parser, let's check the format of the two files.
From the above differences, try modifying to see which ones are crucial.
|
free boxffmpeg will write a free box in front of mdat because mdat is continuously being written, so its length is only known when the writing is finished. At that point, it is necessary to go back to the header of mdat to update the size, which may be longer, so a free box is reserved. This should not affect playback, and after adding it, there is no impact on Safari, Firefox, or macFinder. avc1 boxavc1' is SrsMp4VisualSampleEntry, which holds the codec information. It mainly includes two parts:
After modifying the width and height, Firefox is able to play the video, and macOS Finder shows the thumbnail. However, Safari still does not work. After changing the "refs" to 1, Safari also started working correctly. tkhd boxtkhd" is the track description header, mainly including:
Similar to the width and height of avc1, it is not necessary, but it would be better to change them together if possible. Mininum modificationThe minimum modification should be the size information of avc1 and tkhd, as well as the refs of avc1. After testing, it was found that refs are necessary. Without them, Safari cannot play, while Chrome and Firefox work fine. After testing, it was found that size is also necessary. Without it, Safari cannot play, while Chrome and Firefox work fine. From this perspective, it seems that Firefox only requires refs or size. Safari requires both refs and size. VLC and Chrome do not require either. Modified box diagram:
|
The video recorded using DVR is saved with the file name extension as mp4. To play this mp4 file, place it in the nginx directory and open the file in a browser for on-demand playback. It can be opened in Google Chrome and Android phones, but cannot be played in Firefox and Safari browsers. To enable playback in Safari, you can repackage the video using the command "ffmpeg -i abc.mp4 -codec copy test.mp4".
How can the recorded video be played in Safari without re-packaging?
Below is the DVR configuration:
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: