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

ffprobe cache #26

Open rudnypc opened 2 years ago

rudnypc commented 2 years ago

When the cache is true, can we save the ffprobe stream result? Every request to the same file with different resolution (maybe the same too), the ffprobe is running again.

m1k1o commented 2 years ago

Hmm, it should not do again. Is the cache file there?

m1k1o commented 2 years ago

I tried it, got media local cache hit and no ffprobe running. Do you use global or local cache? Do you see this entry in log?

rudnypc commented 2 years ago

I'm using cache inside the vod tag, Should I put this cache outsite?

m1k1o commented 2 years ago

I'm using cache inside the vod tag,

Correct.

Found some issue, when cache does not contain keyframes (if selected) when accesssing master playlist.

rudnypc commented 2 years ago

The ffprobe now is starting from the master and each profile. Before ffprobe was only started from the profile.

m1k1o commented 2 years ago

They should share the same cache. But I think, the problem is race condition. When master profile starts ffprobe, it takes some time. If some profile starts in meanwhile, it does not see cache entry and starts again. It does not know, that other ffprobe is in progress, since every profile has its own manager started.

rudnypc commented 2 years ago

sorry, now that I made a mistake, the cache is working now

rudnypc commented 2 years ago

Ok, but when I set the cache is true, the generator doesn't use the ffprobe keyframe

m1k1o commented 2 years ago

Another problem is, that when the cache exists, even without keyframes, it does not generate them. I think that should be fixed too. So if you have valid cache without keyframes, it won't generate them additionally.