ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
https://antmedia.io
Other
4.27k stars 628 forks source link

The playlist freezes and .ts files are missing for uploaded VODs. #4468

Closed Mohit-3196 closed 7 months ago

Mohit-3196 commented 2 years ago

Short description

When creating a playlist from the uploaded VODs and playing as HLS, the playback freezes intermittently and also some .ts files are missing in the directory. This is happening for certain files.

Environment

Steps to reproduce

  1. Create a playlist with attached MP4 files.

https://user-images.githubusercontent.com/86982446/195672039-b1c4532d-11fe-48d7-a159-3c507d351448.mp4

https://user-images.githubusercontent.com/86982446/195672051-9af0b594-c510-4b59-8272-54d5d9d7fa08.mp4

  1. Open the properties file of the application /usr/local/antmedia/webapps/{YOUR_APP}/WEB-INF/red5-web.properties and add below properties: settings.hlsflags=delete_segments+append_list+omit_endlist settings.deleteHLSFilesOnEnded=false Save the settings and restart the server sudo service antmedia restart

  2. Start the playlist and play the .m3u8 file

Expected behavior

The hls playback should be fine and the transitions between files should be smooth.

Actual behavior

The transition is not smooth and stream freezes unless the player is reloaded. Also in the application streams directory, certain .ts files are missing. missing  ts files

Join community.antmedia.io and be a part of Ant Media Server Community.

SelimEmre commented 2 years ago

Hi @Mohit-3196,

I have checked this issue. I did some tests regarding these details. As you know, we are stopping/starting the playlist concept. So, if you use settings.deleteHLSFilesOnEnded=false, you will see old latest .ts chunks on the folder. settings.deleteHLSFilesOnEnded=false should be true.

For a smooth stream, you should use at least 10 in the segment duration. During the restarting process, videojs player shouldn't need new chunks. For this requirement, I can recommend concatenating these videos into one video. Here is the guidance for the concatenate process: https://ottverse.com/3-easy-ways-to-concatenate-mp4-files-using-ffmpeg/

Best Regards, Selim

Mohit-3196 commented 2 years ago

Hi @SelimEmre , Thank you for looking into the issue and pardon for my delayed response. I tried by making settings.deleteHLSFilesOnEnded=true and increasing the segment duration to 10 or above but still when playing the .m3u8 it freezes and the playlist doesn't continue.

Also thank you the concatenating recommendation but for the customer's use case they will having number of small duration VOD files and multiple playlists. Also the playlist works smoothly for most of the other VOD files.

Best Regards, Mohit Dubey

ExpertMusic-business commented 2 years ago

Hi.

We installed Ant Media(2.4.3) on another server and the problem is the same. Do you have any roadmap for solving this problem?

SelimEmre commented 2 years ago

Hi @ExpertMusic-business,

The important thing is that video timestamp should be at least 1 minute. I tested it on my environment. It's working as expected. Please make sure Ant Media Server settings and video timestamp. If you book a meeting at this link, we can check it together.

Best Regards, Selim

ExpertMusic-business commented 2 years ago

Hi.

Did you test with one video or multiple videos in the playlist? Could you give us a command for ffmpeg so we can try to transcode all the videos first?

mekya commented 2 years ago

Hi Guys,

Just let me make a shot. When I check the videos, I see that I frame interval is about 3-4 seconds. Ant Media Server time interval is 2 seconds and you can change the Segment Duration on Web panel to 4 seconds or something. That may help. Here is the screenshot where to change the parameters.

Screenshot 2022-10-25 at 11 22 12

@ExpertMusic-business , I personally not tested. I think @SelimEmre has tested and can answer better. Just let me make another shot about the ffmpeg command that it creates key frames for every 2 seconds. It also means that Ant Media Server can create TS files for every 2 seconds for these inputs

ffmpeg  -i INPUT  -g 60 -vcodec libx264 OUTPUT.mp4 

-g 60 means that create key frame for every 60 frames and it concludes 2 seconds because your videos are 30fps.

I hope it helps. If not, please let us know.

Take care A. Oguz

ExpertMusic-business commented 2 years ago

