diff --git a/data/kryp-1.ts b/data/kryp-1.ts new file mode 100644 index 0000000000..382dca9aa7 Binary files /dev/null and b/data/kryp-1.ts differ diff --git a/data/kryp-2.ts b/data/kryp-2.ts new file mode 100644 index 0000000000..26d3e73737 Binary files /dev/null and b/data/kryp-2.ts differ diff --git a/ffmpeg/api_test.go b/ffmpeg/api_test.go index 1eefc1f92d..949d5c1b33 100644 --- a/ffmpeg/api_test.go +++ b/ffmpeg/api_test.go @@ -1322,6 +1322,46 @@ func TestTranscoderAPI_ClipInvalidConfig(t *testing.T) { } } +func noKeyframeSegment(t *testing.T, accel Acceleration) { + // Reproducing #219 + run, dir := setupTest(t) + defer os.RemoveAll(dir) + + cmd := ` + cp "$1"/../data/kryp-*.ts . + + # verify no keyframes in kryp-2.ts but there in kryp-1.ts + ffprobe -select_streams v -show_streams -show_packets kryp-1.ts | grep flags=K | wc -l | grep 1 + ffprobe -select_streams v -show_streams -show_packets kryp-2.ts | grep flags=K | wc -l | grep 0 + ` + run(cmd) + + prof := P144p30fps16x9 + for i := 1; i <= 2; i++ { + tc := NewTranscoder() + in := &TranscodeOptionsIn{ + Fname: fmt.Sprintf("%s/kryp-%d.ts", dir, i), + Accel: accel, + } + out := []TranscodeOptions{{ + Oname: fmt.Sprintf("%s/out%d.ts", dir, i), + Profile: prof, + Accel: accel, + }} + _, err := tc.Transcode(in, out) + if i == 2 && (err == nil || err.Error() != "No keyframes in input") { + t.Error("Expected to fail for no keyframe segment but did not") + } else if i != 2 && err != nil { + t.Error(err) + } + tc.StopTranscoder() + } +} + +func TestTranscoder_NoKeyframe(t *testing.T) { + noKeyframeSegment(t, Software) +} + /* func detectionFreq(t *testing.T, accel Acceleration) { run, dir := setupTest(t) @@ -1377,46 +1417,3 @@ func TestTranscoder_DetectionFreq(t *testing.T) { detectionFreq(t, Software) } */ - -/* -func noKeyframeSegment(t *testing.T, accel Acceleration) { - // Reproducing #219 - run, dir := setupTest(t) - defer os.RemoveAll(dir) - - cmd := ` - cp "$1"/../transcoder/kryp-*.ts . - - # verify no keyframes in kryp-2.ts but there in kryp-1.ts - ffprobe -select_streams v -show_streams -show_packets kryp-1.ts | grep flags=K | wc -l | grep 1 - ffprobe -select_streams v -show_streams -show_packets kryp-2.ts | grep flags=K | wc -l | grep 0 - ` - run(cmd) - - tc := NewTranscoder() - prof := P144p30fps16x9 - for i := 1; i <= 2; i++ { - in := &TranscodeOptionsIn{ - Fname: fmt.Sprintf("%s/kryp-%d.ts", dir, i), - Accel: accel, - } - out := []TranscodeOptions{{ - Oname: fmt.Sprintf("%s/out%d.ts", dir, i), - Profile: prof, - Accel: accel, - }} - _, err := tc.Transcode(in, out) - if i == 2 && (err == nil || err.Error() != "No keyframes in input") { - t.Error("Expected to fail for no keyframe segment but did not") - } else if i != 2 && err != nil { - t.Error(err) - } - } - tc.StopTranscoder() - -} - -func TestTranscoder_NoKeyframe(t *testing.T) { - noKeyframeSegment(t, Software) -} -*/ diff --git a/ffmpeg/nvidia_test.go b/ffmpeg/nvidia_test.go index 165100efa4..e27c3ff495 100644 --- a/ffmpeg/nvidia_test.go +++ b/ffmpeg/nvidia_test.go @@ -792,15 +792,13 @@ func TestNvidia_OutputFPS(t *testing.T) { outputFPS(t, Nvidia) } -/* -func TestNvidia_DetectionFreq(t *testing.T) { - detectionFreq(t, Nvidia) +func TestNvidia_NoKeyframe(t *testing.T) { + noKeyframeSegment(t, Nvidia) } -*/ /* -func TestNvidia_NoKeyframe(t *testing.T) { - noKeyframeSegment(t, Nvidia) +func TestNvidia_DetectionFreq(t *testing.T) { + detectionFreq(t, Nvidia) } */