Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions server/lib/recorder/ffmeg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ func TestFFmpegRecorder_Params(t *testing.T) {
assert.Equal(t, *params.OutputDir, *got.OutputDir)
}

func TestFFmpegArgs_PadsOddDimensions(t *testing.T) {
tempDir := t.TempDir()
args, err := ffmpegArgs(defaultParams(tempDir), filepath.Join(tempDir, "out.mp4"))
require.NoError(t, err)

var vf string
for i, a := range args {
if a == "-vf" && i+1 < len(args) {
vf = args[i+1]
break
}
}
assert.Equal(t, "pad=ceil(iw/2)*2:ceil(ih/2)*2", vf)
}

func TestFFmpegRecorder_ForceStop(t *testing.T) {
tempDir := t.TempDir()
rec := &FFmpegRecorder{
Expand Down
4 changes: 4 additions & 0 deletions server/lib/recorder/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,10 @@ func ffmpegArgs(params FFmpegRecordingParams, outputPath string) ([]string, erro

// Output options next
args = append(args, []string{
// yuv420p requires even width and height; pad odd source dimensions by one pixel
// so libx264 doesn't fail to open the encoder.
"-vf", "pad=ceil(iw/2)*2:ceil(ih/2)*2",

// Video encoding
"-c:v", "libx264",
"-profile:v", "high", // Explicit web-compatible profile
Expand Down
Loading