Hello, Recoded the video with a segment length of 2 as you recommended (https://drive.google.com/drive/folders/1AQTSkTtZIkYcGoqyJ3qoyyMp-Q44i2xh?usp=sharing). The problem is that when one video ends, the stream ends and the next video starts as a new stream (there is a visual gap with text...we are waiting for the launch of a new stream ...) here is a link to the stream modete to watch short videos there https://streaming01.expertmusic.net:5443/argon/streams/880313878965780129933493.m3u8

How do I set up the playback of multiple files in one stream (so that there are no visual interruptions for a few [seconds)?[]

ExpertMusic-business commented 2 years ago

Good afternoon, colleagues! Did you see the previous message?

mekya commented 1 year ago

Hey @ExpertMusic-business ,

Thank you follow up. I've seen your message but I could not find sometime to test directly on my end. Let us have some time to test and respond to you

mekya commented 1 year ago

Hey @ExpertMusic-business,

I've just had a chance to test your files and fortunately, I've produced the same problem on my end. After some tests, I've realized that the root cause is one file has audio but other does not have. Web player cannot handle that.

Just let me give some more information about your files. One of the file has 25fps and other 30fps. Following command, encodes files with 30fps, remove audio and 2 seconds key frame interval.

ffmpeg -i input.mp4 -an -vcodec libx264 -g 60 -r 30 output.mp4 

Here are the encoded files that are working for me. Please try and let me know if it works for you.

https://user-images.githubusercontent.com/3456251/198882966-bd3653a0-9f56-49f5-9942-519724867ebd.mp4

https://user-images.githubusercontent.com/3456251/198882992-a6e197f8-2978-4e08-b9a5-f620779811fa.mp4

SelimEmre commented 1 year ago

Hi @mekya and @ExpertMusic-business,

Thank you for the detailed guidance @mekya. From my tests, I thought that it was related to short distances videos. That's why I wanted to concatenate these videos. But it was related to FPS and keyframe parameters. @ExpertMusic-business, please let me know when you did tests with the latest updates. If you need help with that we are ready to help you.

Best Regards, Selim

mekya commented 1 year ago

Hey @SelimEmre ,

Main problem is about audio. One video has silent audio but the other one has no audio. Secondary problem is about key frame interval and FPS.

FYI A. Oguz

ExpertMusic-business commented 1 year ago

Colleagues, good afternoon! Thanks for the files that you sent, colleagues will hush them up and I will write back As I wrote earlier, we deployed a second stream server and there one file plays in a circle https://streaming02.expertmusic.net:5443/youtube/streams/868146480093788902929995.m3u8 , but the problem is the same. When the file plays to the end, the stream ends and then a new stream starts to play the same file again. Here is the data of our monitoring system (http://joxi.ru/krDBRaytd8d9X2)

The question is whether it is possible to configure the ANT server so that after playing one file the stream does not end and a new one starts, but that the files are played in one stream?

ExpertMusic-business commented 1 year ago

Colleagues, good afternoon!

Thanks for the files that you sent, colleagues will hush them up and I will write back As I wrote earlier, we deployed a second stream server and there one file plays in a circle https://streaming02.expertmusic.net:5443/youtube/streams/868146480093788902929995.m3u8 , but the problem is the same. When the file plays to the end, the stream ends and then a new stream starts to play the same file again. Here is the data of our monitoring system (http://joxi.ru/krDBRaytd8d9X2)

The question is whether it is possible to configure the ANT server so that after playing one file the stream does not end and a new one starts, but that the files are played in one stream?

Best regards, Aleksey Matvienko ExpertMusic business @. 31.10.2022, 06:10 +0100, Ahmet Oğuz Mermerkaya @.>, писал:

Hey @SelimEmre , Main problem is about audio. One video has silent audio but the other one has no audio. Secondary problem is about key frame interval and FPS. FYI A. Oguz — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mekya commented 1 year ago

Dear Aleksey Good afternoon :)

Yes, let us have the feedback for the last two files are playing smoothly.

I see. Technically, it stops and starts the streaming maybe we can create an implementation task.

But please let me understand what you would like to achieve. You want to play the stream smoothly without any visual gap for single or multiple items in the playlist. If that's what you want, we can resolve it. Let me have the MP4 file for this stream(https://streaming02.expertmusic.net:5443/youtube/streams/868146480093788902929995.m3u8 )

If you want to achieve something else, please let me know.

Regards, A. Oguz

ExpertMusic-business commented 1 year ago

Colleagues

  1. Our back office is located in Kiev (now there is no electricity after the missile strikes in the morning) as soon as electricity appears, colleagues will replace the two files with the ones you sent and I will unsubscribe
  2. The file there is quite large 4-5 GB (colleagues will upload and I will send a link)

There are two problems:

ExpertMusic-business commented 1 year ago

Colleagues

  1. Our back office is located in Kiev (now there is no electricity after the missile strikes in the morning) as soon as electricity appears, colleagues will replace the two files with the ones you sent and I will unsubscribe
  2. The file there is quite large 4-5 GB (colleagues will upload and I will send a link)

There are two problems:

• the stream freezes when switching to playing another file (if it is 5 GB, then it is a few seconds until the file is loaded into the streaming player) - even in YouTube where the video is cached, an interruption similar to hanging lasts for several seconds and the music is interrupted at this time; • completion of the stream of one file (not stopping the stream, namely completion) launching a new stream. It is important for there to be one stream in which files are played sequentially without braking - this is important because music is interrupted now and on end players and android devices that play the stream, errors pop up on the screen informing about the end of the stream

Z poważaniem, Aleksiej Matwijenko ExpertMusic business Polska @. 31.10.2022, 14:54 +0100, Ahmet Oğuz Mermerkaya @.>, писал:

Dear Aleksey Good afternoon :) Yes, let us have the feedback for the last two files are playing smoothly. I see. Technically, it stops and starts the streaming maybe we can create an implementation task. But please let me understand what you would like to achieve. You want to play the stream smoothly without any visual gap for single or multiple items in the playlist. If that's what you want, we can resolve it. Let me have the MP4 file for this stream(https://streaming02.expertmusic.net:5443/youtube/streams/868146480093788902929995.m3u8 ) If you want to achieve something else, please let me know. Regards, A. Oguz — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mekya commented 1 year ago

