diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index f05119e..13d5fa6 100644 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -23,16 +23,16 @@ const ( ) type Metadata struct { - Orientation int `json:"orientation"` - Duration int `json:"duration,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - Title string `json:"title,omitempty"` - Artist string `json:"artist,omitempty"` - FPS int `json:"fps,omitempty"` - SelectedFrame int `json:"selected_frame,omitempty"` - HasVideo bool `json:"has_video"` - HasAudio bool `json:"has_audio"` + Orientation int `json:"orientation"` + Duration int `json:"duration,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + Title string `json:"title,omitempty"` + Artist string `json:"artist,omitempty"` + FPS float64 `json:"fps,omitempty"` + SelectedFrame int `json:"selected_frame,omitempty"` + HasVideo bool `json:"has_video"` + HasAudio bool `json:"has_audio"` } type AVContext struct { @@ -139,7 +139,7 @@ func (av *AVContext) Metadata() *Metadata { Height: av.height, Title: av.title, Artist: av.artist, - FPS: int(math.Round(fps)), + FPS: math.Round(fps*10) / 10, SelectedFrame: selectedFrame, HasVideo: av.hasVideo, HasAudio: av.hasAudio, diff --git a/testdata/golden/meta/everybody-betray-me.mkv-5.meta.json b/testdata/golden/meta/everybody-betray-me.mkv-5.meta.json index 675574e..87f0dce 100644 --- a/testdata/golden/meta/everybody-betray-me.mkv-5.meta.json +++ b/testdata/golden/meta/everybody-betray-me.mkv-5.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":5,"has_video":true,"has_audio":true} \ No newline at end of file +{"orientation":1,"duration":7407,"width":640,"height":480,"fps":29.9,"selected_frame":5,"has_video":true,"has_audio":true} \ No newline at end of file diff --git a/testdata/golden/meta/schizo.flv-10.meta.json b/testdata/golden/meta/schizo.flv-10.meta.json index d8f93f3..49fd2d9 100644 --- a/testdata/golden/meta/schizo.flv-10.meta.json +++ b/testdata/golden/meta/schizo.flv-10.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":2560,"width":480,"height":360,"fps":28,"selected_frame":5,"has_video":true,"has_audio":true} \ No newline at end of file +{"orientation":1,"duration":2560,"width":480,"height":360,"fps":27.9,"selected_frame":5,"has_video":true,"has_audio":true} \ No newline at end of file diff --git a/testdata/golden/meta/schizo.flv-5.meta.json b/testdata/golden/meta/schizo.flv-5.meta.json index f8bd1cb..f8c9fd7 100644 --- a/testdata/golden/meta/schizo.flv-5.meta.json +++ b/testdata/golden/meta/schizo.flv-5.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":2560,"width":480,"height":360,"fps":26,"selected_frame":5,"has_video":true,"has_audio":true} \ No newline at end of file +{"orientation":1,"duration":2560,"width":480,"height":360,"fps":26.3,"selected_frame":5,"has_video":true,"has_audio":true} \ No newline at end of file diff --git a/testdata/golden/meta/schizo.flv-9999.meta.json b/testdata/golden/meta/schizo.flv-9999.meta.json index 4e6eb17..dc6c33b 100644 --- a/testdata/golden/meta/schizo.flv-9999.meta.json +++ b/testdata/golden/meta/schizo.flv-9999.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":2560,"width":480,"height":360,"fps":30,"selected_frame":75,"has_video":true,"has_audio":true} \ No newline at end of file +{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true} \ No newline at end of file diff --git a/testdata/golden/meta/schizo.flv-99999.meta.json b/testdata/golden/meta/schizo.flv-99999.meta.json index 4e6eb17..dc6c33b 100644 --- a/testdata/golden/meta/schizo.flv-99999.meta.json +++ b/testdata/golden/meta/schizo.flv-99999.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":2560,"width":480,"height":360,"fps":30,"selected_frame":75,"has_video":true,"has_audio":true} \ No newline at end of file +{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true} \ No newline at end of file diff --git a/testdata/golden/result/meta/filters%3Amax_frames%286%29/everybody-betray-me.mkv b/testdata/golden/result/meta/filters%3Amax_frames%286%29/everybody-betray-me.mkv index 9f69103..831ef0d 100644 --- a/testdata/golden/result/meta/filters%3Amax_frames%286%29/everybody-betray-me.mkv +++ b/testdata/golden/result/meta/filters%3Amax_frames%286%29/everybody-betray-me.mkv @@ -1 +1 @@ -{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":3,"has_video":true,"has_audio":true} \ No newline at end of file +{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"fps":29.9,"selected_frame":3,"has_video":true,"has_audio":true} \ No newline at end of file