Skip to content
Permalink
Browse files

Add bitrate to contact sheet

  • Loading branch information...
HenrySlawniak committed Sep 13, 2018
1 parent 6034f79 commit deb97805e0270a6e73f514425e4262e9b93d3d18
Showing with 10 additions and 7 deletions.
  1. +6 −6 contactsheet.go
  2. +4 −1 metadata.go
@@ -40,8 +40,8 @@ const (
GutterSize = 50
MinSheetWidth = 1200

FontSize = 40
FontSpacing = 0.9
FontSize = 30
FontSpacing = 0.7
FontDPI = 72
HeaderSize = 200
)
@@ -133,17 +133,17 @@ func generateContactSheet(vid *Video, numFrames int) {
log.Error(err)
return
}
pt.X += c.PointToFixed((FontSize * .7) * FontSpacing)
pt.X += c.PointToFixed(FontSize * FontSpacing)
}

pt = freetype.Pt(10, 65+FontSize+int(c.PointToFixed((FontSize))>>6))
for _, s := range fmt.Sprintf("Duration: %s, Dimmensions: %dx%d, Codec: %s", stampToString(vid.Duration), vid.Width, vid.Height, vid.Codec) {
for _, s := range fmt.Sprintf("Duration: %s, Dimmensions: %dx%d, Bitrate: %s kbps, Codec: %s", stampToString(vid.Duration), vid.Width, vid.Height, vid.Meta.Format.BitRate, vid.Codec) {
_, err := c.DrawString(string(s), pt)
if err != nil {
log.Error(err)
return
}
pt.X += c.PointToFixed((FontSize * .7) * FontSpacing)
pt.X += c.PointToFixed(FontSize * FontSpacing)
}

if *writeAttribution {
@@ -155,7 +155,7 @@ func generateContactSheet(vid *Video, numFrames int) {
log.Error(err)
return
}
pt.X += c.PointToFixed((FontSize * .3) * FontSpacing)
pt.X += c.PointToFixed((FontSize * 0.5) * FontSpacing)
}
c.SetFontSize(FontSize)
}
@@ -31,6 +31,8 @@ type ffprobeOutput struct {
Format struct {
Duration string
FormatName string `json:"format_name"`
BitRate string `json:"bit_rate"`
Size string
}
}

@@ -55,7 +57,8 @@ func getFFProbeMetadata(path string) (*ffprobeOutput, error) {
binary,
"-v", "error",
"-show_streams",
"-show_entries", "format=width,height,duration_ts,duration,index,codec_type,codec_name,format_name,avg_frame_rate",
"-show_format",
// "-show_entries", "format=width,height,duration_ts,duration,index,codec_type,codec_name,format_name,avg_frame_rate,bit_rate",
"-print_format", "json",
path,
)

0 comments on commit deb9780

Please sign in to comment.
You can’t perform that action at this time.