Hi Aleksiej,

Thank you for the email.

I hope everything will be better on your end soon. We stand with Ukraine.

Yes, Please replace the two files and let us know your experience.

Generally, the solution we offer have a smooth experience in the playback side. Let's debug the issues together because we're happy to understand the problems you're having.

You don't need to send the whole file(5GB). Just truncate first 1 min and let me have the file. I'll just check the settings and loop the player so that I see if there is any interruption in the playback side.

Take care

Regards, A. Oguz

ExpertMusic-business commented 1 year ago

Good afternoon,

  1. Here is a link to the file that plays in a circle https://fex.net/ru/s/vrdnaz4 in the stream https://streaming02.expertmusic.net:5443/youtube/streams/868146480093788902929995.m3u8
  2. Changed the files to those that you sent and play in the stream https://streaming01.expertmusic.net:5443/argon/streams/880313878965780129933493.m3u8
  3. Can you tell me if you can implement the task so that several video files are played in one stream? (so that the stream does not end after playing each file and the new stream does not start playing when each file starts playing)
mekya commented 1 year ago

Hi @ExpertMusic-business ,

  1. I'm downloading it and I'll just truncate it to see the looping performs well.
  2. I've tested with FFmpeg and It's working for me. Switching between files are instantaneous for me. Is it working for you?
  3. Yes. I think nothing may change in the HLS playback side because there is the same experience with hls flags.
ExpertMusic-business commented 1 year ago

Hi @mekya

  1. Thank you. Our monitoring does not show that the stream ends. Stream is stable now. Please tell us all the requirements that video files must meet in order for the stream to work stably (so that we transcode existing files on other streams)
ExpertMusic-business commented 1 year ago

Good afternoon, colleagues! tell Did you see our message?

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

Sorry, I wasn't available these days. I couldn't update you. You should have the same FPS and keyframes in your records for stability. You can able to make it same with below FFmpeg code:

