fix: issues
This commit is contained in:
@@ -110,6 +110,12 @@ func (d *DiscoverMedias) processVideo(video string, to string) (media_store.Vide
|
||||
return info, errors.Wrapf(err, "ffmpeg audio to m3u8: %s", audioFile)
|
||||
}
|
||||
|
||||
// extract poster
|
||||
posterFile := filepath.Join(to, "poster.jpg")
|
||||
if err := d.ffmpegVideoToPoster(video, posterFile); err != nil {
|
||||
return info, errors.Wrapf(err, "ffmpeg video to poster: %s", video)
|
||||
}
|
||||
|
||||
// get media duration
|
||||
duration, err := d.getMediaDuration(video)
|
||||
if err != nil {
|
||||
@@ -261,11 +267,11 @@ func (d *DiscoverMedias) runCleanup(to string) {
|
||||
}
|
||||
|
||||
// getSnapshot get the snapshot of target seconds of a video
|
||||
func (d *DiscoverMedias) ffmpegVideoToPoster(video string, output string, seconds int) error {
|
||||
func (d *DiscoverMedias) ffmpegVideoToPoster(video string, output string) error {
|
||||
// ffmpeg -i input_video.mp4 -ss N -vframes 1 -vf "scale=width:height" output_image.jpg
|
||||
args := []string{
|
||||
"-i", video,
|
||||
"-ss", fmt.Sprintf("00:%02d:00", seconds),
|
||||
"-ss", "00:01:00",
|
||||
"-vframes", "1",
|
||||
"-vf", "scale=640:360",
|
||||
output,
|
||||
|
||||
Reference in New Issue
Block a user