Skip to content
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

MP4 to HLS #21

Closed
Leeaandrob opened this issue Sep 11, 2018 · 1 comment
Closed

MP4 to HLS #21

Leeaandrob opened this issue Sep 11, 2018 · 1 comment

Comments

@Leeaandrob
Copy link

Can you give an example to convert mp4 to hls 360p, 480p, 720p and 1080p?

@xfrr
Copy link
Owner

xfrr commented Sep 12, 2018

This is a matter of ffmpeg and the properties you need to establish are in the readme file.
Example:
`
....

var inputPath = "input.mp4"
var outputPath = "filename.m3u8"

func main() {

// Create new instance of transcoder
trans := new(transcoder.Transcoder)

// Initialize transcoder passing the input file path and output file path
err := trans.Initialize( inputPath, outputPath )
if err!=nil {
    panic(err)
}

// Copy video streams
trans.MediaFile().SetVideoCodec("copy")
// Set hls list size
trans.MediaFile().SetHlsListSize(0)
// Set HLS time
trans.MediaFile().SetHlsSegmentDuration(10)

// Start transcoder process without checking progress
done := trans.Run(false)

// This channel is used to wait for the process to end
err = <-done

}
...
`

@xfrr xfrr closed this as completed Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants