m1k1o / go-transcode

On-demand transcoding origin server for live inputs and static files in Go using ffmpeg. Also with NVIDIA GPU hardware acceleration.
Apache License 2.0
208 stars 38 forks source link

Closing ffmpeg when isn't used #25

Open rudnypc opened 2 years ago

rudnypc commented 2 years ago

The ffmpeg will be killed after 50 segments are created. But When I start a video with a index file, the vlc start all playlists and some ffmpeg instances are started, this slows down the server, maybe there should be a better control to disable ffmpeg when not used, and when used, increase the limit from 50 to another after new requests, so there is no cut in audio between old and new segments.

rudnypc commented 2 years ago

When the ffmpeg is closed, is the last segment complete? When I try to kill the ffmpeg, always the last segment is corrupted.

m1k1o commented 2 years ago

Yes, it does not kill ffmpeg just waits it to finish. That would need to be implemented. What kill signal do you use?

rudnypc commented 2 years ago

I tried "kill -9|HUP|SIGINT", pressing "q"... I saw the ffmpeg command with only "-ss" inside the go-transcode, because this I asked about it.

rudnypc commented 2 years ago

I have tested ffmpeg a lot, the best video process is to keep ffmpeg until the end of the video when getting new segment, you can close ffmpeg only if it asks for a future segment (seek) or if it doesn't request a new segment for a while (timeout ).