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

Problem in the first segment in ffmpeg #29

Closed rudnypc closed 2 years ago

rudnypc commented 2 years ago

image

When I requested the first segment, I saw the ffmpeg command with -ss number. I think this might be a wrong argument, right?

rudnypc commented 2 years ago
4:03AM INF new hls vod request hlsResource=1080p-00001.ts module=hlsvod path=mymovie.mkv/1080p-00001.ts vodMediaPath=media/mymovie.mkv
4:03AM INF transcoding segments limit=5 module=hlsvod offset=1 segments-times=[2.5025,5.005,7.591,10.594,13.096499999999999,15.599] submodule=manager
4:03AM INF transcode process started limit=5 module=hlsvod offset=1 submodule=manager
2021/12/08 04:03:14 Guessed Channel Layout for Input Stream #0.1 : 5.1
4:03AM INF transcode process returned a segment index=1 limit=5 module=hlsvod offset=1 segment=1080p-00001.ts submodule=manager
4:03AM INF transcode process returned a segment index=2 limit=5 module=hlsvod offset=1 segment=1080p-00002.ts submodule=manager
4:03AM INF transcode process returned a segment index=3 limit=5 module=hlsvod offset=1 segment=1080p-00003.ts submodule=manager
4:03AM INF transcode process returned a segment index=4 limit=5 module=hlsvod offset=1 segment=1080p-00004.ts submodule=manager
4:03AM INF transcode process returned a segment index=5 limit=5 module=hlsvod offset=1 segment=1080p-00005.ts submodule=manager
4:03AM INF transcode process returned a segment index=6 limit=5 module=hlsvod offset=1 segment=1080p-00006.ts submodule=manager
2021/12/08 04:03:24 FFmpeg process successfully finished.
4:03AM INF transcode process finished index=7 limit=5 module=hlsvod offset=1 submodule=manager
m1k1o commented 2 years ago

Yes, good catch. that looks like the playlist should start from 0 but it does not. Even 0-th segment is not available, because it was not initialized - it starts from 1 instead of 0. https://github.com/m1k1o/go-transcode/blob/9f59d03a6504e756421f164de60ee68083b18516/hlsvod/manager.go#L265

And also playlist should start from 0. https://github.com/m1k1o/go-transcode/blob/9f59d03a6504e756421f164de60ee68083b18516/hlsvod/manager.go#L235-L240

m1k1o commented 2 years ago

Now it should be fixed.

rudnypc commented 2 years ago

Fixed, thanks ;)