ffmpeg -i input.mp4 -an -vcodec libx264 -g 60 -r 30 output.mp4 

Best Regards, Selim

mekya commented 1 year ago

Let us know if it works for you @ExpertMusic-business

ExpertMusic-business commented 1 year ago

Good afternoon colleagues! tried the team that you sent to transcode the video on another stream channel [___](https://streaming01.expertmusic.net:5443/youtube/streams/005129912308854200706427.m3u8 youtube https://youtu.be/YC3MmfYojeY) But monitoring still shows that the stream ends and starts again http://joxi.ru/brR9Kqbc85651A Here are the files that are playing in the stream and which we transcoded (ffmpeg -i input.mp4 -an -vcodec libx264 -g 60 -r 30 output.mp4 ) you can download to check https://fex.net/uk/s/x4lyfmz Can you tell me what is the reason for the end and restart of the stream?

mekya commented 1 year ago

Hi @ExpertMusic-business ,

Let me download files and check it.

Which tool do you use to monitor the streams ? Let us use the same tool, monitor and see the problem.

Regards Oguz

ExpertMusic-business commented 1 year ago

Hi, You can download the files from here https://fex.net/uk/s/x4lyfmz

ExpertMusic-business commented 1 year ago

Hi, You can download the files from here https://fex.net/uk/s/x4lyfmz

I can add you to a group in Telegram - stream monitoring writes all messages to it. To do this, I need your nickname in Telegram or the phone number under which you enter Telegram

https://play.google.com/store/apps/details?id=org.telegram.messenger&hl=ru&gl=US&pli=1 https://apps.apple.com/ru/app/telegram/id686449807

Best regards, Aleksey Matvienko ExpertMusic business @. 18.11.2022, 08:56 +0100, Ahmet Oğuz Mermerkaya @.>, писал:

Hi @ExpertMusic-business , Let me download files and check it. Which tool do you use to monitor the streams ? Let us use the same tool, monitor and see the problem. Regards Oguz — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

I'm just testing. I will let you know about the results.

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Hi Selim Thanks I’m waiting

Best regards, Aleksey Matvienko ExpertMusic business @. 21.11.2022, 22:59 +0100, ant-media/Ant-Media-Server @.>, писал:

Selim

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

Yes, you're right. These files are the same properties as you told. I have cropped this videos from 2 minutes and 4 minutes and tested it in my test environment. Unfortunately, I couldn't reproduce it. Everythings are working as expected. I just wanted to confirm that, did you increase the Segment Duration to 4? Can we arrange a meeting for this issue? You can book a meeting any time at this link: https://calendly.com/antmedia

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Hi @SelimEmre tell me where and how to change the duration of the segment to 4?

ExpertMusic-business commented 1 year ago

Hi @SelimEmre tell me where and how to change the duration of the segment to 4?

Best regards, Aleksey Matvienko ExpertMusic business @. 23.11.2022, 23:16 +0100, ant-media/Ant-Media-Server @.>, писал:

Yes, you're right. These files are the same properties as you told. I have cropped this videos from 2 minutes and 4 minutes and tested it in my test environment. Unfortunately, I couldn't reproduce it. Everythings are working as expected. I just wanted to confirm that, did you increase the Segment Duration to 4? Can we arrange a meeting for this issue? You can book a meeting any time at this link: https://calendly.com/antmedia

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

You can add Segment Duration: 4 on App Settings as attached image:

Screenshot 2022-11-24 at 20 28 44

PS: Please don't forget to restart the stream after changing app settings.

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Hi Selim

changed the duration of the segment from 2 to http://joxi.ru/Vm6B4jWtKyQDDm but the problem remains - in the settings we have everything correctly specified http://joxi.ru/Vm6B4jWtKyQDDm ?

Best regards, Aleksey Matvienko ExpertMusic business @. 24.11.2022, 18:30 +0100, Selim Emre Toy @.>, писал:

Hi @ExpertMusic-business, You can add Segment Duration: 4 on App Settings as attached image: Best Regards, Selim — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

There is no problem with your app settings. Could you please book a meeting from this page: https://calendly.com/antmedia I want to do some tests with you in a meeting.

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Hi Selim

I don't speak English fluently

We have specially deployed a separate test server (the stream about which I wrote is running on it) - I can send you access to it so that you can forgive the tests.

Send access to Ant and virtual server?

Best regards, Aleksey Matvienko ExpertMusic business @. 26.11.2022, 14:36 +0100, Selim Emre Toy @.>, писал:

Hi @ExpertMusic-business, There is no problem with your app settings. Could you please book a meeting from this page: https://calendly.com/antmedia I want to do some tests with you in a meeting. Best Regards, Selim — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

We can continue with further details by email. I did some tests in our test environment. You can check directly.

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Good afternoon, what do we need to do?

Z poważaniem, Aleksiej Matwijenko ExpertMusic business Polska @. 4.12.2022, 18:03 +0100, ant-media/Ant-Media-Server @.>, писал:

We can continue with further details by email. I did some tests in our test environment. You can check directly.

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

Have a good day. I contacted you from your mail address. Just let you know.

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Hi Selim, Yes, we added your stream to monitoring - everything is ok. And our test stream with the same files monitoring fixes the termination and start of the stream by harmful 14 times a day. We have another server, I'll try to create a stream on it with the same files and write back

ExpertMusic-business commented 1 year ago

Hi Selim, on another ANT server, we tried to start a stream with one of the files that are played in your stream. On this second server, monitoring also fixes problems http://joxi.ru/LmGBnONtb4BoXr Colleagues, the problem is probably in setting up our ANT media server. I propose to provide access to one of the ANT servers (there are no production streams on this server) that we have deployed so that you can see the current settings and make changes to them if necessary and report what was wrong. Can we do that?

SelimEmre commented 1 year ago

Hi @ExpertMusic-business,

Have a good day. We did some improvements to the Playlist feature: https://github.com/ant-media/Ant-Media-Server/pull/4627 I'm assuming that it will fix your issue. I will update you when PR is merged. You can test it in your environment.

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Hi Selim great news! Looking forward to it

Z poważaniem, Aleksiej Matwijenko ExpertMusic business Polska @. 12.12.2022, 11:39 +0100, ant-media/Ant-Media-Server @.>, писал:

Have a good day. We did some improvements to the Playlist feature: #4627 I'm assuming that it will fix your issue. I will update you when PR is merged. You can test it in your environment.

asharamseervi commented 1 year ago

Hi @ExpertMusic-business, we had merged PR: https://github.com/ant-media/Ant-Media-Server/pull/4627 last week itself.

This is available with latest snapshots, give it a try in test instance if it resolves your reported issue or not, keep us posted! Thanks.

SelimEmre commented 1 year ago

Hi guys,

We are continuing with @ExpertMusic-business on the tickets. Let me update it here :) As far as I understand @ExpertMusic-business expects no start/stop process on broadcasting. He told me still the same with the latest version: http://joxi.net/EA4B405tZPLQKm

I think we should align here. In the playlist feature, we are stopping the older playlist records and starting new playlist records. So stopping and starting processes are expected behavior. But in our solution(HLS playlist settings etc.), people will not see start/stop processes during playing on the browser. They will not see any freeze or other problems.

Please correct me If I'm wrong @ExpertMusic-business

I hope, I'm clear to you guys.

Best Regards, Selim

ExpertMusic-business commented 1 year ago

Hi guys, Have you implemented so that when playing the next file from the playlist, the stream is not interrupted and does not start again, and the files are played continuously without interruption?

Rabbitpaaw-de commented 1 year ago

Is there a solution yet because of Twitch. It still quits the stream and restarts when it loads a new video. Am in despair :(

mekya commented 1 year ago

Hi @Rabbitpaaw-de,

We've scheduled this work for different developers two times and it seems that more senior developer need to take a look at this issue. So there is no update for this case.

Rabbitpaaw-de commented 1 year ago

Hi @Rabbitpaaw-de,

We've scheduled this work for different developers two times and it seems that more senior developer need to take a look at this issue. So there is no update for this case.

okey :(