Skip to content

Commit

Permalink
sent ffmpeg output to file
Browse files Browse the repository at this point in the history
This reverts commit a4fd754a22755ffd5da4c28b2adac2c402ead719.
  • Loading branch information
pablochacin committed Mar 5, 2024
1 parent 3b57552 commit ba2bac6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions common/videocapture.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ func newVideoCapture(
"-i", "pipe:0",
// set output format
"-f", "webm",
// set quality
//"-crf", fmt.Sprintf("%d", opts.Quality),
// optimize for speed
"-deadline", "realtime", "-cpu-used", "8",
// write to sdtout
"pipe:1",
//"pipe:1",
"-y",
opts.Path, // FIXME: send to stdout

Check failure on line 82 in common/videocapture.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s prefix(github.com/grafana/xk6-browser) -s prefix(go.k6.io) -s default (gci)
)
ffmpegCmd.Stderr = os.Stderr // FIXME: for debugging

Check failure on line 84 in common/videocapture.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s prefix(github.com/grafana/xk6-browser) -s prefix(go.k6.io) -s default (gci)

Expand All @@ -84,10 +88,10 @@ func newVideoCapture(
return nil, fmt.Errorf("creating ffmpeg stdin pipe: %w", err)
}

ffmpegOut, err := ffmpegCmd.StdoutPipe()
if err != nil {
return nil, fmt.Errorf("creating ffmpeg stdout pipe: %w", err)
}
// ffmpegOut, err := ffmpegCmd.StdoutPipe()
// if err != nil {
// return nil, fmt.Errorf("creating ffmpeg stdout pipe: %w", err)
// }

err = ffmpegCmd.Start()
if err != nil {
Expand All @@ -101,7 +105,7 @@ func newVideoCapture(
persister: persister,
ffmpegCmd: *ffmpegCmd,
ffmpegIn: ffmpegIn,
ffmpegOut: ffmpegOut,
// ffmpegOut: ffmpegOut,

Check failure on line 108 in common/videocapture.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s prefix(github.com/grafana/xk6-browser) -s prefix(go.k6.io) -s default (gci)
}, nil
}

Expand Down Expand Up @@ -138,9 +142,9 @@ func (v *videocapture) handleFrame(ctx context.Context, frame *VideoFrame) error
func (v *videocapture) Close(ctx context.Context) error {

Check warning on line 142 in common/videocapture.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
_ = v.ffmpegIn.Close()

Check failure on line 144 in common/videocapture.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s prefix(github.com/grafana/xk6-browser) -s prefix(go.k6.io) -s default (gci)
if err := v.persister.Persist(ctx, v.opts.Path, v.ffmpegOut); err != nil {
return fmt.Errorf("creating video file: %w", err)
}
// if err := v.persister.Persist(ctx, v.opts.Path, v.ffmpegOut); err != nil {
// return fmt.Errorf("creating video file: %w", err)
// }

return nil
}

0 comments on commit ba2bac6

Please sign in to comment.