refactor(ffmpeg): use float for FPS

* refactor(ffmpeg): use float for FPS

* test: update golden files
This commit is contained in:
Adrian Shum 2022-10-14 14:26:47 +08:00 committed by GitHub
parent 2cf461421d
commit 5ff3407305
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 17 deletions

View file

@ -29,7 +29,7 @@ type Metadata struct {
Height int `json:"height,omitempty"`
Title string `json:"title,omitempty"`
Artist string `json:"artist,omitempty"`
FPS int `json:"fps,omitempty"`
FPS float64 `json:"fps,omitempty"`
SelectedFrame int `json:"selected_frame,omitempty"`
HasVideo bool `json:"has_video"`
HasAudio bool `json:"has_audio"`
@ -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,

View file

@ -1 +1 @@
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":5,"has_video":true,"has_audio":true}
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":29.9,"selected_frame":5,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":28,"selected_frame":5,"has_video":true,"has_audio":true}
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":27.9,"selected_frame":5,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":26,"selected_frame":5,"has_video":true,"has_audio":true}
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":26.3,"selected_frame":5,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":30,"selected_frame":75,"has_video":true,"has_audio":true}
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":30,"selected_frame":75,"has_video":true,"has_audio":true}
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true}

View file

@ -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}
{"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}