forked from petergeneric/unifi-protect-remux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubvfile_test.go
37 lines (29 loc) · 1.1 KB
/
ubvfile_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"log"
"testing"
"time"
"ubvremux/ubv"
)
func TestGenerateTimecode(t *testing.T) {
timecode := ubv.GenerateTimecode(time.Date(2023, time.Month(5), 16, 11, 58, 26, 500000000, time.UTC), 30)
log.Printf("Timecode Generated")
if timecode != "11:58:26.16" {
t.Errorf("Timecode generated is incorrect, got: %s, want: %s.", timecode, "11:58:26.16")
}
}
func TestCopyFrames(t *testing.T) {
ubvFile := "samples/FCECDA1F0A63_0_rotating_1597425468956.ubv"
info := ubv.Analyse(ubvFile, true)
log.Printf("\n\n*** Parsing complete! ***\n\n")
log.Printf("Number of partitions: %d", len(info.Partitions))
if len(info.Partitions) > 0 {
log.Printf("Partition %d", info.Partitions[0].Index)
log.Printf("Tracks: %d", len(info.Partitions[0].Tracks))
log.Printf("Frames: %d", len(info.Partitions[0].Frames))
log.Printf("Start Timecode: %s", info.Partitions[0].Tracks[7].StartTimecode.Format(time.RFC3339))
}
//
//demux.DemuxSinglePartitionToNewFiles(info.Filename, "/tmp/video.h264", "/tmp/audio.aac", info.Partitions[0])
t.Log("Analysis completed")
}