mirror of
https://github.com/livepeer/lpms
synced 2026-04-23 00:07:25 +08:00
ffmpeg/detector: Add support for content detection
Co-authored-by: Jai Luthra <me@jailuthra.in>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/livepeer/lpms/ffmpeg"
|
||||
)
|
||||
@@ -48,7 +49,9 @@ func main() {
|
||||
o := ffmpeg.TranscodeOptions{
|
||||
Oname: fmt.Sprintf("out_%s_%d_out.mkv", lbl, i),
|
||||
Profile: profs[i],
|
||||
Accel: accel,
|
||||
// Uncomment the following to test scene classifier
|
||||
// Detector: &ffmpeg.DSceneAdultSoccer,
|
||||
Accel: accel,
|
||||
}
|
||||
opts = append(opts, o)
|
||||
}
|
||||
@@ -66,6 +69,7 @@ func main() {
|
||||
|
||||
ffmpeg.InitFFmpeg()
|
||||
|
||||
t := time.Now()
|
||||
fmt.Printf("Setting fname %s encoding %d renditions with %v\n", fname, len(options), lbl)
|
||||
res, err := ffmpeg.Transcode3(&ffmpeg.TranscodeOptionsIn{
|
||||
Fname: fname,
|
||||
@@ -75,8 +79,14 @@ func main() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
end := time.Now()
|
||||
fmt.Printf("profile=input frames=%v pixels=%v\n", res.Decoded.Frames, res.Decoded.Pixels)
|
||||
for i, r := range res.Encoded {
|
||||
fmt.Printf("profile=%v frames=%v pixels=%v\n", profiles[i].Name, r.Frames, r.Pixels)
|
||||
if r.DetectData != nil {
|
||||
fmt.Printf("profile=%v frames=%v pixels=%v detectdata=%v\n", profiles[i].Name, r.Frames, r.Pixels, r.DetectData)
|
||||
} else {
|
||||
fmt.Printf("profile=%v frames=%v pixels=%v\n", profiles[i].Name, r.Frames, r.Pixels)
|
||||
}
|
||||
}
|
||||
fmt.Printf("Transcoding time %0.4v\n", end.Sub(t).Seconds())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user