diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index f05ba01..b9a8ec9 100644 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -22,15 +22,15 @@ const ( ) type Metadata struct { - Orientation int `json:"orientation"` - Duration time.Duration `json:"duration,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - Title string `json:"title,omitempty"` - Artist string `json:"artist,omitempty"` - HasVideo bool `json:"has_video"` - HasAudio bool `json:"has_audio"` - HasAlpha bool `json:"has_alpha"` + 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"` + HasVideo bool `json:"has_video"` + HasAudio bool `json:"has_audio"` + HasAlpha bool `json:"has_alpha"` } type AVContext struct { @@ -94,7 +94,7 @@ func (av *AVContext) Close() { func (av *AVContext) Metadata() *Metadata { return &Metadata{ Orientation: av.orientation, - Duration: av.duration, + Duration: int(av.duration / time.Millisecond), Width: av.width, Height: av.height, Title: av.title, diff --git a/testdata/golden/meta/alpha-webm.webm.meta.json b/testdata/golden/meta/alpha-webm.webm.meta.json index a10a0e9..41dd118 100644 --- a/testdata/golden/meta/alpha-webm.webm.meta.json +++ b/testdata/golden/meta/alpha-webm.webm.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":12040000000,"width":720,"height":576,"has_video":true,"has_audio":false,"has_alpha":true} \ No newline at end of file +{"orientation":1,"duration":12040,"width":720,"height":576,"has_video":true,"has_audio":false,"has_alpha":true} \ No newline at end of file diff --git a/testdata/golden/meta/everybody-betray-me.mkv.meta.json b/testdata/golden/meta/everybody-betray-me.mkv.meta.json index d64a578..7208d9f 100644 --- a/testdata/golden/meta/everybody-betray-me.mkv.meta.json +++ b/testdata/golden/meta/everybody-betray-me.mkv.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":7407000000,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"orientation":1,"duration":7407,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file diff --git a/testdata/golden/meta/macabre.mp4.meta.json b/testdata/golden/meta/macabre.mp4.meta.json index 63fac20..9c8500b 100644 --- a/testdata/golden/meta/macabre.mp4.meta.json +++ b/testdata/golden/meta/macabre.mp4.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":3925000000,"width":492,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"orientation":1,"duration":3925,"width":492,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file diff --git a/testdata/golden/meta/schizo.flv.meta.json b/testdata/golden/meta/schizo.flv.meta.json index 33cb162..25bcbff 100644 --- a/testdata/golden/meta/schizo.flv.meta.json +++ b/testdata/golden/meta/schizo.flv.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":2560000000,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"orientation":1,"duration":2560,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file diff --git a/testdata/golden/meta/schizo_0.mp4.meta.json b/testdata/golden/meta/schizo_0.mp4.meta.json index 11ac160..8f81096 100644 --- a/testdata/golden/meta/schizo_0.mp4.meta.json +++ b/testdata/golden/meta/schizo_0.mp4.meta.json @@ -1 +1 @@ -{"orientation":1,"duration":2544000000,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"orientation":1,"duration":2544,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file diff --git a/testdata/golden/meta/schizo_180.mp4.meta.json b/testdata/golden/meta/schizo_180.mp4.meta.json index 4a2c30f..8bd563b 100644 --- a/testdata/golden/meta/schizo_180.mp4.meta.json +++ b/testdata/golden/meta/schizo_180.mp4.meta.json @@ -1 +1 @@ -{"orientation":3,"duration":2544000000,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"orientation":3,"duration":2544,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file diff --git a/testdata/golden/meta/schizo_270.mp4.meta.json b/testdata/golden/meta/schizo_270.mp4.meta.json index c6dc90f..030c8f8 100644 --- a/testdata/golden/meta/schizo_270.mp4.meta.json +++ b/testdata/golden/meta/schizo_270.mp4.meta.json @@ -1 +1 @@ -{"orientation":6,"duration":2544000000,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"orientation":6,"duration":2544,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file diff --git a/testdata/golden/meta/schizo_90.mp4.meta.json b/testdata/golden/meta/schizo_90.mp4.meta.json index ce6a96e..255fcc9 100644 --- a/testdata/golden/meta/schizo_90.mp4.meta.json +++ b/testdata/golden/meta/schizo_90.mp4.meta.json @@ -1 +1 @@ -{"orientation":8,"duration":2544000000,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"orientation":8,"duration":2544,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file diff --git a/testdata/golden/result/meta/everybody-betray-me.mkv b/testdata/golden/result/meta/everybody-betray-me.mkv index 53a0f24..07eec9a 100644 --- a/testdata/golden/result/meta/everybody-betray-me.mkv +++ b/testdata/golden/result/meta/everybody-betray-me.mkv @@ -1 +1 @@ -{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407000000,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file +{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false} \ No newline at end of file